Repository navigation
feat(contracts): Timelock Governance Multi-Stage Veto and Emergency Circuit Breakers - #322
Closed
huangji6693-max wants to merge 1 commit into
Conversation
…ker, and pause unwinding (LynxXProtocol#311)
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
4 tasks
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 #311
Summary
Adds multi-signature guardian veto & proposal storage purge (
veto_and_purge), a 30-day rolling epoch circuit breaker rate limiter (MAX_UPGRADES_PER_EPOCH = 1perCIRCUIT_BREAKER_EPOCH_SECONDS), and an emergency pause (emergency_pause) with time-decayed post-pause recovery (UNWIND_RECOVERY_WINDOW_SECONDS) tocontracts/timelock.Key Changes
contracts/timelock/src/lib.rs):configure_guardians(guardians, threshold)registers a multi-sig guardian council with strict duplicate/quorum validation (GovernanceError::InvalidGuardianSet).veto_and_purge(signers, id)verifies guardian multi-sig quorum (GovernanceError::InsufficientGuardianQuorum) without administrative keys, cancels malicious queued proposals prior to ETA execution, removes the proposal payload from persistent storage, and writes an immutable tombstone (SecurityKey::PurgedProposal(id)/is_purged).contracts/timelock/src/lib.rs):MAX_UPGRADES_PER_EPOCH = 1contract upgrade / state migration perCIRCUIT_BREAKER_EPOCH_SECONDS(30-day window), rejecting additional upgrades in the same epoch withGovernanceError::CircuitBreakerTrippedand automatically resetting when the next 30-day epoch begins.contracts/timelock/src/lib.rs):emergency_pause(signers)allows the guardian multi-sig to immediately halt contract dispatch without admin keys forMAX_PAUSE_DURATION_SECONDS(14 days).unpause(), the contract automatically enters a 7-day (UNWIND_RECOVERY_WINDOW_SECONDS) time-decayed recovery phase whereget_recovery_surcharge()decays linearly from7 daysto0, preventing perpetual governance deadlocks while extending pre-queued proposal expiries across the freeze.contracts/timelock/src/test.rs,docs/upgradeability.md):cargo test -p timelock --features wasm-tests),cargo clippy --all-targets -- -D warningsclean,cargo fmt --checkclean, andnode scripts/ci/check-numeric-ids.mjsverified.