Repository navigation
feat(platform)!: a contender's fund doubles for every 50 contenders a contest holds past 250 (PV14) - #5034
Conversation
…s a contest holds (PV14) Joining a contest now costs the contest's fund doubled for every 100 contenders it already holds: 0.1 DASH for the first 100 DPNS contenders, 0.2 for the next 100, up to 51.2 for the 901st to the 1,000th. Filling a contest to its 1,000 cap costs 10,230 DASH instead of 100. The contender states the fund it pays in its prefunded voting balance, as before. Create state validation 2 counts the contest's contenders (the read #5029 added for the cap) and refuses, paid, a stated fund below the price (DocumentContestNotPaidForError, carrying the price). Create structure validation 1 accepts a stated fund of at least the contest's fund instead of exactly it. Everything stated goes to the contest's fund. The step, 100, is contested_document_contenders_per_fund_doubling in FEE_VERSION3; earlier schedules carry 0, which never doubles. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
📖 Book Preview built successfully. Download the preview from the workflow artifacts. Updated at 2026-09-27T05:36:40.270Z |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: dashpay/platform/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (11)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughProtocol version 14 scales the required contested-document fund with the number of existing contenders. Document-creation validation checks the amount paid, accepts overpayment, and reports underpayment. Fee configuration, tests, and documentation are updated for the new rule and the unchanged pre-version-14 behavior. ChangesContested-document funding
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant DocumentCreateTransitionValidation
participant required_vote_resolution_fund_to_join
participant VoteResolutionFundFees
DocumentCreateTransitionValidation->>required_vote_resolution_fund_to_join: provide contest details and contender count
required_vote_resolution_fund_to_join->>VoteResolutionFundFees: read fund-doubling interval
VoteResolutionFundFees-->>required_vote_resolution_fund_to_join: return configured interval
required_vote_resolution_fund_to_join-->>DocumentCreateTransitionValidation: return required fund
DocumentCreateTransitionValidation->>DocumentCreateTransitionValidation: compare paid amount with required fund
Note over DocumentCreateTransitionValidation: If underfunded, return DocumentContestNotPaidForError
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The checked compatibility paths preserve older contest counting and payment rules. No identified issue blocks merging after normal checks. Security Architecture ReviewSecurity architecture risk: 🟡 Moderate · up to The higher price makes filling a contest more expensive, but multiple joins submitted together may be charged using the same earlier contender count. That could weaken the protection against filling a contest to exclude others. The extent of this path and its transaction limits remain unverified. Retained concerns
Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 69.23% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 26 functions across 10 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
🕓 Queued for automated review — 2nd in line, estimated start in ~25 min (commit 1d09319)
|
…ouble it every 50 The first 250 contenders of a contest pay its fund; from then on the fund doubles for every 50 more: 0.2 DASH for the 251st to the 300th DPNS contender, 102.4 DASH from the 701st, 3,276.8 DASH for the 951st to the 1,000th. Filling a contest to its cap costs 327,695 DASH, so in practice a contest stops growing long before it. The fee schedule gains contested_document_contenders_before_fund_doubling (250 in FEE_VERSION3, 0 before) beside contested_document_contenders_per_fund_doubling (now 50). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Basic explanation
What this does: A contest (for example two or more people registering the same DPNS name) now charges more to join once many people have joined it. The first 250 contenders pay the normal contest fund (0.1 DASH for DPNS). From the 251st on, the fund doubles for every 50 contenders: 0.2 DASH for contenders 251 to 300, 0.4 for 301 to 350, 102.4 from the 701st, and 3,276.8 DASH for contenders 951 to 1,000 (the cap from #5029).
Value: Filling a contest to its 1,000 cap, so that nobody else can join it, now costs 327,695 DASH instead of 100 DASH; in practice a contest stops growing somewhere around 700 to 800 contenders. A normal contest with a handful of contenders pays exactly what it paid before.
Risks: Medium, consensus: this is a new protocol 14 rule. Wallets and SDKs still state the base fund, so they are refused when they try to join a contest that already holds 250 or more contenders, until they state the doubled fund; the refusal carries the fund needed. Contests that large are unusual. Contenders may also now state more than the fund (the extra goes to the contest's fund). No change before protocol 14.
Issue being fixed or feature implemented
#5029 capped a contest at 1,000 contenders. With a flat 0.1 DASH fund, anyone who wants a contested value can create 1,000 contenders for 100 DASH and lock everyone else out of the contest. The price of joining should rise steeply as a contest fills, so that filling one is not a practical strategy.
What was done?
Price (
rs-platform-version,rs-dpp)VoteResolutionFundFees:contested_document_contenders_before_fund_doubling(250) andcontested_document_contenders_per_fund_doubling(50) inVOTE_RESOLUTION_FUND_FEES_VERSION2(FEE_VERSION3, protocol 14); both 0 ("never doubles") inVERSION1and in the conversion from pre-4.2 platform states.required_vote_resolution_fund_to_join(contract_id, document_type_name, contenders, platform_version)(andContestedDocumentResourceVotePoll::required_vote_resolution_fund_to_join): the contest's fund (required_vote_resolution_fund, so the 0.5 DASH moderation election fund doubles the same way) while the contest holds fewer than 250 contenders, andfund * 2^(1 + (contenders - 250) / 50)from then on, saturating instead of overflowing. Doubling is exact in whole credits.Validation (
rs-drive-abci)DocumentContestNotPaidForError(expected = the price, paid = what was stated).Before / after (protocol 14, DPNS):
DocumentContestNotPaidForErrorDocs:
book/src/data-model/contested-documents.md(price table), PV14 changelog note 51 inv14.rs, comments inDRIVE_ABCI_VALIDATION_VERSIONS_V10.In-place changes to shipped generations
VOTE_RESOLUTION_FUND_FEES_VERSION1gains the two new fields set to 0. Only document create state validation 2 reads them, and that is selected by protocol 14 alone. Platform states store only a fee version number, and the frozenVoteResolutionFundFeesFieldsBeforeVersion4is untouched, so no stored format changes.DRIVE_ABCI_VALIDATION_VERSIONS_V10(protocol 14, unreleased).How Has This Been Tested?
rs-dppcontested_document_resource_vote_poll::fund_to_join_tests: the price at 0, 249, 250, 299, 300, 699, 700, 950 and 999 contenders, a 327,695 DASH fill, the moderation election fund (16,384 DASH for the last contender), saturation; the_protocol_version_13twin shows no doubling.rs-drive-abcicreation_tests:should_double_the_fund_a_contender_pays_once_a_contest_holds_250_contenders: at 250 contenders, 0.1 DASH is refused (paid, expected 0.2) and the fund is untouched; 0.2 DASH joins and the contest's fund grows by exactly 0.2 DASH. Its_protocol_version_13twin accepts the flat fund.should_put_everything_a_contender_pays_into_the_contest_fund: 0.15 DASH stated, 0.15 DASH lands in the fund.should_refuse_a_contender_past_the_most_a_contest_accepts(from fix(drive-abci)!: cap a contest at 1,000 contenders and tally every one (PV14) #5029): the 1,000th contender now pays 32,768 times the fund; the 1,001st is still refused by the cap.advanced_structure_v1tests: "at least" at protocol 14, "exactly" at 13, for DPNS and moderation elections.cargo test -p platform-version --lib, and the drive-abci creation, voting, masternode vote, owner balance proof and action fee groups: 230 passed.cargo clippy -p platform-version -p dpp -p drive-abci --all-targets -- -D warningsclean.Breaking Changes
Consensus change at protocol 14: joining a contest that holds 250 or more contenders requires a larger prefunded voting balance, and a prefunded voting balance above the contest's fund is now accepted. SDKs build contested creates with the base fund (
DocumentCreateTransition::from_document), so they need to state the doubled fund to join such a contest (follow-up).Checklist:
structure.rs, regeneratedgrovedb-structure.json, and checked the structure viewer link posted on this pull requestFor repository code-owners and collaborators only
🤖 Generated with Claude Code
PR Hygiene ·
1d09319/skip-botsproceeds without the ones not yet reported/self-reviewedonce the bots are doneWhen every box is checked the
PR Hygienecheck passes and this can merge.