Skip to content

fix: let Tenderdash restart itself during a Core-only replacement - #37

Merged
ktechmidas merged 1 commit into
mainfrom
fix/core-swap-tenderdash-restart
Nov 20, 2026
Merged

ktechmidas merged 1 commit into
mainfrom
fix/core-swap-tenderdash-restart

Conversation

@ktechmidas

@ktechmidas ktechmidas commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

A managed Core-only upgrade on a validator can fail after Core has already been replaced, and then cannot be finished.

Tenderdash exits when Core's RPC goes away, and Docker restarts it. The worker (operation_guard, assert_baseline) and the fleet check (Preserved) require every unselected service to equal the plan snapshot, including startedAt and restarts. So if a Platform block arrives while Core is away, the operation stops with preserved-service-changed. Resume runs the same comparison and fails the same way. The journal stays in applying, and Runner refuses any other plan for the network until that operation completes.

Seen on testnet on 2026-11-20, console operation 631fe5e6: two canary evonodes were healthy on Core 24.0.2, the operation failed, and testnet operations were blocked.

Change

  • When core is selected, an unselected Tenderdash may differ from the baseline in start time and restart count only. It must be the same container, image, digests and configuration, and its restart count must not go down. The fleet check also requires it running. The worker does not, because Tenderdash can be mid-restart at that instant and the readiness gate that follows covers it.
  • No other service gets this allowance, and Tenderdash does not unless Core is selected.
  • The worker recipe changes, so Plan.Validate accepts a plan bound to the previous recipe digest. Both digests are pinned, so the allowance ends with the next recipe change. Without it, an operation the old check stopped could not resume under its journaled plan.

Verification

  • New tests: TestCoreUpgradePermitsOnlyTenderdashSelfRestart, TestPreviousRecipePlanStaysResumable, test_core_replacement_permits_only_tenderdash_self_restart.
  • Locally (Go 1.27, CGO_ENABLED=0, so no -race): gofmt -l cmd internal clean, go vet ./... clean, go test ./... ok, and the node, managed and seedtls Python suites ok.
  • On testnet, with a binary built from this commit placed as the pinned executor of four operations: 631fe5e6 resumed and succeeded, then eef9f8eb, 8e40d024 and 37c66221 took the other 27 evonodes to Core 24.0.2. Tenderdash restarted itself on 2 of the 29 nodes.

Not covered

  • The console image still carries 3b6d795. It needs an engine bump after this merges.
  • A node whose Platform containers are recreated by something else during an operation (for example a cron dashmate restart --platform) is still reported as drift. That is intended.

Prepared by infraclaw (Claude Code) for @ktechmidas.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Core-scoped updates can now proceed when Tenderdash restarts itself, provided it remains running and its restart count does not decrease. Other changes to unselected services continue to be rejected.
    • Managed plans can use the current recipe or an explicitly pinned previous recipe when it is the recognized predecessor of the current one. Unrelated recipe versions remain rejected.

Tenderdash exits when Core's RPC goes away and Docker restarts it. A managed
Core upgrade on a validator then failed `preserved-service-changed` after Core
had already been replaced, because every unselected service had to match the
plan snapshot including its start time and restart count. Resume ran the same
check and failed the same way, and the journal refused any other plan for the
network until that operation completed.

When Core is selected, an unselected Tenderdash may now differ in start time
and restart count only. It must be the same container, image, digests and
configuration, its restart count must not go down, and the fleet check also
requires it running. No other service may restart, and Tenderdash may not
unless Core is selected.

The worker recipe changes, so a plan made by the previous executor is accepted
by this one (both digests pinned). That lets an operation the old check stopped
resume under the plan it journaled.

Seen on testnet on 2026-11-20 (console operation 631fe5e6): both canary
evonodes were healthy on the new Core and the operation could not finish.

Prepared by infraclaw (Claude Code) for ktechmidas.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Managed upgrade checks now allow a constrained Tenderdash restart during Core-scoped changes. Plan validation also accepts a pinned previous recipe digest when it matches the specified successor relationship.

Changes: Tenderdash restart preservation

Layer / File(s) Summary
Tenderdash preservation exception
internal/managed/health.go, internal/managed/worker.py, internal/managed/managed_test.go, internal/managed/testdata/test_recipe.py
The preservation checks allow an unselected Tenderdash service to differ in running state, start time, and restart count during a Core-scoped change, subject to the restart count not decreasing and the service remaining running. Other differences still fail. Tests cover the allowed scope and rejected changes.

Recipe digest validation

Layer / File(s) Summary
Pinned predecessor acceptance
internal/managed/types.go, internal/managed/managed_test.go
Plan validation accepts the current recipe digest or the pinned predecessor when the current digest matches the specified successor. Tests cover the current recipe, its predecessor, and an unrelated digest.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Possibly related PRs

  • dashpay/dash-network-go#36: Both changes adjust managed runtime-preservation checks and recipe digest handling for plans from earlier builds.
  • dashpay/dash-network-go#33: Both changes address plan admission when a recipe digest differs from the current digest.
Merge Risk: Minimal · up to 00349

This change lets a Core-only managed upgrade resume when Tenderdash restarts itself. It also keeps plans bound to the previous recipe digest resumable. The allowance is narrow and covered by tests, so no actionable merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title states the main change: Tenderdash may restart itself during a Core-only replacement. The raw summary shows the code allows an unselected Tenderdash container to differ only in running state…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title states the main change: Tenderdash may restart itself during a Core-only replacement. The raw summary shows the code allows an unselected Tenderdash container to differ only in running state, start time, and restart count when Core is selected. The title is specific and matches the changeset and the PR objectives.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 97607ba6-02d1-4c50-8f6a-be4661b3abfd
Commits

Reviewing files that changed from the base of the PR and between 3b6d795 and 00349ac.

Files selected for processing: 5

  • internal/managed/health.go
  • internal/managed/managed_test.go
  • internal/managed/testdata/test_recipe.py
  • internal/managed/types.go
  • internal/managed/worker.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@ktechmidas
ktechmidas merged commit c6e6b81 into main Nov 20, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant