Skip to content

Pay redemptions in FIFO order by cumulative position #73

Description

@hpmaxi

Priority

High — must be addressed in current sprint

User story / Problem statement

fulfill_epoch refuses unless the vault covers the epoch's redemptions in full, so one large
redeemer blocks every small one in the same epoch, and an epoch stays unpriced until enough capital
has come back. The design pays claims as cash arrives, in order, without walking a queue.

Expected outcome

An epoch prices whether or not the cash is there. Claims pay in order of cumulative position as the
reserve covers them.

Acceptance criteria

  • Fulfilment fixes the price and records the liability without requiring full coverage.
  • A claim pays when the reserve covers everything ahead of it, and is refused otherwise with an
    error that says so.
  • A claim in a later epoch waits until earlier epochs are covered. A test asserts it.
  • Paying a later position never makes an earlier one unpayable. A test asserts it.
  • Within one epoch, a claim is refused once the epoch's own share of cash is exhausted, so no
    payment is attempted against money that is not there.
  • No entrypoint iterates over requests or epochs.

Technical notes

The ordering is by cumulative position, which needs a running total of liabilities struck and a
running total paid. The test that matters is an epoch that strikes more than the vault holds: the
first claimant is paid, the second waits, and the vault does not attempt a transfer it cannot make.

Depends on #72, which is what makes committed liabilities legible.

Refs: ARCHITECTURE §4.3 · invariants: I11, I12, I13

Activity

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions