Sovryn Perimeter Delay: Zero - #11
Draft
tjcloa wants to merge 1 commit into
Draft
Conversation
Phase 2 of the Sovryn security perimeter: a voluntary borrower collateral exit that already pays the Perimeter Fee can additionally be held in the ExitDelayQueue for a governance-configured delay, so a detected theft can be frozen or blacklisted and routed to recovery before the funds leave. This change carries the Zero half. - delay hooks on the voluntary collateral-out paths (withdrawColl, the collateral-decreasing adjustTrove, and closeTrove), sharing the surface the fee already uses. The fee leg is paid immediately and only the NET is escrowed, and a single delay quote taken once per exit governs the whole exit — including the full-gross path taken when the fee leg fails, so a fee-vault fault cannot route around the delay; - ActivePool pushes the native RBTC to the queue and the record follows in the same transaction, so a record failure rolls the push back and the exit reverts as a whole rather than leaving value stranded; - fail-open POINTER, fail-closed QUOTE: an unset queue or controller pointer leaves exits paying direct, while a controller that answers incorrectly reverts the exit rather than silently disabling the perimeter. The queue's custom-error selectors propagate unchanged so the off-chain halt watcher can key on them; - BorrowerOperations gains the owner-gated setter for the queue pointer; the pointer lives in an unstructured slot, so neither hook adds state to any upgradeable proxy (asserted by the storage-layout zero-diff guard, whose baseline now covers the delay hooks as well). Redemptions, liquidations and Stability Pool operations stay untouched, as does the surplus claim, which remains exempt from the delay and keeps a pinning test to prove it. The delay ships disabled and is enabled only by governance after post-deployment verification.
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.
Phase 2 of the Sovryn security perimeter — the Zero half.
A voluntary borrower collateral exit that already pays the Perimeter Fee can additionally be held in the
ExitDelayQueuefor a governance-configured period, so a detected theft can be frozen or blacklisted and routed to recovery before the funds leave.What this carries
withdrawColl, the collateral-decreasingadjustTrove, andcloseTrove— sharing the surface the fee already uses. The fee leg is paid immediately and only the net is escrowed, and a single delay quote taken once per exit governs the whole exit, including the full-gross path taken when the fee leg fails.ActivePoolpushes the native RBTC to the queue and the record follows in the same transaction, so a record failure rolls the push back and the exit reverts as a whole rather than leaving value stranded.BorrowerOperationsgains the owner-gated setter for the queue pointer. The pointer lives in an unstructured slot, so neither hook adds state to any upgradeable proxy — asserted by the storage-layout zero-diff guard, whose baseline now covers the delay hooks as well.Redemptions, liquidations and Stability Pool operations are untouched, as is the surplus claim, which remains exempt from the delay and keeps a pinning test to prove it. The delay ships disabled and is enabled only by governance after post-deployment verification.
Base branch
Opened against
sovryn-perimeter-feerather thandevelopmentso the diff is the delay delta alone. Re-target todevelopmentonce SIP-0094 is approved and executed.Not ready to merge — known blocker
Contract size (EIP-170).
BorrowerOperationsreaches 25,242 bytes with the delay hooks, against a 24,576-byte limit, so it cannot be deployed as it stands. The deployed Phase-1 implementation is 23,917 bytes, leaving 659 bytes of headroom that the hooks exceed. The candidate fix is theTroveManagerRedeemOpspattern — split the delay legs into a companion contract reached bydelegatecall.Also planned for this branch
The surplus claim is currently exempt from the delay. That is being reversed: surplus withdrawals will route into the vault like every other delayed exit. It needs a new
CollSurplusPoolfunction, because the deployedclaimCollWithFeesends the net straight to the claimant with no parameter to redirect it — so it carries a second pool implementation upgrade.Verification so far
BorrowerOperations,CollSurplusPoolandActivePool.