Repository navigation
refactor(drive): create once-per-identity claim trees in insert_contract v2 - #5056
Merged
Merged
Conversation
…act v2 #4827 added the once-per-identity claims subtree to the token loop of insert_contract_operations_v1, which protocol versions 9-13 select. It is dead there (those versions refuse once-per-identity rules) and live at protocol version 14 only because insert_contract v2 composes v1, so new protocol version 14 behaviour sat inside a shipped generation. Move it to insert_contract_operations_v2, as #4834 already did for update_contract. The same trees are queued at protocol version 14; v1 is back to what shipped apart from the element-builder extraction v2 shares. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Warning Review limit reachedNext included review available in 15 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 (2)
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 |
Collaborator
|
🔍 Review in progress — actively reviewing now (commit dbd622c) · triage: low |
QuantumExplorer
commented
Sep 27, 2026
QuantumExplorer
left a comment
Member
Author
There was a problem hiding this comment.
/self-reviewed
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.
Basic explanation
What this does: when a data contract with tokens is registered, the node creates some storage "folders" for each token. Protocol version 14 added a new kind of token distribution ("once per identity") that needs one more folder. That folder was added inside version 1 of the contract-insert code, which is the version the live network (protocol versions 9 to 13) already runs. Version 2, used by protocol version 14, reached it only by calling version 1. This PR moves the new folder into version 2, where new protocol version 14 behaviour belongs, and leaves version 1 as it shipped.
Value: code that already ran on the network stays as it shipped, which is what keeps a node that syncs from scratch in agreement with everyone else. The contract update path was already fixed the same way in #4834; this finishes the job for inserts.
Risks: Low. Protocol versions 9-13 cannot reach the moved code (they refuse once-per-identity rules before anything is stored), and protocol version 14 queues exactly the same storage operations, just from version 2.
Issue being fixed or feature implemented
book/src/contributing/coding-conventions.md: new behaviour belongs in a new generation selected only by the unreleased protocol version's tables.insert_contract_operations_v1(protocol versions 9-13) gainedadd_once_per_identity_distributionin #4827. It is inert there, sincevalidate_once_per_identity_distributionisNoneat those versions and create/update basic structure v0 refuse V1 distribution rules unpaid, but protocol version 14 capability lived in a shipped generation and the argument sat in another crate with no comment. #4834 moved the parallel edit ofupdate_contract_operations_v1into a new v2; the insert side was left behind.What was done?
insert_contract/v1: removed the once-per-identity branch and its import.insert_contract/v2:insert_contract_operations_v2now adds the claims subtree for every token whose distribution rules carry a once-per-identity distribution, after the generation 1 operations and before the moderation trees.Before / after (same outcome):
In-place changes to shipped generations
insert_contractv1, selected by protocol versions 9-13: the once-per-identity branch is removed. It was unreachable there because those versions refuse once-per-identity distribution rules before the insert runs, so removing it cannot change any outcome at those versions. The rest of v1 differs from v4.1.0 only by the output-identicalcontract_element_for_insert_v1extraction from feat(platform)!: once-per-identity token distribution #4827.How Has This Been Tested?
cargo test -p drive --lib insert_contract(223 passed)cargo test -p drive-abci --lib once_per_identity(11 passed, including registration and claims through state transitions andtest_transition_to_version_14_adds_once_per_identity_distributions)cargo clippy -p drive --all-features --all-targets -- -D warningsBreaking 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 ·
dbd622c/skip-botsproceeds without the ones not yet reportedWhen every box is checked the
PR Hygienecheck passes and this can merge.