Repository navigation
fix(dashmate): stop masternodes safely around DKGs on Core 24 - #5841
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 2 minutes. View limit details
Walkthrough
Merge Risk:
|
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
⛔ Final review complete — 1 blocking finding(s) (commit 140b310) · triage: normal |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
Verified the findings against head aba4078 and the relevant Dash Core sources. Three blocking issues remain: delayed session initialization can permit an unsafe stop, confirmation does not detect higher-tip reorganizations, and local group restart --safe can deadlock after stopping the miner. Current code checks pass, including Dashmate tests, linting, and all three Dashmate E2E jobs; this verification was static and ran no builds or tests.
🔴 3 blocking | 🟡 2 suggestion(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: security-auditor); reviewer 5: gpt-6.1-sol (agent: phase2-reviewer, role: general); reviewer 6: gpt-6.1-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 7: gpt-6.1-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.1-sol(effort low) — This is a large, intricate dashmate control-flow change affecting masternode shutdown safety, DKG timing, RPC consistency, retries, and confirmation behavior, but it does not modify consensus, funds, cryptography, signatures, peer-facing deserialization, or storage migrations. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (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) - Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort high); 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 are optional: fix them forward in a later PR rather than pushing another round just for them.
- Address every current finding in one push: self-review the full diff first, and don't push piecemeal.
- 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/dashmate/src/core/quorum/checkMasternodeSafeToStop.js`:
- [BLOCKING] packages/dashmate/src/core/quorum/checkMasternodeSafeToStop.js:143-145: Do not treat the confirmation delay as proof of session initialization
A plain stop or fresh --safe invocation beginning in Core's session-record gap has no remembered announcement. On Core older than 24.1, both evaluations can see active_dkgs=0, next_dkg=24, and an empty session list at a non-rotated start height, and therefore permit stopping after 15 seconds. Core resets the debug record before initializing the new session and publishing its membership record; that work has no 15-second completion guarantee. The new wait-loop test explicitly models this gap lasting longer than the confirmation delay, but avoids the failure only because polling began before the start block. Keep an unobserved current-session window conservative unless participation or initialization completion can be established, and add a regression that starts directly in the empty-record gap and keeps it empty beyond the delay.
- [BLOCKING] packages/dashmate/src/core/quorum/checkMasternodeSafeToStop.js:147-149: Verify ancestry when the confirming tip is higher
The hash comparison detects replacement of the first tip only when both snapshots have the same height. A reorganization that replaces that tip and finishes one to six blocks higher passes this condition. For example, the first snapshot can predict non-membership before a DKG starts, while the replacement branch changes its work block and reaches the start block shortly before confirmation. On Core 24.0, the new member session may not yet have a debug record, so the second evaluation can report safe without the promised initialization interval on the replacement branch. Read the active-chain hash at first.height within the confirming snapshot's consistency checks and return unsettled if it differs from first.hash. Add coverage for a replacement branch with a higher final tip.
- [SUGGESTION] packages/dashmate/src/core/quorum/checkMasternodeSafeToStop.js:40-47: Allow the IBD exemption when the tip advances between reads
The tip-hash rejection runs before evaluate can apply the initial-block-download exemption. When an IBD node advances between the bracketing reads, the snapshot is discarded even if both reads report initialblockdownload=true. Plain stop can exhaust all three attempts and reject a node that is safe to stop, while --safe continues polling until it gets a stable read or synchronization finishes. Core's DKG manager returns without processing tip updates during IBD, so DKG snapshot consistency is unnecessary when both bracketing reads confirm that state. Preserve that exemption across tip movement and add coverage with IBD true on both reads and different tip hashes.
In `packages/dashmate/src/commands/group/restart.js`:
- [BLOCKING] packages/dashmate/src/commands/group/restart.js:11-15: Coordinate safe group restart with local miner shutdown
Making --safe effective exposes a deadlock on the standard local network. The stop tasks run sequentially over configGroup.reverse(), stopping local_seed first. That node hosts the detached mining loop started by startGroupNodesTaskFactory. If a remaining masternode is blocked by an imminent or active DKG at that height, waitForDKGWindowPass cannot finish because block production has stopped, and the subsequent task that restarts the miner is unreachable. The parser test does not exercise execution, and the local-network E2E restart forces its stops. Coordinate safety waiting and miner shutdown at group level so a height-dependent wait cannot begin after mining has stopped, and cover a restart at an imminent-DKG height.
In `packages/dashmate/src/core/quorum/getDkgStopBlockers.js`:
- [SUGGESTION] packages/dashmate/src/core/quorum/getDkgStopBlockers.js:284-287: Track the remaining local-session reporting gap in Dash Core
Link an upstream issue or PR for the specific lifecycle gap behind this fallback. Current Core clears the active manager's proTxHash after a service-address change when reinitialization cannot accept the new address, while an existing DKG session retains its own myProTxHash. quorum dkginfo computes active_dkgs only when the current proTxHash is non-null, so it can report zero despite an outstanding local session. The linked dashpay/dash#7812 fixes membership-based counting but explicitly retains zero for calls without a proTxHash; it does not resolve this case. Keeping compatibility handling here is reasonable, but the missing authoritative local-activity capability belongs in Dash Core. Track an owner-side repair that accounts for unexpired locally owned sessions, with a functional test for a service update during DKG.
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
|
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 |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 1 + Phase 2
This head still contains an unsafe-stop path for older Core versions: advancing one block beyond an unrecorded DKG start is treated as evidence that the session is irrelevant. It also introduces stale cross-poll membership evidence across reorgs and applies the local-miner exemption to unrelated networks. Dashmate tests, lint, and builds passed in the supplied CI snapshot; local-network E2E and broader suites were still pending.
🔴 3 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: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.1-sol(effort low) — This is a large and intricate dashmate safety-logic change involving DKG timing, Core-version behavior, reorg handling, confirmation races, and command integration, but it does not modify consensus, funds movement, cryptography, or another critical surface listed for the critical tier. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (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) - Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort high); 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 are optional: fix them forward in a later PR rather than pushing another round just for them.
- Address every current finding in one push: self-review the full diff first, and don't push piecemeal.
- 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/dashmate/src/core/quorum/getDkgStopBlockers.js`:
- [BLOCKING] packages/dashmate/src/core/quorum/getDkgStopBlockers.js:299-300: Do not treat the confirmation delay as proof of session initialization
The start-block guard only covers the exact height at which the session starts. If a fresh check begins at start height S with no announcement or session record, then the chain advances to S+1 while Core is still initializing membership, `pQuorumBaseBlockIndex === height` no longer matches, and the blocker disappears. With `active_dkgs === 0`, no session record, and no upcoming entry, two stable reads 15 seconds apart can authorize stopping even though Core has not established that this node is a non-member. The existing regression models this unsafe assumption by declaring that an absent record at S+1 proves non-membership. Keep an unobserved session conservative throughout the initialization window unless authoritative membership or initialization-completion evidence exists, and add a regression starting directly at S+1 with the record still absent.
In `packages/dashmate/src/core/quorum/waitForDKGWindowPass.js`:
- [BLOCKING] packages/dashmate/src/core/quorum/waitForDKGWindowPass.js:26-40: Invalidate remembered non-membership when its chain changes
`nonMemberDkgs` is retained across polls using only the LLMQ type, quorum index, and start height. `getAnnouncedNonMemberDkgs` receives Core's `workBlockHash`, but discards it when creating the key. If a reorg replaces the work block and the replacement branch selects this node as a member, the stale negative prediction still suppresses `getStartingDkgBlockers` at the replacement branch's start height. The confirming check only verifies ancestry within the replacement branch, so it cannot detect that the cached prediction originated on another branch. Preserve Core's work-block identity with the cached prediction and validate or discard it before allowing it to override the conservative start-block guard.
In `packages/dashmate/src/listr/tasks/stopNodeTaskFactory.js`:
- [BLOCKING] packages/dashmate/src/listr/tasks/stopNodeTaskFactory.js:55-57: Restrict the stopped-miner exemption to the affected local network
`ctx.isLocalMinerStopped` is shared by the entire group task, but the enabled predicates consume it for every config regardless of that config's network. Groups are selected by the configurable group name and the schema does not require all members to use the same network. Therefore, after a local miner is stopped, a later mainnet or testnet masternode in the same group skips both the DKG check and the `--safe` wait, even though stopping an unrelated local miner does not stop block production or remove DKG obligations on that public network. Scope the exemption to the coordinated local network, or have the group orchestration pass a network-specific authorization rather than using a run-wide boolean.
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
|
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 |
thepastaclaw
left a comment
There was a problem hiding this comment.
Re-review — Final validation — Phase 2 only (queue backlog)
At ff137eb, work-block validation and the post-DKG ancestor lookup address the reported IBD branch-switch orderings, while moving IBD snapshots are accepted again; two prior safety findings remain blocking. Current CI shows passing Dashmate tests, JavaScript linting, functional tests, Docker builds, and Dashmate E2E jobs, with review and PR Hygiene pending. This was a static review; no builds or tests were run locally.
🔴 2 blocking
Still open from earlier rounds (2)
- 🔴 Blocking: Keep DKG announcements anchored when accepting moving IBD snapshots —
packages/dashmate/src/core/quorum/checkMasternodeSafeToStop.js:87-95(thread) - 🔴 Blocking: Preserve member DKGs learned before confirmation enters IBD —
packages/dashmate/src/core/quorum/checkMasternodeSafeToStop.js:251-254(thread)
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: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.1-sol(effort low) — The change is intricate but modifies dashmate shutdown orchestration and DKG safety checks rather than consensus rules, funds movement, cryptography, or another qualifying critical surface. - Phase 1 reviewers: not run (skipped for throughput: 18 PRs queued, above the 10 limit)
- Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort high); 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/dashmate/src/core/quorum/checkMasternodeSafeToStop.js`:
- [BLOCKING] packages/dashmate/src/core/quorum/checkMasternodeSafeToStop.js:87-95: Keep DKG announcements anchored when accepting moving IBD snapshots
(carried; thread: https://github.com/dashpay/platform/pull/5841#discussion_r4530984956)
- [BLOCKING] packages/dashmate/src/core/quorum/checkMasternodeSafeToStop.js:251-254: Preserve member DKGs learned before confirmation enters IBD
(carried; thread: https://github.com/dashpay/platform/pull/5841#discussion_r4529658849)
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix. |
When the read confirming a safe result was discarded, as when a block
connects during it, the check came back with no height and no blockers.
`--safe` remembers DKGs only from a check with a height, so it forgot
the DKG of this node the first read announced, and could stop the node
once Core no longer showed it. Such a check now reports the first read,
unsettled, so its announced DKGs are remembered.
Test would have caught this: ✖ before, ✔ after ("should keep what a
check announced when its confirming read is discarded").
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`--safe` retries failing Core calls. A session it saw running must still block once Core comes back with no record, count or announcement of it, as Core 24.1 does when restarted before it knows its proTxHash. The loop remembers every blocker with a known range since #5841's change, carried into this branch by the restack. ✖ with the previous loop, ✔ now ("should keep blocking a running session through failed calls and a Core restart"). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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
The head fixes most previously identified safe-stop lifecycle issues, and the CI snapshot contains no failed code checks; the JavaScript and Docker builds are still queued. Two blocking safety gaps remain: record-count mismatches can discard a previously observed member DKG, and moving IBD snapshots can be accepted without proving that their announcement list covers the accepted tip.
🔴 2 blocking
Still open from earlier rounds (2)
- 🔴 Blocking: Preserve member DKGs learned before confirmation enters IBD —
packages/dashmate/src/core/quorum/checkMasternodeSafeToStop.js:191-192(thread) - 🔴 Blocking: Keep DKG announcements anchored when accepting moving IBD snapshots —
packages/dashmate/src/core/quorum/checkMasternodeSafeToStop.js:87-95(thread)
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: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.1-sol(effort low) — This is a large and intricate dashmate behavioral change involving quorum RPC interpretation, chain reorg consistency, version-dependent logic, and stop-safety timing, but it does not modify consensus, funds, cryptography, or another critical surface defined by the rubric. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (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) - Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort high); 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/dashmate/src/core/quorum/checkMasternodeSafeToStop.js`:
- [BLOCKING] packages/dashmate/src/core/quorum/checkMasternodeSafeToStop.js:191-192: Preserve member DKGs learned before confirmation enters IBD
(carried; thread: https://github.com/dashpay/platform/pull/5841#discussion_r4529658849)
- [BLOCKING] packages/dashmate/src/core/quorum/checkMasternodeSafeToStop.js:87-95: Keep DKG announcements anchored when accepting moving IBD snapshots
(carried; thread: https://github.com/dashpay/platform/pull/5841#discussion_r4530984956)
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix. |
…e confirming
When Core older than 24.1 changed its session records during the read
confirming a safe result, the check came back unsettled with no
blockers. `--safe` then forgot the DKG of this node the first read
announced, and could stop the node once Core no longer showed it. Such
a check now carries the first read's blockers.
Test would have caught this: ✖ before, ✔ after ("should keep what a
check announced when Core changes its session records during the
confirming read").
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`--safe` retries failing Core calls. A session it saw running must still block once Core comes back with no record, count or announcement of it, as Core 24.1 does when restarted before it knows its proTxHash. The loop remembers every blocker with a known range since #5841's change, carried into this branch by the restack. ✖ with the previous loop, ✔ now ("should keep blocking a running session through failed calls and a Core restart"). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
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
The new head preserves first-read DKG blockers through discarded and record-changing confirmations and validates announcement work blocks during moving IBD reads. One disputed announcement-coverage gap remains blocking, alongside a narrow version-refresh suggestion for plain-stop retries. This was a static review; current CI shows dashmate tests, JS lint, builds, and dashmate E2E tests passing, with additional test-suite jobs still pending.
🔴 1 blocking
Still open from earlier rounds (1)
- 🔴 Blocking: Keep DKG announcements anchored when accepting moving IBD snapshots —
packages/dashmate/src/core/quorum/checkMasternodeSafeToStop.js:87-95(thread)
Follow-up candidates (optional) (1)
New non-blocking observations on code unchanged since the last full review. No inline threads are opened for them and later reviews do not repeat them: fix forward or track separately if they are worth it.
🟡 Suggestion: Re-read Core version on each plain-stop retry
packages/dashmate/src/listr/tasks/stopNodeTaskFactory.js:83-92
The plain-stop retry loop reuses the version read before its first attempt. If Core is replaced between an unsettled attempt and the next attempt, the subsequent snapshot is interpreted using the previous process's rules. In particular, a replacement from 24.1 to 24.0 leaves the cached version selecting membership-based counting and disabling both the unrecorded-session fallback and confirmation, allowing an empty record gap to pass. The safe-wait loop already refreshes the version on each poll to handle replacement. Refresh it inside this retry loop as well, and cover a version change between attempts.
let check;
for (let attempt = 0; attempt < SAFE_STOP_CHECK_ATTEMPTS; attempt += 1) {
const coreVersion = await readCoreVersion(rpcClient);
check = await checkMasternodeSafeToStop(rpcClient, coreVersion);
if (check.status !== 'unsettled') {
break;
}
}
source: muse-spark-1.3-contributor (phase1-reviewer: general)
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: security-auditor); final verifier: gpt-6.1-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.1-sol(effort low) — This is a large and intricate dashmate safety-control rewrite involving DKG state, chain reorg handling, RPC consistency, version-dependent behavior, and confirmation timing, but it does not modify consensus, funds, cryptography, or another critical surface. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (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) - Code unchanged since the last final review (
148c936b): 1 new suggestion(s) listed as follow-up candidates, not posted inline - Fresh verifier:
gpt-6.1-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.1-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.1-sol— security-auditor (completed, effort high); 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/dashmate/src/core/quorum/checkMasternodeSafeToStop.js`:
- [BLOCKING] packages/dashmate/src/core/quorum/checkMasternodeSafeToStop.js:87-95: Keep DKG announcements anchored when accepting moving IBD snapshots
(carried; thread: https://github.com/dashpay/platform/pull/5841#discussion_r4530984956)
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix. |
`--safe` retries failing Core calls. A session it saw running must still block once Core comes back with no record, count or announcement of it, as Core 24.1 does when restarted before it knows its proTxHash. The loop remembers every blocker with a known range since #5841's change, carried into this branch by the restack. ✖ with the previous loop, ✔ now ("should keep blocking a running session through failed calls and a Core restart"). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Issue being fixed or feature implemented
Bottom of GitHub Stack #5847: this PR, then #5842 (Core 24 default image), then #5843 (
--safeprogress).dashmate stop,restartand their--safewait decide when stopping a masternode cannot cost it a PoSe penalty for missing DKG messages.On Core 24.0 the v5.1 rule (#5231) almost never lets a masternode stop. Once Core reports
upcoming_dkgs, the rule treats any non-zeroquorum dkginfoactive_dkgsas a running session. That rule was written for dashpay/dash#7812, which derivesactive_dkgsfrom membership. dash#7812 landed indevelopfor 24.1 and is not in v24.0.0. Core 24.0 still counts the DKG worker's session records, which linger until the next round of the same quorum type and index.On mainnet (360 evonodes, ~2195 masternodes) a masternode holds such a record about 94% of the time;
llmq_60_75records alone last ~48 h. So plainstoprefused, and--safewaited hours to days. This blocks moving dashmate's default image to Core 24 (follow-up PR).Operators also wait longer than DKGs require. A mainnet operator reported a 1 h
--safewait on an evonode under 5.0.x. Simulated over a random mainnet membership history, 5.0.x's rule makes 13.6% of evonode stops wait an hour or more (p90 ~85 min, worst ~3.7 h). Most of that comes from rotatedllmq_60_75sessions: they block for 42 blocks counted from each quorum index's own start. 42 is the cycle's shared mining window, so it was counted from the wrong base.A stop at a DKG start could pass. Core older than 24.1 records a session only after the start block connects. A check right at that block saw the previous round's stale record, or none, and said "safe".
group restart --safenever waited. Its flag was declared as a plain object, which oclif parses asfalse.What was done?
getDkgStopBlockersis now the single safety rule. It returns height ranges in which stopping is blocked; stopping is safe when none covers the chain tip. It works on Core 23, 24.0 and 24.1:upcoming_dkgs. Without that data (Core 23, or no proTxHash), any DKG starting within 6 blocks blocks, as before.quorum dkgstatus).5 × dkgPhaseBlocks), the same window Core 24.1 counts. Each rotated quorum index is measured from its own start, sollmq_60_75blocks for 10 blocks instead of 42.active_dkgsdrops to 0 while the session still runs.getnetworkinfoversion ≥ 240100): a non-zeroactive_dkgsblocks. Core's version is read over RPC, not taken from the image tag, becausedashpay/dashd:24will float to 24.1 on pull.quorum dkgstatuslists every enabled quorum with the start of its current session. Core records a session only after computing its members, with no bound on how long that takes, and until then nothing shows whether this node is a member. So a current session without a record blocks from its start until its Commit phase ends.getblockhash, read inside its snapshot), which catches a reorg that ended higher.dkginfoanddkgstatus(Core changing its records mid-read) is unsettled too.--saferemembers every DKG of this node it has seen, announced or running, until its Commit phase ends. This covers the gap at a session start where Core has erased last round's record but not yet created the new one, and a Core restarted mid-session that no longer reports the session.quorumHeight, not the tip plusblocksUntilStart.--safepoll, since Core may be replaced between polls.--safethose masternodes then waited for blocks that could never come. Once the miner is stopped, later local-network masternodes in its group skip the DKG check: every masternode goes down together, so their DKG produces no commitment to penalize them in. Configs of other networks in the same run are still checked.stopretries an unsettled check up to 3 times. It reports unreadable Core data with its own error, because--safewould wait for that forever.group restart --safenow parses as a boolean flag.With these rules on Core 24.0, the same mainnet simulation gives a mean evonode wait of ~6 min (from ~22), p90 ~28 min, and 0.9% of waits ≥ 1 h. A regular masternode outside a DKG is almost never blocked.
Cost: on Core older than 24.1, a plain stop or restart of a masternode that is safe to stop takes about 15 s longer. A plain stop also refuses during the first blocks (10, or 20 for 400-member quorums) of every DKG session Core has not recorded, members or not, because it hasn't seen the announcements.
--safedoesn't wait for sessions it saw announced without this node. Local group stops/restarts stop masternodes one at a time, so that adds up per node.The progress/ETA display for
--safecomes in a follow-up PR stacked on this one.How Has This Been Tested?
quorum dkginfo/dkgstatus, record reset and initialisation, the DKG worker and IBD; develop/24.1 for dash#7812. The LLMQ parameters come fromsrc/llmq/params.hand are pinned in tests by literal values.src/test/mock/getCoreRpcMock.js).--safe's memory of announced DKGs: its test fails with that memory removed.yarn workspace dashmate test:unit: 1092 passing, run locally.eslinton the changed files: no errors. One warning, an unusedno-consoledirective instopNodeTaskFactory.js, already existed.Breaking Changes
None. Plain stop/restart on Core older than 24.1 is ~15 s slower when it is safe to stop (see above).
Checklist:
structure.rs, regeneratedgrovedb-structure.json, and checked the structure viewer link posted on this pull requestFor repository code-owners and collaborators only
🤖 Generated with Claude Code
PR Hygiene ·
140b310/self-reviewedWhen 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
--safeoption and its-salias are parsed consistently.