Repository navigation
fix(pool): price admissions and reservations at the newest completed portfolio - #59
Merged
Merged
Conversation
…portfolio A superseded but still-fresh stage kept admitting deposits and reserving withdrawals at its older economics after a newer portfolio was verified. That moved part of a proven loss or reward between holders: in the 2026-10-20 review a withdrawer avoided 200 of a 520 QRL loss, and a newcomer captured 2,600 of income proven before its admission. Each admission or reservation batch now applies the newest completed portfolio first. The stage keeps its cutoff, FIFO order, batch bounds and phase; reserved claims, earned fees and pending refunds stay as they are. Repeated supersession cannot restart processing, and stale stages stay abortable. Tests on native bytecode: both review scenarios (the withdrawer receives 19,800; existing holders keep all income proven before the admission), freshness at ages 64 and 65, newer snapshots sharing an execution cutoff, renewal at the recovery deadline and recovery one slot later, and 65 admissions in bounded batches followed by FIFO withdrawals under repeated supersession. Gas: ordinary batches cost 5,571 more; a batch that refreshes costs about 75k to 94k more; pool runtime grows 278 bytes to 21,906.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A correctness review of the withdrawal window on 2026-10-20 found one High issue in the native design. A superseded but still-fresh pricing stage kept admitting deposits and reserving withdrawals at its older economics after a newer portfolio was verified. That moved part of a proven loss or reward between holders. Reproduced on native bytecode with synthetic states: a withdrawer avoided 200 of a 520 QRL loss, and a newcomer captured 2,600 of income proven before its admission. The native pool holds no public funds.
Fix. Each admission or reservation batch first applies the newest completed portfolio. The stage keeps its cutoff, FIFO order, batch bounds and phase. Reserved claims, earned fees and pending refunds stay as they are. Repeated supersession cannot restart processing, and stale stages stay abortable.
Tests (native bytecode):
Gas: ordinary batches cost 5,571 more. A batch that refreshes costs about 75k to 94k more. Pool runtime grows 278 bytes to 21,906. Batch limits stay at 32, and core ABIs are unchanged.
Gates:
npm ci,npm test(43 model tests, 32 tooling tests, Go runner and proof tests, 66,455 native VM steps),test:modelandtest:toolingall exit 0. The frontend is untouched. Docs: architecture, IMPLEMENTATION, REVIEW (the staging-race regression now follows the new rule), proofs README and CHECKPOINT-EXECUTION, testing README, DECISIONS.