Skip to content

Scenario 3 close depends on FlowALP dust workaround (fails without PR #163 behavior) #179

@liobrasil

Description

@liobrasil

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.cdc

Result: 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:99
  • FlowALPv1 withdrawAndPull(...) -> 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:

  1. close logic fully zeroes/reconciles residuals before final assertion, or
  2. protocol-level dust handling is explicitly defined and stable across refs.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions