Skip to content

feat(vault): reconcile an epoch once it settles - #252

Open
hpmaxi wants to merge 5 commits into
feat/request-allowlistfrom
feat/settlement-dust
Open

hpmaxi wants to merge 5 commits into
feat/request-allowlistfrom
feat/settlement-dust

Conversation

@hpmaxi

@hpmaxi hpmaxi commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Flooring the epoch total and then each claim left a remainder that was never reconciled. It is now. Each epoch records what pricing promised and what has been paid; when its last request settles, the remainder leaves pending_mint_shares and committed, stays in the reserve as fund money, and EpochReconciled says how much. Every subtraction from a running total is checked.

Changes

  • Per-epoch settlement record, view get_epoch_settlement, event EpochReconciled.
  • Checked subtraction everywhere a total goes down (AccountingMismatch, 6070).
  • Two tests pin why the wind-down remainder stays owed.
  • A test pins that an epoch with a request that can never settle stays open.

Deviations

  • The first plan gave wind-down owed "the same treatment on the last claim". That is not safe: a later round needs those units. The remainder stays (at most one unit per holder), and a test shows why.

Acceptance criteria

  • Each epoch records promised and settled shares and assets, and its open requests
  • The last settled request clears the remainder and emits EpochReconciled
  • An epoch with no requests reconciles when priced
  • Every subtraction from a running total is checked
  • A test shows the wind-down remainder stays bounded and is needed later

Test plan

Automated tests

  1. SOROBAN_SDK_BUILD_SYSTEM_SUPPORTS_SPEC_SHAKING_V2=1 nix develop -c cargo test --locked -p async-vault settlement wind_down
  2. The property test runs 24 random epochs, with the claims in a random order.

Manual verification

None.

Breaking changes

None for callers; a new view and a new event. This version must be deployed fresh, or reached by upgrade only when no request is open: the settlement record counts requests from the moment it exists, so upgrading a vault in place while a request is open would under-count its open epochs, reverting claims from epochs priced before the upgrade and risking an early reconcile of a mixed epoch.

Checklist

  • Self-reviewed my own diff
  • Tests added or updated
  • Docs updated (if applicable)
  • No unrelated changes bundled in

Screenshots

None.

@vercel

vercel Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
strata-vault-kit-app Ready Ready Preview Oct 17, 2026 5:10am UTC

Request Review

@hpmaxi
hpmaxi marked this pull request as ready for review October 17, 2026 05:16

This branch was successfully deployed

1 active deployment
Preview — 4721abe0 Deployed Oct 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant