Repository navigation
feat(revenue_pool): expire and protect pending emergency drain proposals (#1160) - #1382
Closed
lienhoatienphung-svg wants to merge 1 commit into
Closed
lienhoatienphung-svg wants to merge 1 commit into
lienhoatienphung-svg wants to merge 1 commit into
Conversation
lienhoatienphung-svg
force-pushed
the
feature/1160-emergency-drain-expiry
branch
from
October 16, 2026 07:47
b18f48a to
763e0c5
Compare
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 #1160
Summary
Protects pending emergency drain proposals from remaining executable indefinitely or being silently overwritten:
EMERGENCY_DRAIN_GRACE_PERIOD_SECONDS(24 hours) andexpires_at: u64toPendingEmergencyDrain.drain_replacedevent carrying(previous_drain, new_drain)wheneverpropose_emergency_drainreplaces an existing pending proposal without prior cancellation.expires_atwithRevenuePoolError::EmergencyDrainExpired(code 26), treats expired proposals as inactive inget_pending_emergency_drain, and providesexpire_emergency_drainto purge expired proposals from instance storage with anemergency_drain_expiredaudit event.Acceptance Criteria Mapping
propose_emergency_drainemitsdrain_replacedwith(previous, new)when overwriting an existing proposal (reproposal_emits_drain_replaced_event).execute_emergency_drainfails withRevenuePoolError::EmergencyDrainExpiredoncenow > drain.expires_at,get_pending_emergency_drainreturnsNone, andexpire_emergency_drainpurges the expired snapshot (execute_after_expiry_fails_and_clears_proposal).PendingEmergencyDrainexposes expiry:pub expires_at: u64is stored and returned byget_pending_emergency_drain.contracts/revenue_pool/src/test_emergency.rsand updatedtest_error_codes.rs/docs/ERROR_CODES.md.Validation
cargo test -p callora-revenue-pool emergencyPayout Wallet (Base Mainnet USDC / EVM):
0x3806cd592a508d1992Ed007C2F53de251C2E7452