fix(tholos-v2): bound max_total_weight to max_position ratio at initialize (#168) - #178
Closed
s6pa1rta3n-lab wants to merge 1 commit into
Closed
fix(tholos-v2): bound max_total_weight to max_position ratio at initialize (#168)#178s6pa1rta3n-lab wants to merge 1 commit into
s6pa1rta3n-lab wants to merge 1 commit into
Conversation
Collaborator
|
@s6pa1rta3n-lab Closing. #168 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
Closes #168.
This change adds Sybil resistance bounding to
TholosV2::initializeby constrainingmax_total_weightrelative tomax_position:MAX_TOTAL_WEIGHT_TO_POSITION_RATIO = 10.max_total_weight <= max_position.checked_mul(MAX_TOTAL_WEIGHT_TO_POSITION_RATIO).unwrap_or(i128::MAX).Error::InvalidWeightRatio = 37returned when the ratio bound is violated.contracts/tholos-v2/src/test.rsvalidating thatinitializerejects configurations exceeding the ratio bound and accepts configurations at the exact ratio boundary.test_register_exceeds_max_position_failsparameterization to satisfy the ratio constraint while verifyingPositionExceedsMax.docs/src/CONTRACT_V2.mdwith the new error variant, updated policy parameter descriptions, and an explicit analysis of Sybil resistance mechanics and residual plutocratic risk.Economic and Sybil Analysis
In Tholos v2,
max_positioncaps individual voter stake whilemax_total_weightcaps total bonded stakeW. Without a ratio constraint, an attacker with large capital can split into many positions of sizemax_positionand dominate total voting weight cheaply ifmax_total_weightis set arbitrarily large relative tomax_position. Capping the ratio to 10 limits the round to at most 10 maximum-sized positions, forcing any single Sybil attacker seeking a strict majority (>50% ofW) to split and coordinate across at least 6 separate maximum-stake accounts. As documented, linear stake-weighting without external identity verification cannot eliminate plutocratic control by a >50% coalition; this ratio bound establishes a concrete capital-fragmentation lower bound while preserving operational flexibility.Issue Stipulations & Compliance Checklist
max_total_weightas a function ofmax_positionduring contract initialization.InvalidWeightRatio(variant 37).InvalidWeightRatiowhenmax_total_weight > max_position * 10.max_total_weight == max_position * 10.InvalidWeightRatioindocs/src/CONTRACT_V2.md.docs/src/CONTRACT_V2.md.Test plan
cargo fmt --checkpasses cleanly.shellcheck -x scripts/*.sh scripts/lib/*.shpasses cleanly.cargo clippy --workspace --all-targets -- -D warningspasses with zero warnings.cargo test --workspacepasses (all 109 tests intholos-v2, 69 intholos).cargo build --workspace --lib --target wasm32v1-none --release --lockedbuilds successfully.docs/src/CONTRACT_V2.mdupdated with public error specification and ratio constraints.Payout Routing
0xF46C9F6d70C50BF81ef3588AB523a90a594a2F89GCL6OXAMLD75BMTINA6EMRUDWK5THQUSHMYNLSNBCJAPZJHNYJTUNIBC