Repository navigation
feat(platform)!: add a RedPallas signer key type with its own purpose (PV15) - #5736
QuantumExplorer wants to merge 40 commits into
Conversation
… (PV15) Identities can register one RedPallas key for Hecate sender leaves from protocol version 15: key type REDPALLAS_HECATE (5) with the new purpose HECATE_SIGNER (7), MEDIUM security level only. The 64-byte key data is ak || Poseidon(nk); registering it needs a RedPallas signature by ak over the transition's signable bytes. A transition may add at most one, and an identity update may not add one while another is enabled unless it disables that one (rotation). The key never signs transitions or documents. A transition carrying the key type or purpose is inactive before protocol version 15, so shipped validation generations never see it. New rules live in structure validation v2 and identity update state v2. Signature fee tables gain verify_signature_redpallas (50,000 credits in FEE_VERSION4); the pre-version-4 signature table is frozen so stored platform states still decode. New consensus errors: 10540, 10541, 20018, 40223. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueNote Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
🕓 Review not started yet because this PR is a draft.
Commit 2fa057b. 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
The new identity-update scan can run without funding its execution cost and caps its billed key count at 65,535, so changes are required. Additional suggestions address secret cleanup, compatibility vectors, maximum-size estimation, and contract-bounds regression coverage. This verification was static: current CI shows Kotlin build/tests passed, while Determine changed packages remains pending and broader Rust build/test coverage is not yet established.
🔴 1 blocking | 🟡 4 suggestion(s)
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: KEY_TYPE_MAX_SIZE_TYPE picks smallest, not largest
packages/rs-dpp/src/identity/identity_public_key/key_type.rs:70-80
Adding the 64-byte Hecate key extends the supported payload sizes, but the maximum-size selector still sorts descending and takes last(), selecting a 20-byte hash type. The reversed selector predates this PR, but the new larger key extends the same estimation gap: max_possible_size_key, used by Drive's disable/re-enable estimation paths, does not represent the largest supported payload. The existing test only checks the generated length against the selected type's own default_size(), so it cannot detect this. Make the PV15 estimator account for the new 64-byte maximum and assert that expected size explicitly, preserving earlier protocol behavior rather than changing the shared selector unconditionally.
source: muse-spark-1.3-contributor (phase1-reviewer: rust-quality)
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: tenderdash-consensus-security); reviewer 8: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 9: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — This intricate change directly modifies consensus validation in identity_update/state/v2/mod.rs and validate_identity_public_keys_structure/v2/mod.rs, and introduces cryptographic key validation and signature handling in redpallas_hecate.rs. - 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 quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— tenderdash-consensus-security (completed, effort xhigh); 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-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/state/v2/mod.rs`:
- [BLOCKING] packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/state/v2/mod.rs:203-217: Bound and fund the identity-wide key scan before executing it
This query reads and deserializes the identity's complete key history before checking whether the identity can pay for that work. The six-key limit applies per transition, not to accumulated identity keys, and disabled keys remain stored. The pinned GroveDB implementation treats this query's absent limits as unlimited.
Identity updates do not run state validation in check_tx, so admission's fee estimate omits the RetrieveIdentity operation added here. An owner can build a large key history, retain enough balance for admission's estimated update but not the additional history scan, and submit a valid signer-key addition. Block processing performs the scan, then fee validation rejects the update; paid_from_identity_function returns UnpaidConsensusExecutionError without applying the update or consuming its nonce. Fresh signed variants can therefore repeatedly impose history-proportional proposer work without a marginal fee. Separately, the conversion on line 215 caps accounting at 65,535 keys even when more were retrieved, so funded updates also stop paying for additional history.
Use a bounded current-signer lookup, or enforce a practical protocol-level work bound and check funding for the complete scan before performing it. Preserve the full accounting count; Drive's fetch_identity_keys_with_costs API is available if the underlying read should be propagated through PrecalculatedOperation. Add regression coverage for admission versus block execution with insufficient scan funds and for counts above u16::MAX. Merely truncating the query could miss an existing enabled signer.
In `packages/rs-dpp/src/identity/identity_public_key/redpallas_hecate.rs`:
- [SUGGESTION] packages/rs-dpp/src/identity/identity_public_key/redpallas_hecate.rs:59-64: Give owned Hecate secret material an explicit cleanup lifetime
This type owns the original secret, the signing scalar through ask, and the secret tag key nk, but has no explicit zeroization or clearing destructor. The pinned reddsa SigningKey is Copy and has no clearing Drop, so dropping this wrapper does not guarantee erasure of those values. This also affects temporary instances created for signing and private-key matching. Store the owned secret bytes in Zeroizing and use a clearable representation or supported cleanup mechanism for the derived secrets; wrapping the upstream SigningKey directly is not sufficient without Zeroize support. Audit the expansion buffers and signing-seed temporaries as part of the same cleanup.
- [SUGGESTION] packages/rs-dpp/src/identity/identity_public_key/redpallas_hecate.rs:216-220: Pin Hecate derivation with known-answer vectors
These assertions compare the derivation implementation with another invocation of itself. The neighboring commitment test repeats the production Poseidon expression, and the signature tests generate and verify using the same current implementation. Changing the expansion personalization, domain bytes, field conversion, or commitment convention could therefore change the registered key recovered from an existing secret while all these tests still pass. Add independently checked literal secret-to-nk and secret-to-public_key_data vectors, covering both sign-normalization branches, and a fixed signature-verification vector. Keep the existing round-trip and malformed-input tests alongside them.
In `packages/rs-dpp/src/identity/identity_public_key/key_type.rs`:
- [SUGGESTION] packages/rs-dpp/src/identity/identity_public_key/key_type.rs:70-80: KEY_TYPE_MAX_SIZE_TYPE picks smallest, not largest
Adding the 64-byte Hecate key extends the supported payload sizes, but the maximum-size selector still sorts descending and takes last(), selecting a 20-byte hash type. The reversed selector predates this PR, but the new larger key extends the same estimation gap: max_possible_size_key, used by Drive's disable/re-enable estimation paths, does not represent the largest supported payload. The existing test only checks the generated length against the selected type's own default_size(), so it cannot detect this. Make the PV15 estimator account for the new 64-byte maximum and assert that expected size explicitly, preserving earlier protocol behavior rather than changing the shared selector unconditionally.
In `packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/validate_identity_public_keys_structure/v2/mod.rs`:
- [SUGGESTION] packages/rs-dpp/src/state_transition/state_transitions/identity/public_key_in_creation/methods/validate_identity_public_keys_structure/v2/mod.rs:310-316: No test pins contract-bounds refusal on a Hecate key
The new Hecate fixtures all use contract_bounds: None. Structure validation leaves bounds to state validation, where the shared validator delegates non-authentication purposes to v1 or rejects a contract-group bound directly. No added test exercises that delegation for the newly supported purpose. Add Drive-ABCI create/update regression cases for Hecate keys carrying SingleContract, SingleContractDocumentType, and ContractGroup bounds, asserting InvalidKeyPurposeForContractBoundsError. Use existing contract/group fixtures so the cases reach the purpose refusal rather than failing earlier on missing state.
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
…index The identity update adding a Hecate signer key read every key the identity ever had to find another enabled one: work that grew with the key history, done before fee validation, so an update refused for balance could repeat it unpaid. Drive now keeps a signer index under the identity's key references, at the purpose's key [7]: a reference per enabled HECATE_SIGNER key, written when the key is added (the tree is created with the identity's first signer key) and removed when it is disabled. The update reads one entry more than it disables (fetch_identity_hecate_signer_key_ids, Some(0) in identity method versions v3, which DRIVE_VERSION_V10 selects) and bills the read as a precalculated operation. The unused RetrieveIdentityInfo::keys is gone. The insert, reference and disable arms are in place: no key has the HECATE_SIGNER purpose before protocol version 15. Also pins that a signer key carrying any contract bound is refused with InvalidKeyPurposeForContractBoundsError, and describes the index in the GroveDB structure. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Pin known answers for two secrets: [0x00; 32], whose ask stays as reduced, and [0x02; 32], whose ask is negated because [ask_raw]G has its sign bit set. Each pins both expansions, ask before and after the sign-bit rule, nk and the registered data. Also pin one deterministic signature, plus a standalone verification vector where any one-bit change is refused. The hashes and field reductions are reproducible with the Python recipe in the test's doc comment. ak, both branches and the signature were also checked against a Python Pallas implementation. RedPallasHecateSecretKey now holds only its 32-byte private key, in Zeroizing. ask and nk are derived per call, and the expansion outputs, ask's canonical bytes and the signing seed are Zeroizing. reddsa's SigningKey, pasta field elements, StdRng and blake2b_simd's state have no zeroize support; the struct's doc says so. Since ask is derived per call and reddsa builds a SigningKey only through a fallible conversion, public_key_data() and sign() now return Result. from_secret still refuses a zero ask, so they fail only where it would. The redpallas feature now enables zeroize. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Your move: thepastaclaw left review threads unresolved; resolve them. |
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
🌳 GroveDB structure This pull request changes the described GroveDB structure. Open it in the structure viewer: new nodes glow, removed ones stay as ghosts, and the tour walks through each change. Added (2 nodes)
Changed (1 node)
Compared |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Verified the combined reviewer findings against head 9401714. Four prior findings are fixed and the pre-existing maximum-size selector finding is withdrawn; one blocking ownership violation remains in Swift's new Hecate length-validation rule. This was a static review with no builds or tests run; current CI shows the Kotlin SDK build/tests and changed-package determination pending, with no failed code checks reported.
🔴 1 blocking
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 8: gpt-6-astra (agent: phase2-reviewer, role: general); reviewer 9: gpt-6-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 10: gpt-6-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 11: gpt-6-astra (agent: phase2-reviewer, role: platform-versioning); reviewer 12: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 13: gpt-6-astra (agent: phase2-reviewer, role: rust-quality); reviewer 14: gpt-6-astra (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — The large, intricate diff changes consensus validation in identity_update/state/v2/mod.rs and cryptographic key encoding, derivation, and signature handling in redpallas_hecate.rs, alongside protocol-gated persistent signer indexing. - 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 quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— general (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— security-auditor (completed, effort xhigh); agentphase2-reviewer - Model comparison: every Phase-2 reviewer also ran on
gpt-6-astra; the verifier weighed both sets without knowing which model wrote which
🤖 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/swift-sdk/Sources/SwiftDashSDK/Utils/PrivateKeyUtils.swift`:
- [BLOCKING] packages/swift-sdk/Sources/SwiftDashSDK/Utils/PrivateKeyUtils.swift:251-252: Keep Hecate secret-length validation in DPP
This new case extends a Swift-owned acceptance rule, not just display metadata: `KeySizeValidator.isValidSize` compares the supplied key length against this literal. DPP already owns the representation through `RedPallasHecateSecretKey::from_secret` and enforces the 32-byte input in `sign_by_private_key`. The book explicitly says that SDKs and FFI must never duplicate a length check enforced by DPP, and that mobile wrappers marshal rather than decide. Expose the canonical private-key size or size-validation operation through a thin Rust FFI adapter and delegate this Hecate case to it. The existing Swift cases do not justify adding another independently maintained validation rule.
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
Swift's KeySizeValidator kept its own size for every key type, and this PR added the Hecate one to it. DPP now owns the size (KeyType::private_key_size, 32 bytes for every type, the Hecate signing arm reading it), rs-sdk-ffi exposes it through dash_sdk_private_key_size_for_key_type, and KeySizeValidator asks for it instead of keeping literals. Kotlin keeps no such rule. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — 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
Static review of head 048f78b found no blocking defects: five prior findings are fixed, and the previously withdrawn finding remains withdrawn. One test-organization nit remains; the proposed re-enable defect does not apply to the operation's documented masternode-only calling contract. Rust workspace, Kotlin, JS, and Docker checks remain pending; no builds or tests were run locally.
💬 1 nitpick(s)
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 8: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); 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:
criticalbygpt-6.1-sol(effort low) — The large, intricate diff changes consensus key-admission rules in validate_identity_public_keys_structure/v2/mod.rs and identity_update/state/v2/mod.rs, and introduces cryptographic key validation and signing in redpallas_hecate.rs and signing.rs. - 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 quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- 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 xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); 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/identity/identity_public_key/purpose.rs`:
- [NITPICK] packages/rs-dpp/src/identity/identity_public_key/purpose.rs:191-197: Keep successful purpose conversions in the valid-variants tests
The new successful conversion of discriminant 7 is asserted inside test_purpose_try_from_u8_invalid, while test_purpose_try_from_u8_valid_all_variants still stops at 6. The i32 tests have the same mismatch. Move each successful HECATE_SIGNER assertion into its valid_all_variants test so the test names accurately describe their coverage.
Out-of-scope follow-up suggestions (1)
These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.
- Re-enabling a signer key does not restore the signer index — The missing HECATE_SIGNER refresh arm exists, but the claimed failure requires a caller outside this operation's supported contract. IdentityOperationType::ReEnableIdentityKeys explicitly documents that it is only for masternode identities; current producers are masternode core-update paths using their fixed key types, and the add_new_identity fallback re-enables only keys matching the incoming masternode key data. User identity updates expose addition and disabling, not re-enabling. No supported current path supplies a Hecate key here, so this is a hypothetical future capability requirement rather than an actionable index-maintenance defect in this PR.
- Follow-up: Consider creating a separate issue or author/maintainer-requested PR for this.
|
Bots are done — your move: post |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
Static verification of 9766bab..10b693b found no remaining actionable in-scope defects: 22 prior findings are fixed, and the two settled withdrawals remain withdrawn. Current CI reports successful Rust workspace, wasm32, Swift, Kotlin, JavaScript, Docker, functional, and browser checks; the dedicated Rust wallet job is skipped and PR Hygiene remains pending. No local builds or tests were run.
🔴 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:
criticalbygpt-6.1-sol(effort low) — This large, intricate diff changes consensus validation in identity_update/state/v2/mod.rs, implements RedPallas key parsing and signature handling in redpallas_hecate.rs and signing.rs, and changes persisted signer-key indexes. - 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 quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- 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 xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); 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 |
…r-key-type # Conflicts: # Cargo.lock
|
Waiting for bot review — 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
Verified the findings against head 805ac8b: 22 prior findings are fixed, and the two settled withdrawals remain withdrawn. Two current findings remain: a blocking re-entry race in asynchronous identity deletion and a non-blocking ownership-API boundary concern. Verification was static; current CI code checks, including Rust workspace, Swift SDK, Kotlin, and integration/browser suites, pass, while PR Hygiene remains pending.
🔴 1 blocking | 🟡 1 suggestion(s)
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 6: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 8: gpt-6.1-sol (agent: phase2-reviewer, role: tenderdash-consensus-security); reviewer 9: gpt-6-astra (agent: phase2-reviewer, role: general); reviewer 10: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 11: gpt-6-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 12: gpt-6-astra (agent: phase2-reviewer, role: ffi-engineer); reviewer 13: gpt-6-astra (agent: phase2-reviewer, role: platform-versioning); reviewer 14: gpt-6-astra (agent: phase2-reviewer, role: rust-quality); reviewer 15: gpt-6-astra (agent: phase2-reviewer, role: security-auditor); reviewer 16: gpt-6-astra (agent: phase2-reviewer, role: tenderdash-consensus-security); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — The large, cross-cutting diff changes cryptographic key parsing and signature verification in packages/rs-dpp/src/identity/identity_public_key/redpallas_hecate.rs and consensus admission rules in packages/rs-drive-abci/src/execution/validation/state_transition/state_transitions/identity_update/state/v2/mod.rs. - 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 quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— tenderdash-consensus-security (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— general (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6-astra— tenderdash-consensus-security (completed, effort xhigh); agentphase2-reviewer - Model comparison: every Phase-2 reviewer also ran on
gpt-6-astra; the verifier weighed both sets without knowing which model wrote which
🤖 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/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/WalletKeyHealthSheet.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/WalletKeyHealthSheet.swift:759-769: Make the Platform re-check and identity deletion single-flight
Confirming Delete clears pendingOrphanDelete immediately, but this task leaves the report's Delete button enabled while checkIdentityKeysOnPlatform awaits its network response. Neither isRunning nor another in-flight guard protects the operation. A user can confirm the same identity twice during a slow fetch, leaving two tasks holding the same report.identityRow. If both checks return NotOwned, the first task deletes and saves that model; the second then passes the deleted model into deleteOrphan, which reads identityIdBase58 and its relationships. Those accesses are precisely the post-deletion lifetime hazard documented by this file's existing cleanup comments. MainActor isolation does not prevent this interleaving across the await, and overlapping refreshes also write persisted identity state.
Acquire a per-identity in-flight guard before launching the task, disable the action, and retain the guard through refresh and cleanup. After the await, resolve a live persistence row by its stable identity ID rather than unconditionally using the captured model, and make an already-removed identity a safe no-op. Keep the ownership decision in Rust. Add a delayed-refresh regression that attempts repeated confirmation and removal while the check is pending, asserting cleanup happens at most once.
In `packages/rs-platform-wallet/src/wallet/identity/network/identity_handle.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/wallet/identity/network/identity_handle.rs:1059-1063: Resolve the managed identity's slot inside the refreshed ownership check
This identity-ID-scoped operation refreshes the managed identity and binds the seed to the wallet, but still uses the caller's independent identity_index to determine ownership. IdentityManager::identity_index already owns that association, and update_identity resolves it internally. For an identity whose enabled master matches wallet slot 1, passing slot 0 here can return NotOwned despite using the correct wallet seed and freshly fetched Platform keys. The current Swift caller forwards persisted metadata, so this is API-boundary hardening rather than a demonstrated failure of that caller; nevertheless, the public removal-eligibility verdict depends on callers reproducing an association the wallet already holds.
Resolve the index from the managed identity inside this operation, or reject a supplied index that disagrees. Return an error or inconclusive result when no wallet slot exists. Keep explicit-index comparison available for low-level/offline diagnostics, and add a regression showing that contradictory slot input cannot make a managed wallet-owned identity appear foreign.
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
…emove it once at a time in the key health sheet The Platform ownership check took the caller's identity index, though the wallet already holds each identity's slot: an identity at slot 1 checked at slot 0 came back NotOwned. `check_identity_keys_on_platform` (and its FFI and Swift wrappers) now resolve the slot from this wallet's identity manager, and refuse an identity held with no slot in this wallet (IdentityIndexNotSet) before the fetch and before the seed is read. The key health sheet left Delete enabled while that check awaited Platform, so confirming twice could delete a row and then hand the deleted model to a second cleanup. A per-identity IdentityRemovalGate now runs one removal at a time, disables the actions while it runs, and deletes the row the store holds after the check (none left is a no-op). runCheck skips identities deleted since the sheet opened. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
…r-key-type # Conflicts: # packages/rs-platform-version/src/version/v15.rs
|
Waiting for bot review — 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
Static verification of a7def39..e2fda16 found no remaining actionable in-scope defects: 24 prior findings are fixed and the two settled withdrawals remain withdrawn. Current CI for this exact head reports successful Rust workspace, wasm32, Swift SDK, Kotlin, JavaScript, functional and E2E checks; Rust wallet tests and ARM64 runner validation were skipped, and PR Hygiene remains pending. No local builds or tests were run, and SwiftExampleApp removal-test runtime execution is not established by the available evidence.
🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 4: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); 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: tenderdash-consensus-security); reviewer 10: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 11: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 12: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 13: gpt-6.1-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 14: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); reviewer 15: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); reviewer 16: gpt-6.1-sol (agent: phase2-reviewer, role: tenderdash-consensus-security); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — The large, intricate diff changes consensus validation in identity_update/state/v2/mod.rs and cryptographic key parsing and signature handling in redpallas_hecate.rs, alongside persistent signer indexing and wallet key management. - 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 quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- 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 xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— tenderdash-consensus-security (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— tenderdash-consensus-security (completed, effort xhigh); 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 |
…r-key-type # Conflicts: # packages/rs-platform-version/src/version/v15.rs
|
Waiting for bot review — 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 0769158, static source verification confirms that 24 prior findings are addressed, the two settled withdrawals remain justified, and no remaining actionable in-scope defect was confirmed. Current CI code checks pass, including Rust workspace, wasm32, Kotlin, Swift SDK and JavaScript checks; PR Hygiene remains pending, and the dedicated Rust wallet job is skipped. No local builds or tests were run, and runtime execution of the new Swift example-app removal tests remains unverified.
🔴 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: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: ffi-engineer); reviewer 5: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); 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:
criticalbygpt-6.1-sol(effort low) — The change is large and intricate and directly modifies cryptographic key parsing and signature verification in packages/rs-dpp/src/identity/identity_public_key/redpallas_hecate.rs, consensus validation in identity update state v2, and persisted signer-key indexing in Drive. - 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 quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
- 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 xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— ffi-engineer (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— platform-versioning (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort xhigh); 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 |
…r-key-type # Conflicts: # packages/rs-dpp/src/errors/consensus/basic/basic_error.rs # packages/rs-dpp/src/errors/consensus/state/state_error.rs # packages/rs-dpp/src/state_transition/mod.rs # packages/rs-platform-version/src/version/feature_initial_protocol_versions.rs # packages/rs-platform-version/src/version/fee/v4.rs # packages/rs-platform-version/src/version/v15.rs # packages/wasm-dpp/src/errors/consensus/consensus_error.rs
Basic explanation
Private document types will let an identity send an entry to another identity without revealing which identity sent it. A zero-knowledge proof will show that the sender holds one of the signer keys registered on Platform, without saying which one. This PR adds that key. From protocol version 15, an identity can register one RedPallas key, the curve and signature scheme Zcash's Orchard uses, under a new purpose of its own.
The PR only registers the key: nothing proves membership with it yet. The key can never sign a state transition or a document.
Issue being fixed or feature implemented
A proof that "some registered identity sent this" needs every sender's key to be one a Halo 2 circuit can work with cheaply. Platform's ECDSA and BLS keys are not, but a RedPallas key is: Orchard proves spend authority with one. The tree that will collect these keys, and the proofs over it, are separate work. This PR lets identities register the key on chain so that the tree can later be built from what is there.
What was done?
From protocol version 15 (note 27 of
v15.rs):The key.
KeyType::REDPALLAS_HECATE(5): 64 bytes of data,ak || Poseidon(nk).ak(32 bytes): a RedPallas spend-authorization verification key, encoded as Orchard encodes it, with its sign bit clear.Poseidon(nk)(32 bytes): a commitment (Poseidon P128Pow5T3, one input) to a second key,nk, which a later proof uses.Purpose::HECATE_SIGNER(7), wire name"hecate_signer".Before, at protocol version 14 and earlier, key type 5 and purpose 7 do not decode, so no transition can carry them. After, an identity update can add one:
Rules.
InvalidIdentityPublicKeyTypeForPurposeError(10540, new)InvalidIdentityPublicKeySecurityLevelError(10519)aka Pallas point other than the identity with its sign bit clear,Poseidon(nk)a canonical Pallas base elementBasicRedPallasError(20018, new)TooManyHecateSignerKeysError(10541, new)akBasicRedPallasError(20018, new); unpaid on an identity update (identity update advanced structure 1, note 2)IdentityAlreadyHasHecateSignerKeyError(40223, new); the nonce is bumpedripemd160(sha256(data))Rotation. An identity update that disables the enabled signer key and adds a new one is admitted.
The signer index. Drive keeps an identity's enabled signer keys in a tree under its key references, at the purpose's key
[7]: a reference per enabledHECATE_SIGNERkey, keyed by key id. The tree is created with the identity's first signer key. Adding the key writes its reference, and disabling the key removes it, so the index holds at most one entry.An update adding a signer key reads the index (
fetch_identity_hecate_signer_key_ids,Some(0)inDRIVE_IDENTITY_METHOD_VERSIONS_V3, whichDRIVE_VERSION_V10selects) and bills the read. It reads one entry more than the update disables, however many keys the identity has ever had, which decides the rule exactly. Other updates read nothing more than before.Before:
After an identity adds signer key 4:
After it disables key 4,
[7]stays and is empty.Never a signing key. The node already refuses, before it verifies a signature, any key whose type or purpose a transition does not accept for signing.
verify_identity_signed_signaturealso refuses this key type.Purpose::full_range()is unchanged, so a document type'skeyRequirementscannot nameHECATE_SIGNER, and contract bounds on such a key are refused as on any purpose without them.Fee.
FeeSignatureVersiongainsverify_signature_redpallas:FEE_SIGNATURE_VERSION1, never charged, since no earlier version holds such a key;FEE_SIGNATURE_VERSION2, whichFEE_VERSION4(protocol version 15) selects.That is about 3.3 times a secp256k1 verification (15,000) and a sixth of a BLS one (300,000). It is an estimate, not a benchmark.
Stored platform states from before fee version 4 embed their fee table (
FeeVersionFieldsBeforeVersion4). Its signature table is now the frozen five-fieldFeeSignatureVersionFieldsBeforeVersion4, as was already done for the storage fees, so states saved before this change still decode.Gate.
active_version_range_for_keys_in_creationmakes an identity create or update carrying aREDPALLAS_HECATEorHECATE_SIGNERkey active from protocol version 15 only (HECATE_SIGNER_KEY_INITIAL_PROTOCOL_VERSION). Decoding refuses it unpaid before then, as software that cannot decode key type 5 or purpose 7 refuses it. This is the same pattern protocol version 14 uses for contract-group bound keys and version 1 keys.Deriving a key (client side). The private key is a 32-byte secret:
askis the scalar fromBLAKE2b-512(personal "DashHecateExpand", secret || 0), negated when itsakwould have the sign bit set (Orchard's rule);nkis the base element from the same function with|| 1;RedPallasHecateSecretKeylives in dpp behind a newredpallasfeature, which pulls in reddsa, pasta_curves and halo2_poseidon but not Orchard's proving system. It holds only the 32-byte secret, in aZeroizingbuffer, and derivesaskandnkon each call. Signing borrows the private key rather than copying it, andnk()returns its copy in aZeroizingbuffer; reddsa'sSigningKey, pasta's field elements and rand'sStdRnghave no zeroize support, so those short-lived copies are not wiped. simple-signer signs with it. The platform wallet does not derive such keys yet and refuses to, as their derivation path is not decided: itsidentity_key_derivation_typesays which key types it derives at an identity's key slots (not Hecate signer keys or script hashes), andderive_identity_key_bytesderives by it. The wallet's stored key rows follow it too: a key of a type it doesn't derive is stored with no wallet id or derivation indices, whatever breadcrumb a landed update, discovery or an add gave it. Before, a landed update gave such a key its wallet slot, and a client would derive that slot's ECDSA key and keep it as the key's private key.Bindings.
KeyType.redpallasHecate,KeyPurpose.hecateSigner) and Kotlin (KeyType.REDPALLAS_HECATE,KeyPurpose.HECATE_SIGNER) know them; Swift'sKeyValidationpasses key type 5 to the FFI. A private key's size is DPP's (KeyType::private_key_size, 32 bytes for every type), which rs-sdk-ffi exposes asdash_sdk_private_key_size_for_key_typeand Swift'sKeySizeValidatorreads instead of keeping its own sizes.check_identity_key_from_masterderives where signing derives (identity_key_derivation_path, shared withderive_identity_key_bytes), compares with DPP'svalidate_private_key_bytes, and answers not derived, matches, mismatch or not compared. The wallet runs it (IdentityWallet::check_identity_keyandcheck_identity_keys, which take a wallet handle over FFI): when every key's outcome is known without the seed it answers without resolving it; otherwise it resolves the master once, checks that it derives the wallet's persisted account xpub (verify_master_binds, the check the signer uses) and refuses another wallet's seed withSeedMismatchbefore comparing anything. rs-platform-wallet-ffi exposes them asplatform_wallet_check_identity_key_with_resolverandplatform_wallet_check_identity_keys_with_resolver(which release the wallet registry before the host resolver runs), and Swift asManagedPlatformWallet.checkIdentityKeyandcheckIdentityKeys.check_identity_keys, FFIplatform_wallet_check_identity_keys_with_resolver, SwiftcheckIdentityKeys):IdentityWalletOwnershipisOwnedwhen an enabled master key is the wallet's,NotOwnedwhen every enabled master is another key and no enabled key is the wallet's, andUndeterminedotherwise. Disabled keys never count, so a foreign master replaced by a wallet-derived one doesn't count against the identity.NotOwnedalso needs every key compared: key rows the sheet can't read (passed asunreadable_key_count) and an ECDSA key that isn't in the 33-byte compressed form DPP compares (a newNotComparedoutcome; discovery and signing treat such keys as not wallet-derived too) rule it out. A key whose id is past the last hardened index is at no wallet slot and reports not derived. The sheet offers to delete an identity only onNotOwned, and confirming re-checks it on Platform first:check_identity_keys_on_platform(FFIplatform_wallet_check_identity_keys_on_platform_with_resolver, SwiftcheckIdentityKeysOnPlatform) re-fetches the identity withrefresh_identity, which stores the refreshed rows, and checks the keys Platform returns at the identity's own slot in this wallet, which it reads from the wallet's identity manager rather than taking from the caller; an identity held with no slot in this wallet (observed, or another wallet's) is refused withIdentityIndexNotSetbefore the fetch and before the seed is read. Anything butNotOwned, or an error, deletes nothing. One removal runs per identity at a time (IdentityRemovalGate): both Delete actions are disabled while it runs, and it deletes the row the store holds after the check, so a second confirmation during a slow fetch does nothing and a row already gone is a no-op. The sheet's re-check skips identities deleted since it opened. The delete wipes only this wallet's Keychain keys for the identity (KeychainManager.deleteAllIdentityPrivateKeys(forIdentityIdBase58:walletId:)); any key that isn't the wallet's shows as "Not this wallet's key" with no action. Re-derive stores Rust's path and key, with the key's on-chain public key in the Keychain metadata (for an ECDSA_HASH160 key, the hash the signer looks up rather than the full key).In-place changes to shipped generations
Each change below is reached only with a
REDPALLAS_HECATEorHECATE_SIGNERkey. No transition carrying one is active before protocol version 15, so no identity holds one before then, and none of these changes what an earlier version does:KeyTypedecodes 5 andPurposedecodes 7. Before this change such a transition failed to decode; now it decodes and is refused as inactive before version 15. Both refusals happen at decode, unpaid.REDPALLAS_HECATE => truearm, which refuses the key and is unreachable. Its tests now pin protocol version 14 instead oflatest().verify_identity_signed_signaturev0: refusesREDPALLAS_HECATEwithInvalidIdentityPublicKeyTypeError.from_public_key_signed_externalv0: signs aREDPALLAS_HECATEkey's proof of possession as it signs an ECDSA or BLS key's.add_estimation_costs_for_purpose_in_key_reference_treev0:HECATE_SIGNERdescribes the signer index, asTRANSFERdescribes its references.insert_new_unique_keyv1 (protocol versions 14 and 15) writes aHECATE_SIGNERkey's reference, andinsert_key_searchable_referencesv0 writes it into the signer index, creating the index when it is missing.disable_identity_keysv1 (protocol versions 14 and 15) removes a disabledHECATE_SIGNERkey's reference from the signer index.KeyTypemethods (default_size,is_unique_key_type,signature_verify_cost,public_key_hash_for_key_data, private key checks) andsigning.rs: new arms for the new type.FEE_SIGNATURE_VERSION1gainsverify_signature_redpallas: 0, which only a RedPallas key reads.FEE_VERSION4keepsfee_version_number1: the fee history serves onlyKnownCostItemcosts, and none reads the RedPallas tariff.How Has This Been Tested?
redpallas_hecate.rs(10 tests):nkis committed with Poseidon;ask's negation: each pins the expansions,ask,nkand the key data. The BLAKE2b expansions and field reductions were checked separately in Python, and so wereakand the signatures (verified, not regenerated);akthe identity, sign bit set) is left to the proof of possession;key_type.rs: size, uniqueness and decoding of type 5.state_transition/mod.rs:should_make_a_transition_adding_a_hecate_signer_key_active_from_protocol_version_15.should_create_identity_with_one_hecate_signer_key(one key is admitted; two are refused with 10541).should_add_a_hecate_signer_key_with_its_proof_of_possession;should_refuse_a_hecate_signer_key_whose_proof_of_possession_does_not_verify(unpaid);should_refuse_a_second_enabled_hecate_signer_key_and_rotate_by_disabling_the_first(40223, then rotation at revision 2);should_refuse_a_hecate_signer_key_as_the_signer_of_a_transition;should_not_admit_a_hecate_signer_key_at_protocol_version_14.akthe identity, sign bit set):should_answer_busy_at_check_tx_an_identity_update_adding_malformed_hecate_signer_key_data_while_the_proof_capacity_is_in_use(busy while the capacity is in use, then 20018 once it is free);should_refuse_at_check_tx_an_identity_update_adding_two_hecate_signer_keys_while_the_proof_capacity_is_in_use(10541, with no capacity);should_refuse_unpaid_an_identity_update_adding_malformed_hecate_signer_key_data(20018 in a block, the identity and nonce left as they were).fetch_identity_hecate_signer_key_ids:should_hold_only_the_enabled_hecate_signer_keys: no index before the first signer key, then it holds the key, is empty after disabling, and holds the next;should_read_the_signer_index_at_a_cost_that_does_not_grow_with_the_identity_keys: the read costs the same for an identity with 4 keys and one with 40.should_decode_the_five_field_encoding_of_pre_1_4_platform_statesdecodes five independently encoded fees as the frozen pre-1.4 signature fee table and checks the RedPallas fee converts to 0.should_read_a_signer_key_added_in_the_transaction_it_reads_in(an uncommitted transaction reads its own signer key, committed state doesn't), and the rotation test reads with limit 1.applyfalse, checked to write nothing), then running, and asserting the estimate covers the run's processing and storage fees:should_estimate_a_first_signer_key_at_least_at_its_execution_cost(the add creates the index),should_estimate_disabling_a_signer_key_at_least_at_its_execution_cost, andshould_estimate_rotating_a_signer_key_through_the_index_at_least_at_its_execution_cost(a second key joins the index, then the first leaves it).should_say_which_identity_key_types_the_wallet_derives,should_refuse_to_derive_a_hecate_signer_key, andshould_store_a_hecate_signer_key_without_derivation_coordinates(an externally generated Hecate key added by a landed update, with the cache behind it or at it, and disabled after a refresh, is stored without coordinates; an ECDSA key beside it keeps them).should_refuse_another_wallets_seed_instead_of_calling_the_identity_foreign,should_answer_without_the_seed_when_no_key_needs_comparing,should_check_one_key_with_the_wallets_seed_only,should_not_derive_a_key_whose_id_is_past_the_last_hardened_index,should_bind_a_master_exactly_as_the_signer_check_does, and, with a mocked Platform fetch,should_check_the_identity_platform_returns_not_the_stale_rows,should_refuse_an_identity_the_wallet_does_not_hold_without_the_seed,should_refuse_an_identity_platform_does_not_return,should_check_a_held_identity_at_its_own_wallet_slot(an identity at slot 1 is Owned, where the explicit check at slot 0 says NotOwned) andshould_refuse_a_held_identity_with_no_wallet_slot_without_the_seed(observed, or in another wallet's bucket:IdentityIndexNotSet, nothing fetched, the seed not read).identity_key_wallet_check(21 tests, on a wallet handle; the Platform re-check refuses an identity the wallet doesn't hold, and one it holds with no wallet slot, without reading the mnemonic): both entry points refuse another wallet's mnemonic, report not derived and not compared without reading the mnemonic, refuse unknown discriminants, null pointers and an unknown wallet, and free safely;should_release_the_wallet_registry_before_the_resolver_runsanswers while the resolver writes the registry; the resolver waits at most 10 s for its write and answers either way, so code that holds the registry fails the test and then releases it, rather than hanging the test process.should_serve_every_known_cost_of_a_protocol_version_from_its_fee_version_number: for every protocol version, each known cost item is the same in its fee schedule and in the entry its number resolves to.WalletKeyHealthStatusTest(4 tests, run): a key whose private key doesn't open is repairable only with its whole wallet slot recorded, so a Hecate signer key with neither shows as not checked, and an identity counts healthy unless a key needs a repair.hecate_signer_keysfixture reaches the index, held and emptied;grovedb-structure.jsonregenerated.should_refuse_every_contract_bound_on_a_hecate_signer_key: a signer key bound to a contract, a document type or a contract group (each existing) is refused withInvalidKeyPurposeForContractBoundsErrorby the dispatcher identity create and update both call.cargo check --workspace --all-targets;dash_sdk_private_key_size_for_key_type's tests (every type, unknown types and a null pointer refused);IdentityKeyWalletCheckTestsdecodes hand-built C results through the internal projections the bridges call: every outcome, the key and hash bytes in order, key order and every ownership value of an identity check, unknown values refused, and the Swift values intact after the C buffers are wiped and freed. SwiftExampleAppTestsIdentityRemovalGateTests(6 tests, typechecked, not run) holds the ownership check pending while removal is confirmed again before and during it, and asserts one check and one delete; it also covers a kept identity, a failed check, a row removed during the check, a failed delete, and two identities removed independently.Breaking Changes
Consensus, from protocol version 15 only: identities can register the new key, with the rules above, and a RedPallas signature costs 50,000 credits to verify. Earlier protocol versions are unchanged.
Rust API:
KeyTypeandPurposegain a variant each, so an exhaustivematchon either needs a new arm;KeyType::all_key_types()returns six types;FeeSignatureVersiongains a field;DriveIdentityKeysFetchMethodVersionsgainsfetch_identity_hecate_signer_key_ids.GroveDB structure, from protocol version 15: an identity's key references gain the signer index at
[7], created with its first signer key.FFI, Swift and Kotlin: new enum values for the key type and purpose.
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
Summary by CodeRabbit