Title: fix: reverse fees/referrals/deposits on cancelled-market refunds, fix guardian emergency-pause and removal voting#1228
Open
chidinma000 wants to merge 1 commit into
Open
Conversation
|
@chidinma000 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! 🚀 |
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.
Body (saved to /private/tmp/.../scratchpad/pr_body.md):
Summary
Fix #1189: bets::withdraw_refund (the only reachable refund path) now reverses the protocol fee, reverses/removes referral rewards, and refunds the creator's creation_deposit on a cancelled market. Removed the dead, unreachable duplicate in cancellation.rs and fixed the lib.rs entrypoint, which was missing the outcome argument.
Fix #1190: emergency_pause now accumulates guardian votes in persistent storage and only pauses once aggregate voting power crosses the 2/3 threshold, instead of checking a single caller's own voting power.
Fix #1191: pausing now goes through a new circuit_breaker::force_pause helper so CircuitBreakerState is written and TTL-managed consistently via instance storage, removing the mismatched persistent-storage extend_ttl call.
Fix #1194: PendingGuardianRemoval gained a votes_against list — a majority-against vote now formally kills a removal proposal — and proposals expire after 7 days (GUARDIAN_REMOVAL_VOTE_WINDOW) if unresolved.
Test plan
cd contracts/predict-iq && cargo test bets
cd contracts/predict-iq && cargo test governance
cd contracts/predict-iq && cargo clippy --all-targets --all-features -- -D warnings
cd contracts/predict-iq && cargo build --release
Note: repo has pre-existing compile errors unrelated to this diff (missing markets::get_outcome_stake/set_outcome_stake, ConfigKey::MinimumBetAmount, CANCEL_OUTCOME_INDEX, moved-value bugs elsewhere in governance), plus a toolchain/target mismatch in .cargo/config.toml. These block a clean build until fixed separately.
Closes #1189
closes #1190
closes #1191
closes #1194