Repository navigation
fix(platform)!: a BLS12_381 identity key's signature must verify (PV14) - #5295
Conversation
verify_identity_signed_signature now dispatches on a new state_transition_method_versions field. Generation 1, selected by protocol version 14 (STATE_TRANSITION_METHOD_VERSIONS_V2), refuses a BLS12_381 signature that does not verify with InvalidStateTransitionSignatureError, as for ECDSA keys. Generation 0 refused one only when the BLS module could not read the key or the signature, and protocol versions 1 to 13 replay through it unchanged. Identity-signature validation v0 passes the platform version to the check in place; every earlier table selects generation 0, the code it called before. wasm-dpp's verifySignature bindings check with the latest version. The unused private verify_by_raw_public_key is removed. PV14 note 76. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughIdentity-signed signature verification now selects an implementation by platform method version. Generation 1 rejects false BLS verification results; generation 0 retains the prior behavior. Validation and WASM callers now pass the platform version. ChangesIdentity signature verification
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant StateTransition
participant PlatformVersion
participant SignatureVerifierV1
participant SignatureVerdictV0
participant BlsModule
StateTransition->>PlatformVersion: Read configured verification method version
PlatformVersion-->>StateTransition: Return method version
StateTransition->>SignatureVerifierV1: Dispatch to generation 1 when configured
SignatureVerifierV1->>SignatureVerdictV0: Request signature verdict
SignatureVerdictV0->>BlsModule: Verify BLS signature
BlsModule-->>SignatureVerdictV0: Return boolean verdict
SignatureVerdictV0-->>SignatureVerifierV1: Return verdict
SignatureVerifierV1-->>StateTransition: Return invalid-signature error for false verdict
Suggested reviewers: Merge Risk: ⚪ Minimal · up to Protocol v14 rejects invalid BLS signatures while earlier versions retain replay behavior. No identified merge-blocking risk remains. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change strengthens BLS signature enforcement while preserving earlier protocol behavior for replay. The inspected rejection path stops before execution or charging the claimed identity. Remaining uncertainty concerns coordinated activation, historical client verification, and external API consumers. Retained concerns Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 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 |
|
Waiting for bot review — coderabbitai not yet · thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
🕓 Review not started yet because the new head is waiting for the 30-minute push debounce.
Commit cf2e5b5. Normal review starts when eligible; priority review starts as soon as a slot is available. |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
Verified the combined reviewer evidence against exact head d6ee2d9. The PV14 BLS verdict enforcement preserves historical behavior, with no blocking defects found; two non-blocking suggestions remain concerning generation layout and internal-error classification. This was a static review: the supplied CI snapshot reports successful Rust workspace, JS, Swift, and Kotlin checks, while PR Hygiene remains pending.
🟡 2 suggestion(s)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 8: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.1-sol(effort low) — The diff changes consensus-critical BLS signature acceptance in StateTransition::verify_identity_signed_signature, but the boolean-verdict fix and protocol-version dispatch are contained and straightforward rather than large or intricate. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity below 15% reserve: weekly 15% left, 5h 100% left),glm-5.3-flash(not used above high effort; tier asks max) - Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `packages/rs-dpp/src/state_transition/mod.rs`:
- [SUGGESTION] packages/rs-dpp/src/state_transition/mod.rs:2332-2338: Put signature-verification generations in dedicated version modules
The dispatcher and version tables correctly separate historical and PV14 behavior, but both new generation implementations remain inline in StateTransition's large module. The repository's coding conventions and Versioned Dispatch chapter explicitly require a method directory containing the dispatcher in mod.rs and implementations in v0/mod.rs and v1/mod.rs. Move this method into state_transition/verify_identity_signed_signature/ using that layout, preserving the existing table selections and cross-version tests. Separate generation modules make the historical implementation easier to audit and reduce accidental edits across generations; this is a maintainability issue, not an observed consensus failure.
In `packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_state_transition_identity_signed/v0/mod.rs`:
- [SUGGESTION] packages/rs-drive-abci/src/execution/validation/state_transition/common/validate_state_transition_identity_signed/v0/mod.rs:208-212: New UnknownVersionMismatch is swallowed into a signature error
The new DPP dispatcher returns ProtocolError::UnknownVersionMismatch for an unsupported signature-verification generation, but this caller passes that error to convert_to_consensus_signature_error. That helper propagates only ProtocolError::Error and converts an unknown generation through its catch-all into InvalidStateTransitionSignatureError, treating an internal configuration failure as an unpaid user signature failure. Propagate UnknownVersionMismatch from the converter instead. All current protocol tables select supported generations 0 or 1, so this does not affect normal PV1–14 execution and is not a blocking consensus defect; it corrects the error boundary introduced by the new dispatcher.
…ure-verification-fix-0bc520 # Conflicts: # packages/rs-platform-version/src/version/v14.rs
The dispatcher of verify_identity_signed_signature and its two generations
move into state_transition/verify_identity_signed_signature/{mod,v0,v1}.
v0 keeps the old checks as identity_signed_signature_verdict_v0, which v1
reuses before refusing a BLS12_381 signature that does not verify.
convert_to_consensus_signature_error, in place, returns
UnknownVersionMismatch as a node error instead of a signature error. Only
the new dispatcher could produce it there, and no protocol version's table
selects a generation it does not know, so the arm is inert at every version.
Imports only the moved code used are gated to the signing feature.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — coderabbitai ✓ · thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
At head 9e1473e, the complete PR diff correctly enforces BLS verification at PV14 while preserving PV1–13 behavior, existing authorization checks, and verification cost tracking; no in-scope defects were found. Both prior findings are fixed, and regression tests cover the protocol boundary and unknown-generation error propagation. Validation was static only: the supplied CI snapshot still showed Rust workspace tests, JS builds, and Kotlin build/tests in progress.
🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 8: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 9: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 10: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 11: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 12: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 13: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 14: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.1-sol(effort low) — The change to StateTransition::verify_identity_signed_signature affects consensus-critical signature acceptance, but the boolean-verdict fix and version dispatch are straightforward rather than large or intricate, with much of the diff comprising moved code and tests. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer,muse-spark-1.3-contributor— rust-quality (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity below 15% reserve: weekly 15% left, 5h 100% left),glm-5.3-flash(not used above high effort; tier asks max) - Fresh final gate: an independent Phase-2 review ran after iterative findings were reconciled
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.
No unresolved findings remain from the prior review on this head.
|
Bots are done — your move: post |
Generation 1 of verify_identity_signed_signature refused a false verdict
with "bls signature does not verify". Today only the BLS12_381 arm returns
false, but nothing enforces that, so the message now names the key's type
("BLS12_381 signature does not verify") instead of assuming it. The
refusal is unchanged; the test pins the message.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — coderabbitai ✓ · thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
Reviewed |
Basic explanation
What this does: Every identity-signed transition (a transfer, a withdrawal, a document batch, and so on) carries a signature made with one of the identity's keys. From protocol version 14, a transition signed with a BLS12_381 key is accepted only when the signature checks out against that key, the same rule ECDSA keys already follow. Earlier protocol versions keep their old rule, so nodes replaying old blocks reach the same result.
Value: BLS12_381 identity keys become safe to offer in wallets. The Kotlin example app already lists BLS12_381 on its add-key screen. A mainnet census found no identity holding a BLS12_381 AUTHENTICATION or TRANSFER key today, so no live identity depends on the old rule.
Risks: Low. It changes consensus, but only at protocol version 14, which is not live on mainnet; versions 1 to 13 run the old code through the version tables. A wallet whose BLS signer uses a scheme other than the
Basicscheme Platform verifies would now see its transitions refused at version 14. Every signer in this repository usesBasic.StateTransition::verify_identity_signed_signaturegains aplatform_versionparameter, so Rust callers outside this repository need a one-line change.Issue being fixed or feature implemented
StateTransition::verify_identity_signed_signaturerefused a BLS12_381 signature only when the BLS module returned an error (a key or signature it could not read). It did not refuse when the module answered that the signature does not verify. ECDSA keys were checked fully. The fix changes consensus, so it is gated on the protocol version.What was done?
rs-platform-version:DPPStateTransitionMethodVersionsgainsverify_identity_signed_signature: 0 inSTATE_TRANSITION_METHOD_VERSIONS_V1(protocol versions 1 to 13), 1 inSTATE_TRANSITION_METHOD_VERSIONS_V2(protocol version 14, unreleased). PV14 note 80 inv14.rs(76 and 77 landed on the base meanwhile, and two open PRs already claim 78).rs-dpp(state_transition/verify_identity_signed_signature/):verify_identity_signed_signaturetakes&PlatformVersionand dispatches frommod.rs:v0/mod.rsholds the old checks asidentity_signed_signature_verdict_v0, which returns whether the signature verifies; generation 0 drops that answer, as before;v1/mod.rsruns the same checks and refuses afalseanswer withInvalidStateTransitionSignatureError, the error a failed ECDSA signature gets (unpaid). The message names the key's type; today only the BLS12_381 arm answersfalse.verify_bls_signature_by_public_keyreturns the module'sboolinstead of discarding it.verify_by_raw_public_keyhad no callers and the same flaw, so it is removed.rs-drive-abci: identity-signature validation v0 passesplatform_versionto the check, andconvert_to_consensus_signature_errorpropagatesUnknownVersionMismatchas a node error instead of turning it into a signature error (see the next section).wasm-dpp: the fourverifySignaturebindings passPlatformVersion::latest(), so a client-side check refuses a BLS12_381 signature that does not verify (they already returnfalseforInvalidStateTransitionSignatureError).A credit transfer naming an identity's BLS12_381 TRANSFER key, whose signature does not verify against that key:
Before (and still at protocol versions 1 to 13):
After, at protocol version 14:
In-place changes to shipped generations
validate_state_transition_identity_signedv0 (rs-drive-abci/.../validate_state_transition_identity_signed/v0/mod.rs), selected by protocol versions 1 to 13 directly and by 14 through v1, which wraps it. The only edit passesplatform_versiontoverify_identity_signed_signature. At versions 1 to 13 the dpp tables select generation 0 of that check, which runs the same checks, in the same order, with the same errors, and drops the BLS answer exactly as the old body's.map(|_| ())did. Output is identical there. The new test runs a forged transfer at protocol version 13 and asserts it still executes.convert_to_consensus_signature_errorin the same module, used only there, gains an arm that returnsUnknownVersionMismatchas an error. Nothing reached that arm before this PR (the checks return only serialization errors, wrapped signature errors and their own refusals), and now only the new dispatcher's catch-all could, which no protocol version's table selects. Inert at every version.How Has This Been Tested?
rs-dpp:should_refuse_a_bls_signature_that_does_not_verify_from_protocol_version_14signs a credit transfer with a BLS12_381 TRANSFER key. It checks that the key's own signature verifies at 14 and at 13; a signature by another BLS key and 96 bytes that are not a curve point are refused at 14 and accepted at 13.rs-drive-abci:identity_credit_transfergainsshould_refuse_a_bls_signature_that_does_not_verify_from_protocol_version_14. Two identities with BLS12_381 TRANSFER keys; a transfer signed with the other identity's key, then one signed with the right key, processed throughprocess_raw_state_transitions: at 14 the first is refused unpaid withInvalidStateTransitionSignatureErrorand the second executes; at 13 both execute.convert_to_consensus_signature_error_tests::should_propagate_an_unknown_version_mismatch.STATE_TRANSITION_METHOD_VERSIONS_V2.verify_identity_signed_signatureset back to 0, both new tests fail.cargo test -p dpp --lib(5353 passed),cargo test -p platform-version,cargo test -p drive-abci --lib -- identity_credit_transfer::tests::(8 passed),cargo fmt --all -- --check.Breaking Changes
StateTransition::verify_identity_signed_signature(public_key, bls)becomesverify_identity_signed_signature(public_key, bls, platform_version).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 ·
cf2e5b5/skip-botsproceeds without the ones not yet reported/self-reviewedWhen every box is checked the
PR Hygienecheck passes and this can merge.Summary by CodeRabbit