Skip to content

A zero-share deposit refund can deadlock with its epoch's reconciliation #434

Open

Description

@luchobonatti

Description

fulfill commits floor(total_shares_redeeming × price) to committed. Each redeem claim pays floor(shares × price), so the claims can sum below the commitment. That cash dust leaves committed only in reconcile_if_settled, which waits for deposits_open == 0. A deposit claim that floors to zero shares is refunded behind refund_covered, which needs free_reserve >= amount. When the dust is the only free cash, the refund waits on reconciliation and reconciliation waits on the refund.

Steps to reproduce

  1. The vault holds 11 asset units, including Carol's deposit of 1.
  2. Alice and Bob each redeem 5 share units in the same epoch at a price of 1.1. Fulfil commits floor(10 × 1.1) = 11.
  3. Alice and Bob each claim floor(5 × 1.1) = 5.
  4. Carol's deposit floors to 0 shares. Her claim reverts with ClaimNotCovered.

Expected vs actual behavior

Expected: Carol gets her 1 unit back once both redemptions have settled.
Actual: The unit stays in committed and her claim keeps reverting.

Reproduction link

#359 (comment)

Environment

No response

Priority

No response

Additional context

Raised in #359. Suggested fix from the thread: release the cash remainder once every redemption in the epoch has settled, tracked separately so the final reconciliation does not release it twice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingepic:contractsRust: port the reference and close the code deltasfeedbackFixes from the Aha audit feedbackpriority: medium

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions