Repository navigation
feat(platform-wallet): check a masternode key by its hash without its secret - #6024
Conversation
… secret Add verify_masternode_key_id: compares a key's 20-byte id (hash160 for the secp256k1 roles, the Tenderdash node id for PlatformNode) against a MasternodeKeyReference. Operator has no 20-byte id and stays Unverifiable. verify_masternode_key now maps each role to its reference id and compares through the same rule, so the secret and the hash paths cannot disagree. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WunYYhpfoE88XJoyRt4hcR
…ts of masternode key checks Co-Authored-By: Claude Opus 5.5 <[email protected]>
… a known operator key KeyVerification::Unverifiable also covers a role that cannot be checked by its 20-byte id: verify_masternode_key_id returns it for an operator key, whose reference is the whole BLS key. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WunYYhpfoE88XJoyRt4hcR
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
✅ Final review complete — no blockers (commit 18f90bb) |
Check both ECDSA encodings with independent public-key ids and distinct role fields. Cover operator exclusion with populated references, direct curve mismatches, and zero scalars. Specify public id encodings in rustdoc. Co-Authored-By: Codex <[email protected]> <sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>
|
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.
Final validation — Phase 2 only (queue backlog)
This PR adds a wallet API for checking a masternode key by its public ID without the secret, while preserving the existing secret-based verdicts. The head commit strengthens tests for role isolation and invalid or wrong-curve secrets. The latest GitHub check status showed no failures; the Linux Rust wallet tests and Kotlin SDK emulator build and tests were still pending.
🟡 1 suggestion(s)
Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.
Review provenance
Source: reviewer 1: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
lowbygpt-6.2-sol(effort low) — The production change is a small, contained refactor that shares role-specific identifier comparisons without changing key derivation or signing, and most of the diff is targeted tests. - Phase 1 reviewers: not run (skipped for throughput: 14 PRs queued, above the 10 limit)
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort medium); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort medium); agentphase2-reviewer,gpt-6.2-sol— rust-quality (completed, effort medium); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort medium); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/rs-platform-wallet/src/masternode/locator.rs`:
- [SUGGESTION] packages/rs-platform-wallet/src/masternode/locator.rs:948-953: A registered Platform node ID looks like the wrong key in Core wire order
Impact: A wallet developer who passes the raw node ID bytes from a Core provider transaction gets `DoesNotMatch` for a registered key whenever reversing the bytes changes their order.
The returned verdict does not distinguish a byte-order mistake from a different key. The API accepts either representation as `&[u8; 20]` and compares it directly against canonical Tenderdash bytes, but Core serializes the field in reverse order. The rustdoc names the canonical order without showing how to obtain it from a provider transaction. Point callers to `PlatformNodeId::as_byte_array()` on the decoded field so they can use the existing conversion.
|
Bots are done — your move: post |
thepastaclaw
left a comment
There was a problem hiding this comment.
CI failed after approval — commit 8805511
The standing review approved this commit; this follow-up moves the verdict to COMMENT: checks that failed after the review may relate to this change, and the evidence does not rule it out.
Failing checks:
Swift SDK build / Swift SDK build + tests (warnings as errors)(failure)Rust wasm32 tests / Rust wasm32 tests(failure)
Why it is unclear: The Swift test run ended with an xcodebuild abort (exit 134), but the log does not identify what triggered it or connect it to masternode key verification. The wasm32 job compiled successfully and was canceled after the runner received a shutdown signal, with no test failure reported.
Nothing was re-reviewed: the findings of the standing review are unchanged. The next push gets a full review; a re-run that passes does not restore the approval.
Review provenance
Source: CI-check lane gpt-6.2-sol (agent: triage); no reviewer or verifier lanes ran for this follow-up
- Verdict moved because CI failed on this commit after the review; failure logs read: 2 GitHub Actions job(s)
8805511 to
18f90bb
Compare
|
Bots are done — your move: post |
There was a problem hiding this comment.
Re-review — Final validation — Phase 2 only (queue backlog)
Updated after discussion: 1 finding(s) of this review were settled in the inline threads.
- ✅ Withdrawn: 🟡 A registered Platform node ID looks like the wrong key in Core wire order
New on this head: The rebase leaves all four feature commits unchanged: the Rust wallet can check a masternode key by its public identifier without needing the secret. Rust wallet tests and Swift and Kotlin SDK checks passed; PR Hygiene and the review check are still pending.
🟡 1 0 suggestion(s)
Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.
Still open from earlier rounds (1)
- 🟡 Suggestion: A registered Platform node ID looks like the wrong key in Core wire order —
packages/rs-platform-wallet/src/masternode/locator.rs:948-953(thread) — settled: ✅ Withdrawn
Review provenance
Source: reviewer 1: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
lowbygpt-6.2-sol(effort low) — The diff adds a straightforward role-specific ID comparison and reuses it in the existing secret-based verifier, with most of the added lines devoted to tests. - Phase 1 reviewers: not run (skipped for throughput: 12 PRs queued, above the 10 limit)
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort medium); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort medium); agentphase2-reviewer,gpt-6.2-sol— rust-quality (completed, effort medium); agentphase2-reviewer,gpt-6.2-sol— security-auditor (completed, effort medium); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/rs-platform-wallet/src/masternode/locator.rs`:
- [SUGGESTION → WITHDRAWN in discussion; do not fix] packages/rs-platform-wallet/src/masternode/locator.rs:948-953: A registered Platform node ID looks like the wrong key in Core wire order
(carried; thread: https://github.com/dashpay/platform/pull/6024#discussion_r4678327181)
|
Ready for review — |
llbartekll
left a comment
There was a problem hiding this comment.
Reviewed the diff: the refactor keeps every existing verdict of verify_masternode_key, each role reads only its own reference field, and the operator role is correctly Unverifiable by id. No issues found.
|
Policy satisfied — this can merge. |
TL;DR: A wallet can now check whether a masternode key belongs to a node using only the key's hash, without needing the key's secret.
User story
As a wallet app developer, I want to check a masternode owner, voting, payout or platform-node key against a node's registered keys from its hash alone, to achieve key matching for keys the wallet does not hold the secret for (watch-only or hardware-held keys).
Scenario
Base flow
A wallet app knows the hash of a key (for example from a list entry or a host keystore) and wants to know whether it is the key a masternode has registered for a given role.
Actual behavior
verify_masternode_keyneeds the key's secret. With only the hash, the app has to re-implement the comparison.Expected behavior
verify_masternode_key_idreturns the same verdict from the key's 20-byte id asverify_masternode_keyreturns from its secret: a match, a mismatch, or unverifiable.Detailed discussion
Issue being fixed or feature implemented
Stacked atop #5889 (
feat/masternode-key-rotation); first PR of the stack that builds masternode withdrawals on it.What was done?
masternode::verify_masternode_key_id(rs-platform-wallet/src/masternode/locator.rs): compares a key's 20-byte id against aMasternodeKeyReference: hash160 for the secp256k1 roles (owner, voting, payout), the Tenderdash node id forPlatformNode. An operator key is a 48-byte BLS key with no 20-byte id, so it is alwaysUnverifiableby id.verify_masternode_keynow maps each role to its reference id and compares through the same rule, so the secret path and the hash path cannot disagree. Its existing results are unchanged.KeyVerification::Unverifiabledocs cover the operator-by-id case.How Has This Been Tested?
Unit tests in
locator.rs: every role with a 20-byte id gets the same verdict from its id as from its secret (match, mismatch, unknown reference); each role reads only its own reference field; an operator key is never verified by id; a secp256k1 secret outside the curve order never matches.Breaking Changes
None. The change is additive; no FFI change.
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
https://claude.ai/code/session_01WunYYk4eUkHuGstPtj83j4
🤖 Co-authored by Claudius the Magnificent AI Agent
PR Hygiene ·
18f90bbrs-platform-wallet(packages/rs-platform-wallet/src/masternode/locator.rs,packages/rs-platform-wallet/src/masternode/mod.rs) — approved by llbartekllWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.