Fix capacity exit liquidation - #786
Open
KillariDev wants to merge 28 commits into
Open
Conversation
…-exploit-round-4 # Conflicts: # augurScan/config/abis.json # augurScan/config/manifests/mainnet.json # augurScan/config/manifests/sepolia.json # augurScan/scripts/snapshot-project-metadata.ts # augurScan/tests/metadata.test.ts # docs/assets/js/docsSearchData.js # docs/mainnet-deployment-addresses.json # docs/reference/contracts.html # docs/sepolia-deployment-addresses.json # scripts/contract-reference-metadata.mts # scripts/deploy-testnet.mts # solidity/contracts/statoblast/EscalationGame.sol # solidity/contracts/statoblast/EscalationGameDepositDelegate.sol # solidity/contracts/statoblast/SecurityPool.sol # solidity/contracts/statoblast/SecurityPoolStorage.sol # solidity/ts/tests/auditFixedOutcomeBadDebtLiquidation.test.ts # solidity/ts/tests/auditLateVaultResidualCapture.test.ts # solidity/ts/tests/fixtures/escalationGameBytecode.snapshot.json # solidity/ts/tests/statoblast/escalationMigration.test.ts # ui/statoblast/ts/copy/securityPool.ts # ui/statoblast/ts/features/security-pools/components/SecurityVaultSection.tsx # ui/statoblast/ts/features/security-pools/lib/securityPoolState/engine.ts # ui/statoblast/ts/protocol/securityPools.ts # ui/statoblast/ts/tests/features/markets/tradingSection.test.tsx # ui/statoblast/ts/tests/features/security-pools/liquidationModal.test.tsx # ui/statoblast/ts/tests/features/security-pools/securityPoolState.engine.test.ts # ui/statoblast/ts/tests/features/security-pools/securityPoolsOverviewSection.test.tsx # ui/statoblast/ts/tests/features/security-pools/securityPoolsSection.test.ts # ui/statoblast/ts/tests/features/security-pools/securityVaultSection.test.tsx # ui/statoblast/ts/tests/features/security-pools/useSecurityPoolsOverview.test.ts # ui/statoblast/ts/tests/features/security-pools/workflow/builders.ts # ui/statoblast/ts/tests/features/security-pools/workflow/vaultControls.test.tsx # ui/statoblast/ts/tests/features/truth-auctions/forkAuctionChildPoolRecovery.test.tsx # ui/statoblast/ts/tests/features/truth-auctions/forkAuctionSection.test.tsx # ui/statoblast/ts/tests/features/truth-auctions/forkAuctionSettlementSummary.test.tsx # ui/statoblast/ts/tests/protocol/securityPools.test.ts # ui/zoltar/ts/protocol/deployment.ts # ui/zoltar/ts/protocol/reporting.ts # ui/zoltar/ts/tests/protocol/reporting.test.ts
…-exploit-round-4 # Conflicts: # augurScan/config/manifests/mainnet.json # augurScan/config/manifests/sepolia.json # docs/mainnet-deployment-addresses.json # docs/sepolia-deployment-addresses.json # ui/zoltar/ts/protocol/deployment.ts
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.
Summary
Attack and fix
Vault open interest is allocated from settlement collateral by each vault's share of total capacity ownership. Previously, a capacity provider could mint complete sets and then withdraw its capacity while collateral remained. Shrinking the denominator reassigned debt to an unchanged honest vault, made that vault liquidatable, and let the attacker recover the temporary complete-set ETH while keeping the victim's REP award.
The fix rejects any capacity-ownership decrease until settlement collateral reaches zero. Backing-only withdrawals remain available because they do not change the denominator, and capacity providers can exit after complete-set collateral is redeemed.
This is a stacked PR based on #782.
Validation
bun test solidity/ts/tests/auditCapacityExitLiquidation.test.ts solidity/ts/tests/auditTruthAuctionOwnershipOverflow.test.tsbun test solidity/ts/tests/statoblast/forkMigration.test.ts -t "fee accrual splits"bun test scripts/deployment-runtime-hashes.test.tsbun run ensure-contract-artifacts && bun run check:shared-dependencies && bun run test:run -- --bail=1— 3,282 pass, 16 network-dependent skips, 0 failbun run tscbun run format:checkbun run checkbun run knipbun run check:generated-cleangit diff --checkText, visual, and final code/security reviews completed with no remaining findings.