Repository navigation
feat(masternode): use wallet-held node keys and withdraw via platform-wallet - #1109
Claudius-Maginificent wants to merge 47 commits into
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 51 minutes. View limit details
Walkthrough
Merge Risk:
|
|
⛔ Final review complete — 2 blocking finding(s) (commit 79980b9) |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 2 only (no Phase 1 for this repository)
The wallet-held masternode key discovery is generally well integrated, but merge loading can preserve a rotated disabled key and suppress discovery of its replacement. Three additional non-blocking gaps affect discovery completeness and entry-point consistency. CI checks are skipped because the PR is draft.
🔴 1 blocking | 🟡 3 suggestion(s)
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: Allow wallet-only masternode loads through the MCP entry point
src/mcp/tools/masternode.rs:147-152
The backend discovery path supports blank owner and payout fields when a loaded wallet holds the node keys, but this MCP preflight rejects that request before dispatching the backend. A wallet-only load through standalone MCP or det-cli therefore still requires a pasted owner or payout key, creating different behavior from the GUI path. Relax this preflight and update the parameter documentation so wallet-held keys are a supported MCP load mode, or explicitly document and enforce that this feature is GUI-only.
source: gpt-6.1-sol (phase2-reviewer: general)
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — The diff is large and intricate and changes funds movement plus private-key discovery, storage references, signing, and withdrawal routing in src/wallet_backend/masternode.rs and src/backend_task/identity/withdraw_from_identity.rs. - Phase 1 reviewers: not run (disabled for this repository)
- 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— rust-quality (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 `src/backend_task/identity/load_identity.rs`:
- [BLOCKING] src/backend_task/identity/load_identity.rs:226-236: Do not let a disabled stored key suppress discovery of the current node key
During a merge, this guard treats any stored key with the same target and purpose as authoritative without checking whether that key still corresponds to an active key in the freshly fetched identity. After a masternode payout or owner key rotation, the old key can remain in local storage while Platform marks it disabled and exposes a new active key with a different ID. Discovery is then skipped, the merge preserves the unusable old entry, and withdrawal resolution rejects it. Check the stored key ID against the refreshed identity and only suppress discovery when the corresponding current key has the same purpose and is active.
In `src/wallet_backend/masternode.rs`:
- [SUGGESTION] src/wallet_backend/masternode.rs:40-43: Do not cap voting-key discovery at index 19
The fixed `0..20` scan excludes a valid provider voting key at index 20 and every later index. `derive_provider_key_at_index` accepts arbitrary indices, and the wallet can retain provider-key pool depth beyond this floor when it operates multiple nodes. As a result, a wallet-held voting key outside the first 20 indices is silently reported as absent. Reuse a durable voting-account pool bound or expose an upstream seedless provider-account depth lookup instead of imposing a separate fixed limit here.
- [SUGGESTION] src/wallet_backend/masternode.rs:115-126: Continue wallet-key discovery after an individual wallet inspection error
Discovery is intended to be best effort, but an error from `wallet_held_keys` is immediately propagated. The caller then discards all accumulated results and proceeds without wallet references, so one stale, partially restored, or malformed wallet can prevent later healthy wallets from being inspected. Treat an individual wallet inspection error as a per-wallet skip with a warning, while still returning infrastructure failures such as a `spawn_blocking` join error.
In `src/mcp/tools/masternode.rs`:
- [SUGGESTION] src/mcp/tools/masternode.rs:147-152: Allow wallet-only masternode loads through the MCP entry point
The backend discovery path supports blank owner and payout fields when a loaded wallet holds the node keys, but this MCP preflight rejects that request before dispatching the backend. A wallet-only load through standalone MCP or `det-cli` therefore still requires a pasted owner or payout key, creating different behavior from the GUI path. Relax this preflight and update the parameter documentation so wallet-held keys are a supported MCP load mode, or explicitly document and enforce that this feature is GUI-only.
…h platform-wallet A wallet that registered a masternode holds its owner and voting keys in its DIP-3 provider accounts and its payout key in its funding accounts. Loading such a node no longer needs those keys pasted: - new wallet_backend::masternode seam finds the keys seedlessly through upstream platform-wallet (masternode_withdrawal_keys for owner/payout, derive_provider_key_at_index for voting), on the blocking pool, and returns derivation references only - load_identity fills blank owner/payout/voting fields with those references (PrivateKeyData::AtWalletDerivationPath, no vault copy); typed keys win and a merge never replaces a stored key - withdrawals signed with a wallet-held OWNER/TRANSFER key go through PlatformWallet::masternode_withdraw with DetSigner in a JIT seed session; hand-entered keys keep the existing SDK path - typed MasternodeWithdrawalFailed / MasternodeWithdrawalUnconfirmed errors (the latter tells the user not to retry blindly) - node key references are kept out of the public-key wallet path that determine_wallet_info reads, so a node is never filed as one of the wallet's own identities at a bogus index - design doc 02-ux-spec §4c and US-6 corrected; user stories MN-013 (implemented) and MN-014 unban (gap, follow-up PR) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit cff5863)
…rence fallback The KeyStorage wallet-info fallback only fills a missing wallet path; a key whose public key records one keeps it, and a user identity's wallet and identity index are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit fd4780f)
A merge skipped wallet discovery for any role the node already stored a key for, even when the network had since disabled or replaced that key. After an owner or payout key rotation the new key was then never found, and a withdrawal had no usable key. A stored main-identity key now counts only while the freshly fetched identity still holds it, active, for that purpose. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
… the fetch fails A voting key found in a wallet is optional, but a network error or timeout while fetching its voter identity failed the whole load. The node now loads without that key, with a warning in the log. A typed voting key still fails the load as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
One wallet that could not be inspected ended discovery for every wallet and dropped what earlier wallets had found; it is now skipped with a warning. A voting key past index 19 was never found; the scan now covers the wallet's whole voting pool, with 20 indices as the floor, like upstream's owner scan. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
The failure covers network, nonce and signing problems as well as bad input, and an owner-key withdrawal has no destination to check. Ask the user to wait and retry, and to check the amount if it keeps failing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
The load form comment said node keys are never wallet-derived, and MN-013 did not say that det-cli and MCP loads still need a typed owner or payout key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
fd4780f to
84c38ac
Compare
|
Waiting for bot review — coderabbitai skipped after its own rate limit · 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 2 only (no Phase 1 for this repository)
The wallet-held key discovery and withdrawal integration is generally sound, and the supplied CI checks are green. However, owner/payout rotation can leave stale retained key metadata ahead of the newly discovered key, causing the withdrawal screen to select a key that the refreshed identity rejects; voting-key rotation and the MCP wallet-only entry point also remain incomplete.
🔴 1 blocking | 🟡 2 suggestion(s)
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: Allow wallet-only masternode loads through the MCP entry point
src/mcp/tools/masternode.rs:147-152
The MCP load tool still calls require_at_least_one_signing_key before dispatching the backend task. Consequently, a masternode whose owner and payout keys are held by a wallet loaded in Dash Evo Tool cannot be loaded through masternode_identity_load or the CLI, even though the shared backend task now supports wallet discovery when key fields are blank. Remove this preflight restriction and enforce success after discovery by validating that the backend found at least one usable signing key, or provide equivalent wallet-only discovery in this entry point.
source: gpt-6.1-sol (phase2-reviewer: general, 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: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — This is a large, intricate change that modifies wallet-held private-key discovery, signing, key storage references, and masternode withdrawals in src/wallet_backend/masternode.rs and src/backend_task/identity/withdraw_from_identity.rs, directly affecting key handling and funds movement. - Phase 1 reviewers: not run (disabled for this repository)
- 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— rust-quality (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 `src/backend_task/identity/load_identity.rs`:
- [BLOCKING] src/backend_task/identity/load_identity.rs:227-255: Refresh retained node-key metadata after a key rotation before choosing a withdrawal key
The rotation guard now allows wallet discovery when a stored main-identity key is no longer active, but the subsequent merge still preserves the old `QualifiedIdentityPublicKey` unchanged through `merge_existing_keys_into`. The retained copy therefore still appears active because its local `disabled_at` metadata is stale, while the newly discovered replacement is added alongside it. `available_withdrawal_keys` and `default_withdrawal_key` inspect the stored public-key metadata, so the withdrawal screen can preselect the stale key. The withdrawal task then refreshes the identity and rejects that explicitly selected old key in `resolve_withdrawal_signing_key`, causing the normal owner-only or payout-key withdrawal flow to fail after rotation. Retain the old private material if needed, but make active-key selection use the refreshed identity metadata or refresh retained key metadata during the merge.
- [SUGGESTION] src/backend_task/identity/load_identity.rs:238-243: Do not suppress wallet discovery for a stale stored voting key
The rotation check only consults the freshly fetched main identity. For `PrivateKeyOnVoterIdentity`, the `target != PrivateKeyOnMainIdentity` branch makes the predicate true for any stored voting key without comparing it to the current voter identity or current masternode-list voting hash. During a merge after voting-key rotation, `want_voting` is therefore false, so the loader never searches wallets for the replacement and preserves the old voter identity and key. A wallet-held replacement voting key remains undiscovered until the user enters it manually. Stored voter keys should not suppress fresh voting-key discovery, or the check must validate them against the current voter identity.
In `src/mcp/tools/masternode.rs`:
- [SUGGESTION] src/mcp/tools/masternode.rs:147-152: Allow wallet-only masternode loads through the MCP entry point
The MCP load tool still calls `require_at_least_one_signing_key` before dispatching the backend task. Consequently, a masternode whose owner and payout keys are held by a wallet loaded in Dash Evo Tool cannot be loaded through `masternode_identity_load` or the CLI, even though the shared backend task now supports wallet discovery when key fields are blank. Remove this preflight restriction and enforce success after discovery by validating that the backend found at least one usable signing key, or provide equivalent wallet-only discovery in this entry point.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… state on merge After an owner or payout key rotation, a merge carried the replaced key over with its stored (still active) state, so the withdrawal screen could preselect a key the refreshed identity rejects. A carried-over main-identity key now takes the fetched identity's state; its private material is kept. A stored voting key also suppressed wallet discovery even after the voting key rotated. It now counts only while it hashes to the voting key the masternode list records. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… wallet The tool rejected a load with neither an owner nor a payout key before the backend could look them up in this device's wallets. Blank keys now go to the backend; the tool fails after the load only when the node ends up with no owner or payout key to withdraw with. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… flags A load that stored the node and then returned an error misled the caller. The tool now returns the loaded node with `withdrawals_available` and, when neither an owner nor a payout key is on this device, a note saying how to enable withdrawals, matching the GUI. `NoSigningKey` is no longer used and is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Waiting for bot review — coderabbitai not yet · thepastaclaw ✓. Wait for the missing reviews, or a writer can post |
|
mcp/tools/masternode.rs:147: Fixed in bedec80. Blank keys now reach the backend's wallet lookup. When the loaded node has neither an owner key nor a payout key on this device, the tool still returns it, with 🤖 Co-authored by Claudius the Magnificent AI Agent |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 2 only (no Phase 1 for this repository)
The PR correctly adds seedless wallet-key discovery, rotation-aware main-identity key handling, and wallet-backed withdrawal routing. Four non-blocking issues remain: stale voter state can be restored after a detected voting-key rotation, restored high-index owner keys may not re-resolve because their derivation index is discarded, unavailable registered wallets are silent, and the new fund-moving withdrawal seam lacks deterministic execution coverage. Test Suite and Clippy are still queued for this head.
🟡 4 suggestion(s)
1 finding(s) not shown inline (the lines are not part of this PR's diff)
🟡 Suggestion: Do not restore a stale voter identity after a detected voting-key rotation
src/backend_task/identity/load_identity.rs:72-73
When the masternode list reports a voting hash different from the stored voting key, the loader correctly performs wallet discovery. However, if no replacement is found, or if fetching the replacement voter identity fails, the freshly built identity has no voter state and no new voter key. merge_existing_keys_into then unconditionally restores existing.associated_voter_identity and the retained PrivateKeyOnVoterIdentity entry. The loaded node can therefore still appear voting-ready and attempt to vote with the old voter identity even though the masternode list says that key is no longer current. Clear the retained voter state and voter key when a rotation is confirmed and no replacement was loaded, or make the merge conditional on the stored voter key matching the current voting hash.
source: gpt-6.1-sol (phase2-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: rust-quality); reviewer 3: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — This large, intricate diff changes wallet-held private-key discovery, signing, key storage references, and masternode withdrawal behavior in src/wallet_backend/masternode.rs and related identity-loading and withdrawal code, directly affecting key handling and funds movement. - Phase 1 reviewers: not run (disabled for this repository)
- 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— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (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 `src/backend_task/identity/load_identity.rs`:
- [SUGGESTION] src/backend_task/identity/load_identity.rs:72-73: Do not restore a stale voter identity after a detected voting-key rotation
When the masternode list reports a voting hash different from the stored voting key, the loader correctly performs wallet discovery. However, if no replacement is found, or if fetching the replacement voter identity fails, the freshly built identity has no voter state and no new voter key. `merge_existing_keys_into` then unconditionally restores `existing.associated_voter_identity` and the retained `PrivateKeyOnVoterIdentity` entry. The loaded node can therefore still appear voting-ready and attempt to vote with the old voter identity even though the masternode list says that key is no longer current. Clear the retained voter state and voter key when a rotation is confirmed and no replacement was loaded, or make the merge conditional on the stored voter key matching the current voting hash.
In `src/wallet_backend/masternode.rs`:
- [SUGGESTION] src/wallet_backend/masternode.rs:214-217: Preserve the stored owner-key index for upstream re-resolution
The discovery path stores the complete `WalletDerivationPath`, but `wallet_masternode_withdrawal` retains only the wallet seed hash and `MasternodeWithdrawal` retains only key hashes. The withdrawal lookup therefore always passes `None` for `owner_key_index_hint`. The pinned platform-wallet API documents this hint specifically for restored wallets whose provider-owner pool has no watermark or whose key is above the default scan window. A previously discovered high-index owner key can consequently fail to resolve after wallet restoration even though its local derivation reference is still correct. Propagate the stored owner derivation index through the withdrawal route and pass it to `masternode_withdrawal_keys`; the upstream implementation verifies the hinted key before using it.
- [SUGGESTION] src/wallet_backend/masternode.rs:119-121: Log registered wallets that disappear before key inspection
The registered-wallet map is snapshotted before asynchronous inspection, so a wallet can be removed or fail to finish loading before `get_wallet` runs. This branch silently skips it, unlike the subsequent `wallet_held_keys` error branch, making a missing wallet indistinguishable from a wallet that simply does not hold the node key. Add a warning containing the seed and wallet identifiers before continuing so best-effort discovery remains diagnosable.
- [SUGGESTION] src/wallet_backend/masternode.rs:157-187: Add regression coverage for wallet-backed withdrawal request marshalling
The tests exercise seedless key discovery, model-level routing, wire-hash reversal, and error classification, but no test executes `WalletBackend::masternode_withdraw`. That method is the fund-moving boundary combining wallet re-resolution, payout-script construction, owner-versus-transfer request mapping, destination handling, secret-session scope, and the upstream invocation. Add deterministic mocked-SDK/backend coverage for owner and transfer requests, including the owner destination restriction and the unconfirmed-error mapping, so regressions in this boundary cannot pass while only the pure helpers remain covered.
|
Ready for review — files with no dedicated owner: lklimek. |
|
Waiting for bot review — coderabbitai not yet · thepastaclaw requested changes — dismiss the review or push a fix. 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 2 only (no Phase 1 for this repository)
Most earlier findings are fixed or superseded, but two correctness issues remain: an in-flight top-up can undo retired-key removal, and GUI withdrawal selection still offers unavailable wallet references. The key-absence E2E fixtures also remain dependent on the operator's wallet contents. Static verification only; current Clippy passed, while Test Suite remains pending.
🔴 2 blocking | 🟡 1 suggestion(s)
2 finding(s) not shown inline (the lines are not part of this PR's diff)
🔴 Blocking: Do not let in-flight whole-record writes restore removed voting keys
src/backend_task/identity/mod.rs:1115-1120
The withdrawal edit fixes that caller, but the new retirement operation can still be undone by this top-up completion. identity_credits_topup_from_platform accepts a locally stored node without requiring identity-wallet ownership and dispatches TopUpIdentityFromPlatformAddresses. This task retains its original QualifiedIdentity across the network call, then writes that entire snapshot here. If retirement completes during the call, the write restores the removed voter association and key placement; it can also overwrite the replacement voting key discovered after removal. update_local_qualified_identity_observed reconciles the balance but does not merge the key inventory, and already-vaulted entries are serialized without checking whether their deleted secrets still exist. Although the writer predates this PR, durable removal and replacement are new feature behavior that depends on it. Apply balance-only changes through edit_local_qualified_identity_observed and add a top-up-completion-after-retirement regression. Deferring the remaining race requires a linked tracking issue covering it; the landed #1110 balance-watermark changes do not resolve this writer.
source: gpt-6.1-sol (phase2-reviewer: general)
🔴 Blocking: Apply the obtainable-key predicate to GUI withdrawal selection
src/model/qualified_identity/mod.rs:1239-1246
signable_withdrawal_keys correctly excludes references to absent wallets, but default_withdrawal_key and can_attempt_withdrawal still use available_withdrawal_keys. Load a node with a hand-entered owner key and a wallet-referenced payout key, remove the payout wallet, and reopen the node. The stored node and reference survive, but the GUI still prefers the unavailable payout key over the usable owner key. WithdrawalScreen submits that selection as Some(selected_key.id()), so backend resolution rejects it rather than falling back to the owner. With only an unavailable reference, the withdrawal form also remains enabled. The key chooser in ui/helpers.rs likewise checks stored entries rather than obtainable secrets. Use the shared obtainable-key predicate for GUI defaults, gating, and withdrawal choices, while preserving references for a later wallet reload. Cover both the owner fallback and the no-obtainable-key case.
source: gpt-6.1-sol (phase2-reviewer: general)
1 carried-forward finding(s) already raised on this PR; not re-posting as new inline comments.
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — The large, intricate diff changes key discovery and wallet derivation references in src/wallet_backend/masternode.rs and signature-authorized funds movement in src/backend_task/identity/withdraw_from_identity.rs, directly affecting key handling and withdrawals. - Phase 1 reviewers: not run (disabled for this repository)
- 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— rust-quality (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 `src/backend_task/identity/mod.rs`:
- [BLOCKING] src/backend_task/identity/mod.rs:1115-1120: Do not let in-flight whole-record writes restore removed voting keys
The withdrawal edit fixes that caller, but the new retirement operation can still be undone by this top-up completion. `identity_credits_topup_from_platform` accepts a locally stored node without requiring identity-wallet ownership and dispatches `TopUpIdentityFromPlatformAddresses`. This task retains its original `QualifiedIdentity` across the network call, then writes that entire snapshot here. If retirement completes during the call, the write restores the removed voter association and key placement; it can also overwrite the replacement voting key discovered after removal. `update_local_qualified_identity_observed` reconciles the balance but does not merge the key inventory, and already-vaulted entries are serialized without checking whether their deleted secrets still exist. Although the writer predates this PR, durable removal and replacement are new feature behavior that depends on it. Apply balance-only changes through `edit_local_qualified_identity_observed` and add a top-up-completion-after-retirement regression. Deferring the remaining race requires a linked tracking issue covering it; the landed #1110 balance-watermark changes do not resolve this writer.
In `src/model/qualified_identity/mod.rs`:
- [BLOCKING] src/model/qualified_identity/mod.rs:1239-1246: Apply the obtainable-key predicate to GUI withdrawal selection
`signable_withdrawal_keys` correctly excludes references to absent wallets, but `default_withdrawal_key` and `can_attempt_withdrawal` still use `available_withdrawal_keys`. Load a node with a hand-entered owner key and a wallet-referenced payout key, remove the payout wallet, and reopen the node. The stored node and reference survive, but the GUI still prefers the unavailable payout key over the usable owner key. `WithdrawalScreen` submits that selection as `Some(selected_key.id())`, so backend resolution rejects it rather than falling back to the owner. With only an unavailable reference, the withdrawal form also remains enabled. The key chooser in `ui/helpers.rs` likewise checks stored entries rather than obtainable secrets. Use the shared obtainable-key predicate for GUI defaults, gating, and withdrawal choices, while preserving references for a later wallet reload. Cover both the owner fallback and the no-obtainable-key case.
In `tests/backend-e2e/identity_masternode_withdraw.rs`:
- [SUGGESTION] tests/backend-e2e/identity_masternode_withdraw.rs:150-157: Isolate key-absence E2E scenarios after switching loads to merge semantics
(existing thread: https://github.com/dashpay/dash-evo-tool/pull/1109#discussion_r4457765099)
`Overwrite` removes contamination from earlier loads, but it does not establish the key-absence precondition. For node identities, `load_identity` searches registered wallets for blank owner fields regardless of load mode; `derive_keys_from_wallets: false` disables only user-identity matching. The shared harness registers the operator-provided framework wallet, and the documented setup does not require that wallet to be unrelated to `E2E_MN_PROTX_HASH`. If it holds the node's owner key—the scenario introduced by this feature—mn016, mn019, and mn054 still discover it and fail their owner-key-absence assertions despite correct application behavior. Isolate wallet-discovery state for these cases or explicitly verify a nonmatching wallet fixture independently of record-overwrite mode.
Top-ups and credit transfers wrote their whole pre-network snapshot back, so a retired voting key removed while they ran came back. They now set only the balance on the current record, and a failed save after the paid task is logged instead of reported as a failed task. The unused whole-snapshot balance writer is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The withdrawal screen's default key and the withdraw button's gate now skip a key held by a wallet that is no longer loaded, so an owner key typed by hand is pre-selected instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Key-absence cases now fail with setup guidance when a harness wallet holds the node's owner key, since a load fills a blank owner field from any loaded wallet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Re latest review-body findings: Do not let in-flight whole-record writes restore removed voting keys (top-up) (FIXED): Agreed, and fixed for every paid-balance writer, not just this one. Top-up from Platform addresses ( Apply the obtainable-key predicate to GUI withdrawal selection (FIXED): Agreed for the default and the gate. 🤖 Co-authored by Claudius the Magnificent AI Agent |
|
Waiting for bot review — coderabbitai not yet · thepastaclaw requested changes — dismiss the review or push a fix, 1 thread unresolved — resolve it. 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 2 only (no Phase 1 for this repository)
Static verification of e90c2e2 found one blocking balance-ordering regression and two non-blocking issues concerning cache notifications and wallet-backed withdrawal coverage. All 22 prior findings were revalidated: 17 are fixed, three remain withdrawn, one is outdated, and the withdrawal integration-coverage finding remains valid. Current-head Clippy passed; Test Suite was still pending when checked, and no local builds or tests were run.
🔴 1 blocking | 🟡 2 suggestion(s)
1 carried-forward finding(s) already raised on this PR; not re-posting as new inline comments.
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-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: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — The large, intricate diff directly changes key discovery and storage references in src/backend_task/identity/load_identity.rs and withdrawal signing and funds movement in src/wallet_backend/masternode.rs::masternode_withdraw. - Phase 1 reviewers: not run (disabled for this repository)
- 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— rust-quality (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort xhigh); agentphase2-reviewer,gpt-6.1-sol— rust-quality (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 `src/backend_task/identity/withdraw_from_identity.rs`:
- [BLOCKING] src/backend_task/identity/withdraw_from_identity.rs:120-123: Preserve the withdrawal proof height on the wallet-backed path
The wallet-backed route regresses the balance ordering preserved by the existing SDK route. With a stored watermark at height 100, a refresh can fetch the pre-withdrawal balance at height 101, then save after a withdrawal confirmed at height 102. ConfirmedUnordered stores the withdrawn balance at the old watermark height, so reconcile_balance subsequently accepts the delayed height-101 refresh and restores credits already withdrawn. That incorrect balance is then available to the withdrawal screen's maximum calculation. The documented top-up limitation does not make this equivalent to the base withdrawal behavior, which stores metadata.height. Fix the owning platform-wallet boundary to expose the withdrawal proof metadata, then propagate its height here as ObservedAt. Both the pinned and default upstream implementations currently discard that metadata, although the SDK provides wait_for_affected_state_with_metadata. Add a regression that saves a pre-withdrawal refresh after a successful wallet-backed withdrawal.
In `src/backend_task/identity/mod.rs`:
- [SUGGESTION] src/backend_task/identity/mod.rs:1023-1024: Publish an identity-cache change after retired-key cleanup
RemoveRetiredVotingKey deletes voting-key placements and potentially a separate voter record, then can install a replacement through its internal reload, but neither this dispatch arm nor the called operations publishes CacheDomain::Identities. The originating Masternodes screen reloads on completion; other open screens do not receive that result. For example, opening Key Info while the post-removal wallet lookup awaits network work gives that screen the detail view's old identity clone, which continues reporting the retired key as held after cleanup completes. KeyInfoScreen already handles identity-cache notifications by reloading its identity and key placement. Follow the project's cache-update contract by calling notify_cache_changed after successful removal and reconciliation, and cover completion while a non-origin Key Info screen is open.
In `src/wallet_backend/masternode.rs`:
- [SUGGESTION] src/wallet_backend/masternode.rs:201-208: Add regression coverage for wallet-backed withdrawal request marshalling
(existing thread: https://github.com/dashpay/dash-evo-tool/pull/1109#discussion_r4405934716)
The extracted request tests now cover owner/payout mapping, and the wired-backend test executes this adapter, but its owner-with-destination request is rejected upstream before identity fetching or DetSigner invocation. The backend E2E tests do not supply the remaining integration coverage: test_mn050_owner_withdraw_to_payout and test_mn051_transfer_withdraw_to_address explicitly load their signing private keys, so typed-key precedence routes both through the legacy SDK branch. Consequently, no test exercises the new composition of wallet re-resolution, the held HD-secret session, actual signing, and confirmed or unconfirmed completion. Add deterministic mocked-SDK coverage that executes owner and payout withdrawals through this adapter past signing, verifies the submitted transition's signing key and destination, and checks successful and unconfirmed outcomes.
…d voting key Other open screens, such as Key Info, now reload the node once its old voting key is removed, instead of still showing the key as held. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Waiting for bot review — coderabbitai skipped after its own rate limit · thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
Re thepastaclaw review at e90c2e2 — Add regression coverage for wallet-backed withdrawal request marshalling: Unit tests cover the request mapping, and the wired adapter test covers the refusal before broadcast. Mocking signing and submission end to end would need a mocked SDK behind upstream 🤖 Co-authored by Claudius the Magnificent AI Agent |
Dismissed by maintainer decision: the remaining blocker (withdrawal proof height on the wallet-backed path) needs platform-wallet's masternode_withdraw to return the proof height; accepted as a documented known limitation (no funds at risk). See discussion_r on PRRT_kwDOM8GK3c6zmjoF.
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 2 only (no Phase 1 for this repository)
Verified the Phase-2 findings and all 24 prior findings against head 79980b9 and the relevant upstream sources. The identity-cache notification is fixed, but two blockers remain: wallet-backed withdrawals lose balance-proof ordering, and retired-key removal can delete a current key using a list observation retained across a record-lock wait. This was static verification only; current Clippy and Platform pin guard checks pass, while Test Suite remains pending.
🔴 2 blocking | 🟡 1 suggestion(s)
3 carried-forward finding(s) already raised on this PR; not re-posting as new inline comments.
Review provenance
Source: reviewer 1: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.1-sol (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
criticalbygpt-6.1-sol(effort low) — This large, intricate change directly modifies key discovery and storage references in src/backend_task/identity/load_identity.rs and withdrawal signing and funds movement in src/wallet_backend/masternode.rs and src/backend_task/identity/withdraw_from_identity.rs. - Phase 1 reviewers: not run (disabled for this repository)
- 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— rust-quality (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 `src/backend_task/identity/withdraw_from_identity.rs`:
- [BLOCKING] src/backend_task/identity/withdraw_from_identity.rs:120-123: Preserve the withdrawal proof height on the wallet-backed path
(existing thread: https://github.com/dashpay/dash-evo-tool/pull/1109#discussion_r4467833337)
The wallet-backed route replaces the existing withdrawal's height-tagged balance with `ConfirmedUnordered`, which breaks the balance watermark's ordering guarantee. With a stored watermark at height 100, a refresh can fetch the pre-withdrawal balance at 101, the withdrawal can confirm at 102 and save first, and the delayed refresh can then restore the already-withdrawn credits because the watermark remains at 100. The reverse completion order is also unsafe: a delayed withdrawal result can overwrite a newer balance already observed at 104 while retaining the height-104 watermark, preventing another observation at that height from repairing it. The fresh-record edit preserves concurrent key changes but does not address either balance race. Both pinned and default `dashpay/platform` implementations return only `u64` from `PlatformWallet::masternode_withdraw`; expose the withdrawal proof height at that owning upstream boundary, propagate it here as `ObservedAt`, and cover both completion orderings. The documented top-up limitation does not justify removing ordering that the base withdrawal path already provided.
In `src/backend_task/identity/retired_voting_key.rs`:
- [BLOCKING] src/backend_task/identity/retired_voting_key.rs:177-180: Revalidate the voting-list hash after acquiring the identity record
(existing thread: https://github.com/dashpay/dash-evo-tool/pull/1109#discussion_r4416358938)
The fingerprint check prevents a changed stored key from being judged by the earlier list, but it does not detect a changed list when the stored key stays the same. This window can include a substantial lock wait: `finish_identity_load_storage` holds the same record mutex through protected-key verification and vault writes, and a preserving reload need not change `StoredVotingKeys`. If the record stores B, the list read still names A, and the list catches up to B while removal waits, the fingerprint comparison succeeds and `retired_voting_keys(&node, A)` deletes B's vault secret even though the available list now names B as current. Removal accepts hand-entered `InVault` keys too, so derivation-based recovery is not guaranteed. Do not await an asynchronous list query under the synchronous guard; instead invalidate or revalidate the observation across contention, for example by refusing a contended acquisition and restarting validation, or by using an upstream generation-tagged snapshot checked at the destructive decision. Add a regression where the list changes during the wait without changing the stored voting fingerprint.
In `src/wallet_backend/masternode.rs`:
- [SUGGESTION] src/wallet_backend/masternode.rs:201-208: Add regression coverage for wallet-backed withdrawal request marshalling
(existing thread: https://github.com/dashpay/dash-evo-tool/pull/1109#discussion_r4405934716)
The extracted request tests verify owner/payout field mapping, and the wired owner-destination test reaches the upstream refusal, but that refusal occurs before the derived signer is used. The unconfirmed-outcome test also fabricates an upstream error and calls the mapper directly rather than obtaining it from the wallet future inside this secret session. Consequently, the tests do not cover the adapter's signed-completion boundary: an incorrectly constructed `DetSigner`, or broken propagation of a post-broadcast result-wait failure, can pass the existing checks. Add deterministic mocked-SDK tests that execute owner and payout withdrawals through signing and successful completion, plus a result-wait failure that returns `MasternodeWithdrawalUnconfirmed` through `WalletBackend::masternode_withdraw`. These checks do not require a live funded withdrawal.
Dismissed by maintainer decision: both blockers are carried-forward findings already decided — withdrawal proof height (accepted as a documented known limitation, #1109 (comment)) and voting-list hash revalidation (rejected by the maintainer, #1109 (comment)). No new findings on 79980b9.
|
@thepastaclaw review No review for |
|
Ready for review — files with no dedicated owner: lklimek. |
TL;DR: If you registered your masternode from a wallet loaded in Dash Evo Tool, you no longer need to paste its owner, voting or payout keys. The app finds them in that wallet and stores only a pointer to them. Withdrawals signed with those keys use the wallet library's own masternode withdrawal, which checks the key and the payout-address rule before sending. Nodes registered from another wallet work as before.
User story
As a masternode operator, I want Dash Evo Tool to recognise the node keys that my own wallet holds, so that I can load my node and withdraw its earnings without copying private keys around.
Scenario
Actual behavior
Loading a masternode or evonode always requires typing the owner, voting and payout private keys, even when the wallet that registered the node is loaded in the app.
Expected behavior
Blank key fields are filled from a loaded wallet that holds the node's keys, and no key is copied into storage. Keys you type still take precedence. Withdrawals signed by such a key go through the wallet library; hand-entered keys keep the existing path. When the node's voting key has been rotated, the node page says so and offers to remove the old voting key after you confirm; the app never removes it on its own.
Detailed discussion
Based on
v1.0-dev(Platform v5.1-dev575d961f). This replaces #1109, whose branch carried the #1015 remainder; this branch holds only that PR's two commits, cherry-picked with-x.src/wallet_backend/masternode.rs):find_masternode_wallet_keysasks each registered wallet for the node's keys, without the seed and insidespawn_blocking. Owner and payout keys come from upstreammasternode_withdrawal_keys. Voting keys come fromderive_provider_key_at_index, over the wallet's whole voting pool (at least 20 indices, like upstream's owner scan). The results are wallet derivation paths only.masternode_withdrawre-resolves the keys and callsPlatformWallet::masternode_withdrawwith DET's signer, inside a secret session.src/model/masternode_keys.rs): the owner and payout hashes come from the node identity's active OWNER and TRANSFER keys. The withdrawal role comes from the key's purpose.PrivateKeyData::AtWalletDerivationPath.det-clior MCP) merges into the stored node instead of replacing its keys. Typed keys still replace the one they match, and a password-protected node fails closed.masternode_voting_key_hashreads sync progress, then the list, then progress again, and returns a hash only when the list is at the tip by both readings.TODO(upstream): an atomic, height-tagged list snapshot.backend_task/identity/retired_voting_key.rs,ui/state/retired_voting_key.rs, the masternode detail view):TaskError::VotingKeyCheckUnavailablewhile the list is updating). A reload that changed the stored voting keys since before that read refuses the removal (TaskError::VotingKeyChangedDuringRemoval) and nothing is removed. Otherwise, under the identity's record lock, recomputes the retired keys on the fresh record. A key that is current again is kept (RetiredVotingKeyKept). Otherwise it deletes the old key's vault secret through the secret seam, then the key and its voter identity.masternode_withdraw.TaskError::MasternodeWithdrawalFailedandMasternodeWithdrawalUnconfirmed. The second tells the user not to retry blindly.determine_wallet_infocannot file a node into the wallet's identity list at a bogus index.Known limitations
masternode_withdrawreturns no proof height to pin it with (TODO(platform-wallet)atwithdraw_from_identity.rs). Platform rejects any withdrawal above the real balance, so no funds are at risk.ui/helpers.rs, used by every transaction type) still lists a key whose wallet is no longer loaded. Choosing it shows a clear "no usable key" message and nothing is sent; the withdrawal screen's default key and gate use only keys this app can sign with.m/9'/c'/3'/{1',2'}/i'). DIP-9 and platform-wallet use non-hardened indices. These addresses exist in memory only and never receive funds, but they show in the address and account views. Fixing the bootstrap is a follow-up.MasternodeWithdrawalFailed, which asks the user to wait and retry.masternode_withdrawreturns the credits without a block height. A refresh in flight during such a withdrawal can restore the balance from before it until the next refresh. A top-up has the same limit.det-clior MCP still needs a typed owner or payout key.Testing
cargo clippy --all-features --all-targets -- -D warningsis clean;identity_masternode_withdraw(needs live funds). No live withdrawal was made.🤖 Co-authored by Claudius the Magnificent AI Agent
🤖 Generated with Claude Code
https://claude.ai/code/session_012ujJpB9DBhvtbjhYB3aG9Q
PR Hygiene ·
79980b9docs/CLI.md,docs/MCP.md,docs/ai-design/2026-07-09-masternode-page-design/01-requirements.mdand 29 more) — lklimekWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.Summary by CodeRabbit