feat: enforce cool-off period before manual market unpause#1034
Merged
greatest0fallt1me merged 2 commits intoJul 26, 2026
Merged
Conversation
Adds a 1-hour minimum cool-off (MIN_UNPAUSE_COOLOFF_SECONDS) that must elapse after pause_market() before resume_market() can be called by an admin. Prevents rapid pause/unpause cycling. - New Error::CooloffActive (419) - checked_sub used for elapsed-time calculation (overflow-safe) - auto_resume_on_expiry() unaffected — cool-off only gates the manual admin resume path - Tests: cool-off enforcement, boundary condition, regression coverage for existing InvalidState/Unauthorized paths
|
@jabir-dev788 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Merged via direct push to master (admin) |
greatest0fallt1me
merged commit Jul 26, 2026
3c926ad
into
Predictify-org:master
0 of 2 checks passed
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 #841
Summary
Adds a minimum cool-off period that must elapse before a paused market
can be manually resumed via
MarketPauseManager::resume_market.Previously, an admin could pause and immediately unpause a market with
no delay, which weakens the safety guarantee of the pause mechanism
(e.g. as a defense against a compromised or misused admin key).
Changes
MIN_COOLOFF_SECONDSconstant toMarketPauseManagerresume_marketnow returnsError::InvalidStateif called beforepaused_at + MIN_COOLOFF_SECONDShas elapsedauto_resume_on_expiryis unaffected — it already waits for the fullpause_end_timeand is not subject to this new gatecool-off elapses, auto-resume regression, unauthorized resume regression
Out of scope (intentionally)
circuit_breaker.rs(separate, contract-wide pause system)MarketPauseManageris notcurrently wired into
lib.rs, and wiring it up is outside this issue's scopepause_market's duration validation or storage layoutTesting
cargo test -p predictify-hybrid— all existing tests pass, 4 new testsadded covering the cool-off behavior and regression paths.