Skip to content

feat(platform)!: halve contested name fee in protocol 14 - #4634

Open
QuantumExplorer wants to merge 5 commits into
v4.2-devfrom
codex/dpns-contested-fee-v14
Open

feat(platform)!: halve contested name fee in protocol 14#4634
QuantumExplorer wants to merge 5 commits into
v4.2-devfrom
codex/dpns-contested-fee-v14

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Sep 8, 2026

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

Reduce the contested DPNS registration contribution from 0.2 DASH to 0.1 DASH when protocol 14 activates.

What was done?

  • Introduce FEE_VERSION3 and VOTE_RESOLUTION_FUND_FEES_VERSION2, selected by protocol 14, with a contested-document contribution of 10,000,000,000 credits. Protocols 1–13 retain 20,000,000,000 credits.
  • Preserve every other fee, including the 10,000,000-credit vote charge. The separate fee_version_number remains 1, as in FEE_VERSION2, because contest contributions use the active protocol configuration and historical storage rates are unchanged.
  • Add regression coverage for historical fees, exact-payment validation, and DPNS transition construction for contested and ordinary names.

This is the shared contested-document parameter, so the reduction also applies to contested indexes in other data contracts. Existing contest balances require no migration.

How Has This Been Tested?

Local Rust checks: 31 passed, 0 failed.

  • cargo test --locked --offline -p platform-version --lib: 18 passed. The new regression test failed before the fee change and passed afterward; it also verifies that every other fee matches protocol 13.
  • cargo test --locked --offline -p drive-abci --lib advanced_structure_v1::tests: 7 passed, including construction and exact-payment checks at protocols 13 and 14.
  • cargo test --locked --offline -p drive-abci --lib test_document_creation_on_contested_unique_index: 5 passed, exercising contested DPNS registration through the transaction pipeline.
  • cargo test --locked --offline -p drive-abci --lib test_protocol_change_v13_to_v14: the existing protocol-upgrade dispatcher regression passed.
  • cargo fmt --check --all and git diff --check passed.

Commands used isolated build directories. No live network upgrade rehearsal was performed.

Breaking Changes

After protocol 14 activates, contested registrations must supply exactly 0.1 DASH; the previous 0.2 DASH contribution is rejected by the existing exact-payment validation. Earlier protocols retain their existing behavior. Clients must construct transitions using the active protocol version.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • New Features

    • Updated protocol version 14 to require a 0.1 DASH fee for contested document votes.
    • Applied protocol-specific contested document fees when calculating prefunded voting balances.
  • Bug Fixes

    • Ensured contested document fees are validated against the applicable protocol version.
    • Ensured contested documents receive the correct prefunded voting balance, while non-contested documents do not.

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 73e2159a-8ae3-457a-97e4-2c03d26e8377

📥 Commits

Reviewing files that changed from the base of the PR and between ada25de and 4797b98.

📒 Files selected for processing (7)
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/batch/tests/document/deletion.rs
  • packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/masternode_vote/mod.rs
  • packages/rs-platform-version/src/version/fee/mod.rs
  • packages/rs-platform-version/src/version/fee/v3.rs
  • packages/rs-platform-version/src/version/fee/vote_resolution_fund_fees/mod.rs
  • packages/rs-platform-version/src/version/fee/vote_resolution_fund_fees/v2.rs
  • packages/rs-platform-version/src/version/v14.rs

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Protocol 14 now uses a 10,000,000,000-credit contested document fee. New fee-version constants define this value. Tests cover fee validation, transition construction, and vote balance calculations across protocol versions.

Changes

Contested document fee

Layer / File(s) Summary
Protocol 14 fee version
packages/rs-platform-version/src/version/fee/*, packages/rs-platform-version/src/version/v14.rs
Protocol 14 uses FEE_VERSION3 with a 10,000,000,000-credit contested document contribution. Earlier protocol versions retain 20,000,000,000 credits.
DPNS fee validation and transition construction
packages/rs-drive-abci/.../document_create_transition_action/advanced_structure_v1/mod.rs
Tests verify exact fee enforcement and protocol-specific prefunded voting balances for contested and non-contested labels.
Fee-derived vote balance assertions
packages/rs-drive-abci/.../masternode_vote/mod.rs, packages/rs-drive-abci/.../tests/document/deletion.rs
Masternode vote tests derive expected balances from configured contribution and vote costs. A document deletion test is reformatted without behavior changes.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 3a1ca

Protocol 14 correctly activates the 0.1 DASH contested contribution while earlier versions retain their historical fee. No actionable merge risk remains.

Suggested reviewers: thepastaclaw

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: reducing the contested name fee in protocol 14.
Docstring Coverage ✅ Passed Docstring coverage is 88.89% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 8 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/dpns-contested-fee-v14

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@thepastaclaw

thepastaclaw commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

🔍 Review in progress — actively reviewing now (commit 3a1cada) · triage: critical

@github-actions github-actions Bot added this to the v4.2.0 milestone Sep 8, 2026
@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.60870% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.79%. Comparing base (b84975e) to head (3a1cada).

Files with missing lines Patch % Lines
...ate_transition_action/advanced_structure_v1/mod.rs 78.94% 16 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           v4.2-dev    #4634      +/-   ##
============================================
- Coverage     87.88%   84.79%   -3.10%     
============================================
  Files          2766     2796      +30     
  Lines        360586   375662   +15076     
============================================
+ Hits         316904   318537    +1633     
- Misses        43682    57125   +13443     
Components Coverage Δ
dpp 84.47% <ø> (-4.62%) ⬇️
drive 84.65% <ø> (-1.94%) ⬇️
drive-abci 87.14% <82.60%> (-2.81%) ⬇️
sdk ∅ <ø> (∅)
dapi-client ∅ <ø> (∅)
platform-version ∅ <ø> (∅)
platform-value 92.92% <ø> (ø)
platform-wallet ∅ <ø> (∅)
drive-proof-verifier 41.44% <ø> (-8.34%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@QuantumExplorer QuantumExplorer left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final validation — Phase 2 only (queue backlog)

Verified the complete PR diff at head 5f4496f and confirmed the Phase-2 reviewers' conclusion: no actionable in-scope defects. The new fee snapshot halves the contested-document contribution only for protocol 14, preserves historical and unrelated fees, and remains consistent with transition construction, exact-payment validation, and contest-balance accounting. Independently reran all 31 targeted Rust tests successfully; git diff --check passed and the worktree remains unchanged.

Source: reviewer 1: gpt-6-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6-astra (agent: phase2-reviewer, role: rust-quality); reviewer 3: gpt-6-astra (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6-astra (agent: astra-verifier, role: final-verifier)

Review provenance

  • Triage: critical by gpt-6-astra (effort low) — The change alters consensus-sensitive, protocol-gated fee validation and prefunded contest balances across all contested indexes, so incorrect activation or historical fee preservation could cause transaction rejection, inconsistent state transitions, or misallocated funds.
  • Phase 1 reviewers: not run (skipped for throughput: 21 PRs queued, above the 10 limit)
  • Fresh verifier: gpt-6-astra — final-verifier; agent astra-verifier
  • Phase 2 reviewers: gpt-6-astra — general (completed, effort xhigh); agent phase2-reviewer, gpt-6-astra — rust-quality (completed, effort xhigh); agent phase2-reviewer, gpt-6-astra — security-auditor (completed, effort xhigh); agent phase2-reviewer

@shumkov

shumkov commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Tests not passing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants