Repository navigation
refactor(dpp): restore shipped registration_cost v1 index parsing - #5055
Conversation
registration_cost v1 is selected by protocol versions 2-13. #4266 made it read the ranked and timeRange index admissions from the table's document_type_schema so that protocol version 14, which then selected v1, billed those indexes. #4827 moved protocol version 14 to v2, which carries the same logic, leaving a version check in v1 that is always false for the versions that select it (document_type_schema 0-2 admit nothing). Restore the file to what shipped in v4.1.0: Index::try_from parses with the same all-false admissions, so the cost is identical at every version that selects v1. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Warning Review limit reachedNext included review available in 21 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository: dashpay/platform/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
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 |
|
✅ Final review complete — no blockers (commit 126e566) · triage: low · Phase 2 only (queue backlog) |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 2 only (queue backlog)
Verified the complete diff at 126e566 and confirmed the Phase-2 reviewers' conclusion: the restored parser supplies identical all-false admissions for every protocol version selecting registration_cost v1, the file matches v4.1.0 byte-for-byte, and PV14's v2 implementation remains unchanged. The tables select v1 for PV9–13, not PV2–13 as the PR description states; this does not affect the behavior-preservation argument. No in-scope defects were found; git diff --check passed, and tests were not rerun during verification.
Review provenance
Source: reviewer 1: gpt-6-astra (agent: phase2-reviewer, role: general); reviewer 2: gpt-6-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6-astra (agent: phase2-reviewer, role: platform-versioning); final verifier: gpt-6-astra (agent: astra-verifier, role: final-verifier)
- Triage:
lowbygpt-6-astra(effort low) — The diff is a small, single-file restoration of registration_cost v1 index parsing whose correctness is straightforward to confirm by checking that all protocol versions selecting v1 use the same all-false admissions as Index::try_from. - Phase 1 reviewers: not run (skipped for throughput: 11 PRs queued, above the 10 limit)
- Fresh verifier:
gpt-6-astra— final-verifier; agentastra-verifier - Phase 2 reviewers:
gpt-6-astra— general (completed, effort medium); agentphase2-reviewer,gpt-6-astra— architecture-layering (completed, effort medium); agentphase2-reviewer,gpt-6-astra— platform-versioning (completed, effort medium); agentphase2-reviewer
|
Bots are done — your move: post |
Basic explanation
What this does: the fee for registering a data contract is computed by a versioned function. Version 1 of it is used by protocol versions 2 to 13 (already live). During 4.2 development a check was added inside version 1 that asks "which protocol version's index features are allowed?", to bill new kinds of indexes. Protocol version 14 has since moved to version 2 of the fee function, so inside version 1 that check now always answers "none of the new features", which is exactly what the old code did. This PR puts version 1 back to the code that shipped in v4.1.0, byte for byte.
Value: code that already ran on the network looks the way it shipped, and nobody reading version 1 is misled into thinking it can bill new index kinds. Our rules ask for this: a version check inside a shipped generation is the pattern the book warns against.
Risks: Very low. The fee is identical at every protocol version that uses version 1 (the removed check always produced "no new index features", which is what
Index::try_fromparses with). Version 2, used by protocol version 14, is untouched.Issue being fixed or feature implemented
book/src/versioning/versioned-dispatch.md: "Inside a generation, a capability is a constant fact, not a check", and a dead version check inside a shipped generation "misleads the next reader into thinking v1 can take that path".registration_costv1 had carriedIndexGrammarAdmissions::for_schema_generation(document_type_schema)since #4266, when protocol version 14 still selected v1. Since #4827, protocol version 14 selects v2, and every version that selects v1 hasdocument_type_schema0, 1 or 2, for which the mapping returns allfalse.What was done?
packages/rs-dpp/src/data_contract/methods/registration_cost/v1/mod.rsis restored to its v4.1.0 content: the index parse isIndex::try_from(index_value_map.as_slice())again, which callsIndex::try_from_value_mapwith all admissionsfalse.Before / after (unchanged outcome):
In-place changes to shipped generations
registration_costv1, selected by protocol versions 2-13 (contract version tables v2-v5,document_type_schema0, 0, 1, 2). The edit replacesfor_schema_generation(document_type_schema)with the all-falseadmissionsIndex::try_fromuses; the mapping returns allfalsefor every generation below 3, so the parsed index, and the cost, are identical at every version that selects v1. The file is now byte-identical to v4.1.0.How Has This Been Tested?
cargo test -p dpp --lib registration_cost,cargo clippy -p dpp --all-features --all-targets -- -D warnings.git diff v4.1.0 -- packages/rs-dpp/src/data_contract/methods/registration_cost/v1/mod.rsis empty.Breaking Changes
None.
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 ·
126e566/self-reviewedWhen every box is checked the
PR Hygienecheck passes and this can merge.