[REAL DoS] Reconcile foreign-expired source liens during resolved close - #152
Draft
aeyakovenko wants to merge 1 commit into
Conversation
This was referenced Jul 23, 2026
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.
What changed
ReleaseLien, detect an account-local counterparty lien whose shared backing bucket was already moved toImpairedby another account.Root cause and impact
Account A can create a legitimate source-credit initial-margin lien through ordinary trades while a shared backing bucket is Fresh. In Resolved mode, a lien-free account B can close first and expire that shared bucket, moving aggregate
valid_liened_backing_numtoimpaired_liened_backing_num. Account A still records its account-local counterparty lien as live.The old resolved phase selected
ReleaseLiensolely from A's nonzero account-local lien. It then tried to debit the aggregate live-lien counter, which was already zero, and returnedCounterUnderflow. SVM rollback restores the same state, so every boundedCloseResolvedretry fails. Resolved portfolios have no alternate trade, rebalance, withdraw, or auto-crank route, making this a persistent public terminal DoS.The exact parent regression fails at that point with
CounterUnderflow. The wrapper LiteSVM reproduction reaches the same state using four initialized portfolios, authenticated mark accrual, ordinary public trades, public resolution, and publicCloseResolvedcalls; three retries all fail with wrapper custom error0x19and byte-identical rollback.Scope and dependencies
Validation
68364eac72c47d73e07820608f08acb58e38b08f: new engine public-operation regression fails withCounterUnderflow.cargo test --all-targets --features fuzz: 171 passed.proof_v16_resolved_foreign_expiry_lien_impairment_is_exact_relabel: 245 checks passed, 3/3 covers satisfied.Wrapper public reproduction: aeyakovenko/percolator-prog#300