Repository navigation
fix(drive-abci)!: refuse an identity create from addresses with a failed key signature unpaid (PV14) - #4968
Conversation
…led key signature unpaid (PV14) The address witnesses of an IdentityCreateFromAddresses cannot sign the proofs of possession of the keys it registers: both sign the same bytes. A failed proof of possession was nonetheless charged to the inputs as a penalty. From protocol version 14 (advanced_structure v1) it is refused unpaid, like a failed witness; a key structure failure stays paid. check_tx now runs the advanced structure of this transition, so one whose key signatures fail is refused at admission at every protocol version. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
📖 Book Preview built successfully. Download the preview from the workflow artifacts. Updated at 2026-09-24T05:53:34.831Z |
|
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 (8)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughProtocol version 14 selects version 1 advanced-structure validation for identity creation from addresses. Invalid proof-of-possession signatures are refused without a penalty, and check_tx runs the validation for this transition at all protocol versions. ChangesIdentity creation validation
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant CheckTx
participant AdvancedStructureValidation
participant IdentityCreateFromAddressesV1
CheckTx->>AdvancedStructureValidation: validate transition
AdvancedStructureValidation->>IdentityCreateFromAddressesV1: validate structure and signatures
IdentityCreateFromAddressesV1-->>AdvancedStructureValidation: signature error or validation result
AdvancedStructureValidation-->>CheckTx: reject transition when signature validation fails
Suggested reviewers: Merge Risk: ⚪ Minimal · up to The protocol-version behavior and check_tx rejection have no identified merge-blocking issue; the change is ready for normal checks. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 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 — 4th in line, estimated start in ~1.0 h (commit 29d85be)
|
|
Agreed with this approach. |
Issue being fixed or feature implemented
Follow-up to #4961 and #4966.
An
IdentityCreateFromAddressesproves possession of each key it registers with a signature over the transition's signable bytes. The address witnesses sign the same bytes, so they cannot cover those key signatures. A failed proof of possession was nonetheless charged to the inputs (thevalidation_of_added_keys_proof_of_possession_failurepenalty plus the fee, with the input nonces bumped), although the owners of the inputs never signed the key signatures being judged. check_tx did not run the key checks at all, so such a transition could enter the mempool.What was done?
advanced_structurev1 forIdentityCreateFromAddresses, selected byDRIVE_ABCI_VALIDATION_VERSIONS_V10(protocol version 14). It is v0 except that a failed proof of possession returns the errors with no action, so the transition is refused unpaid, like one whose witnesses fail. A key structure failure (duplicate key ids and the like) is still a paid refusal with a nonce bump: those fields are signed by the witnesses. Protocol version 13 keeps v0.requires_advanced_structure_validation_with_state_on_check_txnow includesIdentityCreateFromAddresses, so check_tx transforms it and runs its advanced structure (key structure and proofs of possession) at admission. Admission is not consensus, so this applies at every protocol version.v14.rsand the validation pipeline chapter of the book describe the change.Example: a transition whose first key signature does not verify, from an input holding 1.1 Dash, at protocol version 14.
Before:
After:
At protocol version 13 the block result is unchanged (a paid refusal); only check_tx refuses the transition earlier.
How Has This Been Tested?
identity_create_from_addresses/tests.rs:should_refuse_an_invalid_key_signature_unpaid: at the latest version the block result is an unpaidSignatureError, and the input keeps its balance and nonce.should_refuse_an_invalid_key_signature_at_check_tx: check_tx refuses the transition at protocol versions 13 and latest. It fails if the transition is taken out ofrequires_advanced_structure_validation_with_state_on_check_tx.should_conserve_credits_when_a_key_signature_is_invalidnow runs at protocol version 13, where the paid refusal remains.should_charge_the_penalty_unscaled_by_the_user_fee_increaseuses the key structure failure, which is paid at every version.test_invalid_key_data_for_ecdsaandtest_invalid_key_data_for_blsfail on the key signature, so at the latest version they now expect an unpaid refusal.should_return_true_only_for_batch_and_identity_create_from_addressespins the check_tx list.cargo test -p drive-abci --lib -- identity_create_from_addresses advanced_structure_with_state: 212 passed.cargo test -p drive-abci --lib -- check_tx execution_event block_processing_end_events processor address_funding_from_asset_lock: 275 passed.cargo fmt --all -- --checkandcargo clippy -p drive-abci -p platform-version --testsare clean.Breaking Changes
From protocol version 14, an
IdentityCreateFromAddresseswhose key proof of possession fails is refused unpaid instead of charging its inputs the penalty and fee. Protocol version 13 and earlier are unchanged. The check_tx change affects mempool admission only.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 ·
29d85be/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.Summary by CodeRabbit