Fix #167: Implement reveal quorum threshold for protocol v2 resolution - #177
Closed
s6pa1rta3n-lab wants to merge 1 commit into
Closed
Fix #167: Implement reveal quorum threshold for protocol v2 resolution#177s6pa1rta3n-lab wants to merge 1 commit into
s6pa1rta3n-lab wants to merge 1 commit into
Conversation
…rydocs#167) - Add reveal_quorum_bps to PolicySnapshotV2 and enforce upper bound of 10,000 bps - Enforce reveal quorum in close_reveal_if_ready on deadline timeout - Add InvalidRevealQuorum and RevealQuorumNotMet error variants - Add comprehensive unit tests, property tests, and snapshot tests - Document withheld-reveal manipulation analysis and quorum sizing in V2_BOND_SIZING.md, CONTRACT_V2.md, and V2_RESOLUTION.md
Collaborator
|
@s6pa1rta3n-lab Closing. #167 has no assignee. Comment on the issue and wait to be assigned before opening a PR. |
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.
Summary
Resolves #167 by introducing a configurable reveal quorum threshold (
reveal_quorum_bps) to protocol v2 resolution. This prevents malicious asserters from manipulating outcomes via silent, unrevealed positions that inflate eligible weight W to block honest strict majorities while exploiting the optimistic timeout fallback.Changes
contracts/tholos-v2/src/lib.rs):pub reveal_quorum_bps: u32toPolicySnapshotV2.MAX_REVEAL_QUORUM_BPS: u32 = 10_000.InvalidRevealQuorum = 37andRevealQuorumNotMet = 38toenum Error.initializeto validatereveal_quorum_bps <= MAX_REVEAL_QUORUM_BPSand store it inPolicySnapshotV2.close_reveal_if_readyto enforcerevealed.saturating_mul(10_000) >= eligible.saturating_mul(quorum_bps)on deadline timeouts when neither side reaches strict majority. If quorum is not met, returnsErr(Error::RevealQuorumNotMet).StrictMajorityFor/StrictMajorityAgainst) regardless of reveal quorum.contracts/tholos-v2/src/test.rs):DEFAULT_REVEAL_QUORUM_BPS = 5_000(50%).test_initialize_rejects_reveal_quorum_over_max,test_initialize_accepts_reveal_quorum_at_max,test_initialize_accepts_reveal_quorum_at_zero.test_optimistic_timeout_fails_when_reveal_quorum_not_metverifying rejection withRevealQuorumNotMetwhen revealed turnout is below quorum.test_admin_cancel_recovers_funds_when_quorum_deadlockedverifying round cancellation and full principal refunds when quorum is deadlocked.test_strict_majority_resolves_even_if_below_reveal_quorumverifying strict majority resolves even if turnout is below quorum.test_zero_reveal_quorum_permits_optimistic_timeout_with_low_revealsverifying thatreveal_quorum_bps == 0preserves permissive timeout resolution.prop_reveal_quorum_boundaryexercising random quorums and position sizes across the quorum threshold.docs/src/V2_BOND_SIZING.mdwith mathematical analysis, proofs, and parameter selection guidance.reveal_quorum_bps,InvalidRevealQuorum, andRevealQuorumNotMetindocs/src/CONTRACT_V2.md.docs/src/V2_RESOLUTION.md.Verification
cargo test -p tholos-v2: 115 tests passed (including proptests).cargo test --workspace: all tests passed across all crates.cargo clippy --workspace --all-targets -- -D warnings: zero warnings.cargo fmt --check: formatting clean.cargo build -p tholos-v2 --target wasm32v1-none --release: compiled WASM cleanly.cargo build -p tholos --target wasm32v1-none --release: compiled WASM cleanly.Payout Routing
0xF46C9F6d70C50BF81ef3588AB523a90a594a2F89GCL6OXAMLD75BMTINA6EMRUDWK5THQUSHMYNLSNBCJAPZJHNYJTUNIBC