feat(consensus): Implement and wire halt-height and halt-time - #3147
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3147 +/- ##
==========================================
+ Coverage 63.04% 63.07% +0.02%
==========================================
Files 371 371
Lines 15461 15533 +72
==========================================
+ Hits 9748 9798 +50
- Misses 4757 4777 +20
- Partials 956 958 +2
🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
Implements and wires CometBFT-side coordinated halting for binary-swap upgrades via --halt-height and --halt-time, plus adds CI coverage and an end-to-end upgrade smoke test to validate halt → swap → resume behavior.
Changes:
- Wire
halt-height/halt-timefrom CLI/app options into the CometBFT service and enforce halting semantics across Start/ABCI/Commit. - Populate commit headers with real height/time (enabling
min-retain-blockspruning and seeding halt-time state across restarts). - Add an e2e upgrade harness + Make targets + nightly CI job to exercise halt/swap/resume under tx load.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| testing/upgrade/halt-swap-resume-test.sh | New local multi-validator bash harness to halt, swap beacond binaries, and resume while asserting safety + tx flow. |
| scripts/build/halt-upgrade-test.mk | Make targets to run the halt/swap/resume test and fetch a bera-reth binary dependency. |
| node-core/builder/baseapp_options.go | Wires halt flags into CometBFT service options. |
| Makefile | Includes the new halt upgrade test make targets. |
| consensus/cometbft/service/service.go | Seeds finalized height/time on startup and refuses Start if halt point already reached. |
| consensus/cometbft/service/options.go | Adds service options for haltHeight / haltTime. |
| consensus/cometbft/service/finalize_block.go | Publishes finalized height/time after successful FinalizeBlock completion. |
| consensus/cometbft/service/commit.go | Sets commit header height/time and triggers graceful halt after commit; adds shared halt predicate and shutdown parking helper. |
| consensus/cometbft/service/commit_internal_test.go | Adds unit tests for halt predicate, restart refusal, and ABCI gating behavior. |
| consensus/cometbft/service/abci.go | Gates proposal/finalization past the halt point to avoid CometBFT consensus-failure panics. |
| .github/workflows/nightly.yml | Adds nightly job to run the halt/swap/resume tests and upload logs on failure. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fridrik01
force-pushed
the
fix-halt-height
branch
from
July 16, 2026 16:25
184e689 to
f0e9245
Compare
fridrik01
force-pushed
the
fix-halt-height
branch
from
July 16, 2026 16:33
f0e9245 to
571e1db
Compare
bar-bera
approved these changes
Jul 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements and wires the
--halt-heightand--halt-timeflags so a network can perform a coordinated halt for binary-swap upgrades. I noticed these were missing while working on the cometbft re-fork (berachain/cometbft#51).This is the upgrade path for releases where old and new binaries cannot safely coexist in one validator set.
With every validator configured to the same halt point, the network commits the halt block and shuts itself down. Operators then swap the beacond binary and restart without the halt flags, and the chain resumes at the next height from the same data directories, with no replay or rollback.
The implementation makes this safe in three ways:
Commitnow records the real block height and time in the commit header, which also fixesmin-retain-blockspruning, silently a no-op until now (see notes below).Testing
commit_internal_test.go).testing/upgrade/halt-swap-resume-test.sh): a local multi-validator devnet halts on the old binary, one node must refuse to restart with the flag set, then all nodes resume from the same data dirs on the new binary with tx load asserted on both sides of the swap. Runs in two flavors:make test-halt-swap-resume(halt at a fixed height, --halt-height)make test-halt-swap-resume-time(halt at a wall-clock time, --halt-time)Notes for release
min-retain-blockssetting now takes effect. It has been silently ignored until now, so operators who have it configured will see CometBFT begin pruning old blocks after upgrading. Anyone relying on it having no effect should unset it before upgrading.halt-heightorhalt-timevalues in existing configs become live. A non-zero value the old binary ignored will now halt the node, so configs are worth checking before rolling this out.