Repository navigation
fix(contracts): remove vulnerable reclaim_after_settlement and add so… - #1758
Merged
1nonlypiece merged 2 commits intoOct 24, 2026
Merged
1nonlypiece merged 2 commits into
1nonlypiece merged 2 commits into
Conversation
…lvency invariant test
…icts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #1705
Summary of Changes
Vulnerability Fix (Approach A):
Removed reclaim_after_settlement from the contract. Under Soroban balance-delta accounting, there is no legitimate per-vault residual to sweep, and removing the endpoint completely eliminates the theft vector where draft or settled vaults could drain the contract's entire token balance.
Preserved Error::StakedRemaining = 22 in contracts/accountability_vault/src/lib.rs to ensure error discriminant numerical stability.
Spec Regeneration:
Removed the reclaim_after_settlement definition from contracts/accountability_vault/spec/AccountabilityVault.spec.json.
Tests Added:
test_reclaim_cannot_drain_other_vaults: Regression test asserting that an attacker creating a Draft vault cannot drain the contract balance or victim funds, and that invoking reclaim_after_settlement fails.
test_balance_covers_outstanding_stakes: Solvency invariant property test running randomized operations (create_vault, stake, check_in, claim_milestone, claim, slash_on_miss, withdraw) across vaults with a seeded PRNG, asserting after each step that contract_balance >= sum(staked).
Branch Isolation:
Work on the separate issue branch fix/dispute-milestone-guards-and-reset was preserved and left completely isolated.