FLO-5: Consistent behaviour in withdrawAndPull/depositAndPush#286
Draft
jordanschalm wants to merge 4 commits intomainfrom
Draft
FLO-5: Consistent behaviour in withdrawAndPull/depositAndPush#286jordanschalm wants to merge 4 commits intomainfrom
jordanschalm wants to merge 4 commits intomainfrom
Conversation
…rce is true Previously, withdrawAndPull only triggered the top-up source when health dropped below minHealth, while depositAndPush always rebalanced to targetHealth. This asymmetry left positions between minHealth and targetHealth without rebalancing. Now both operations consistently rebalance to targetHealth when their respective flags are set. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move test_withdrawAndPull_rebalancesToTargetHealth into rebalance_undercollateralised_test.cdc and add the symmetric testDepositAndPush_rebalancesToTargetHealth to rebalance_overcollateralised_test.cdc. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…thinVariance Update docstrings for withdrawAndPull and depositAndPush across FlowALPv0, FlowALPPositionResources, and FlowALPModels to state that the push/pull always occurs at withdraw/deposit time and always attempts to restore targetHealth. Switch tests to equalWithinVariance for rounding-safe comparisons. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…-source bug Add 13 scenario tests covering all combinations of pull/push flags, health thresholds, and source/sink availability. Move the two earlier tests into the new file and remove them from the rebalance test files. Fix bug where withdrawAndPull panicked when pullFromTopUpSource=true, health was between minHealth and targetHealth, but no topUpSource was configured. The withdrawal now succeeds since the position is still above minHealth (best-effort semantics). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #214
Previously, withdrawAndPull only triggered the top-up source when health dropped below minHealth, while depositAndPush always rebalanced to targetHealth. This asymmetry left positions between minHealth and targetHealth without rebalancing. Now both operations consistently rebalance to targetHealth when their respective flags are set.