-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Summary
Scenario 3 close tests in FYV currently depend on the FlowALP dust-balance workaround from PR #163.
Without that workaround, all Scenario 3 variants fail during closeYieldVault.
This indicates we still have a precision/dust close-path dependency between FYV and FlowALP.
Reproduction
Use FlowALP commit without the workaround:
git -C lib/FlowALP checkout 27eea85
flow test cadence/tests/rebalance_scenario3a_test.cdc
flow test cadence/tests/rebalance_scenario3b_test.cdc
flow test cadence/tests/rebalance_scenario3c_test.cdc
flow test cadence/tests/rebalance_scenario3d_test.cdcResult: all fail.
Actual behavior
Close fails with assertion in FlowALP:
lib/FlowALP/cadence/contracts/FlowALPv1.cdc:3013- Assertion:
remainingBalance == 0.0 || positionSatisfiesMinimumBalance(...)
Call path from FYV close:
cadence/contracts/FlowYieldVaults.cdc:476(yieldVault.withdraw(getYieldVaultBalance()))cadence/contracts/FlowYieldVaultsStrategies.cdc:99FlowALPv1withdrawAndPull(...)-> dust assertion
Numerical evidence
Observed remaining balances that trigger failure:
- Scenario 3a:
0.000002550368342332749998 - Scenario 3b:
0.000000009999999999999997 - Scenario 3c:
0.000000000368342332749441 - Scenario 3d:
0.000000010000000000000000
These are tiny residuals from precision/rounding, but non-zero, so strict zero check fails close.
Why this matters
FYV close behavior is not robust unless the upstream dust relaxation is present.
This creates fragile coupling and can regress with FlowALP ref updates.
Expected behavior
closeYieldVault should be resilient to precision dust and complete successfully without relying on a branch-specific workaround.
Either:
- close logic fully zeroes/reconciles residuals before final assertion, or
- protocol-level dust handling is explicitly defined and stable across refs.
Related
- FlowALP PR Recreate Simulation Scenario 3d With Fork Testing Setup #163 (workaround): Close Position method FlowALP#163
- FYV precision close tracking: closeYieldVault can leave residual FCM position due to precision/rounding #178
- FYV residual burn issue: Closing YieldVault can burn residual AutoBalancer yield tokens (mainnet WETH↔tauUSDFv), returning less collateral on close #152