feat: admin force-resolve market with idempotency-key replay protection#810
Open
muffti123 wants to merge 1 commit into
Open
feat: admin force-resolve market with idempotency-key replay protection#810muffti123 wants to merge 1 commit into
muffti123 wants to merge 1 commit into
Conversation
- Add admin_force_resolve function to forcibly resolve markets in any state - Implement idempotency-key replay protection per (admin, key) pair - Add new DataKey::ForceResolveIdempotencyKey for persistent key storage - Add ForceResolveReplayed error variant (517) - Emit ForceResolvedEvent on successful force-resolve - Add unit tests (force_resolve_tests.rs) and integration tests (tests/force_resolve_test.rs) - Add place_bet max_fee_bps parameter for fee cap enforcement - Add cancel_fee_update to FeeManager - Update OracleValidationConfig with max_deviation_z_multiple and history_size - Add AdminOverrideNonce DataKey for replay protection - Reorganize FeeManager::update_fee_config signature (remove eta parameter)
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.
Description
This PR adds an admin-only
force_resolve_marketentrypoint that allows an authorized primary admin to forcibly resolve a prediction market — regardless of its current state (Active, Ended, Disputed, etc.) — with full idempotency-key replay protection, mandatory reason enforcement, and a comprehensive audit trail.Key Features
force_resolve_market— new public entrypoint acceptingwinning_outcomes: Vec<String>,reason: String, andidempotency_key: StringForceResolveManager— each key is scoped per-market and permanently recorded after first use; duplicate keys are rejected withError::ForceResolveReplayed (517)ForceResolveReasonEmpty (518)guard before any state mutationForceResolvedEvent(topicfrc_rs), state-change event, andMarketForceResolvedaudit trail recordError Handling
ForceResolveReplayedForceResolveReasonEmptyInvalidInputEvents
ForceResolvedEventfrc_rsTesting
Comprehensive unit tests covering:
Related Issues
Closes #179