fix(l1sequencer): fail-fast on verifier startup when L1 unreachable#986
Merged
Merged
Conversation
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
…F-03/F-01/F-13) NewSequencerVerifier treated an initial syncHistory() failure as a soft error (Logger.Error only). When L1 RPC is unreachable at boot, history stays empty, upgrade.SetUpgradeBlockHeight is never called, and the global UpgradeBlockHeight is left at its -1 sentinel. Booting with UpgradeBlockHeight=-1 is unsafe: - F-01: IsUpgraded() returns false for every height, so the PBFT state machine can run past the true upgrade height. - F-03: on a block-synced fullnode restart, the handshake's sequencer-mode replay exemption (replay.go: `IsUpgraded(storeHeight+1)`) fails -> ErrAppBlockHeightTooHigh; and the consensus ctor's reconstructLastCommit guard (state.go:192) runs against a nil commit -> panic. Make startup fail-fast: NewSequencerVerifier now returns an error when the initial sync fails or returns empty history (UpgradeBlockHeight still < 0), and main.go propagates it so the node exits at boot rather than booting into the unsafe -1 state. The operator's supervisor restarts the node once L1 is reachable.
9d66f68 to
f1b5870
Compare
The CI Lint job runs golangci-lint over the whole node/ package, not just the PR diff, and was failing on pre-existing issues. Fix all of them so the check passes: - gofmt: struct field alignment / formatting (verifier.go, signer.go, ha_service.go) - errcheck: check or explicitly ignore deferred Close/Cancel/SetDeadline return values (block_fsm.go, ha_service.go, enclave_signer.go) - gosec G112: set ReadHeaderTimeout on http.Server (main.go metrics server, hakeeper/rpc/server.go) to avoid Slowloris - gosec G301: tighten Raft storage dir perms 0o755 -> 0o750 (ha_service.go) - misspell: cancelled -> canceled, initialised -> initialized (verifier.go, derivation.go, ha_service.go) No behavioral change. `make lint` (go run build/lint.go) now exits 0.
tomatoishealthy
approved these changes
Jun 10, 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.
Problem
NewSequencerVerifiertreated an initialsyncHistory()failure as a soft error (Logger.Erroronly). When the L1 RPC is unreachable at boot,historystays empty,upgrade.SetUpgradeBlockHeightis never called, and the globalupgrade.UpgradeBlockHeightis left at its-1sentinel — yet the node continues booting.Booting with
UpgradeBlockHeight=-1is unsafe and is the shared root cause of three audit findings:IsUpgraded()returns false for every height, so the PBFT state machine can run past the true upgrade height (split-brain at the boundary).IsUpgraded:replay.go: IsUpgraded(storeHeight+1)) fails →ErrAppBlockHeightTooHigh(app height N > core upgradeHeight-1);reconstructLastCommitguard (state.go:192) runs against a nil commit →panic.I reproduced F-03 on the devnet (pre-fix image): stopping a sentry node that had block-synced past the upgrade height (=10) and restarting it with the L1 RPC black-holed produced the verifier soft-error followed by
error during handshake: ... app block height (723) is higher than core (9)— confirming the node boots into the-1state and then crashes in the handshake.Fix
Make verifier startup fail-fast:
NewSequencerVerifiernow returns an error when the initial sync fails or returns empty history (UpgradeBlockHeightstill< 0), andcmd/node/main.gopropagates it so the node exits at boot rather than booting into the unsafe-1state. The operator's supervisor (Dockerrestart, systemd, k8s) restarts the node once L1 is reachable.The error message carries the
refusing to start with UpgradeBlockHeight=-1sentinel that the audit verification scripts (f1-upgrade-init-race.sh,f3-nilcommit-panic.sh) assert on.Scope
node/l1sequencer/verifier.go—NewSequencerVerifierreturns(*SequencerVerifier, error); fail-fast on sync failure / empty history.node/cmd/node/main.go— propagate the error.Based on the latest
feat/sequencer-final(4a7b9119).Verification
go build ./cmd/node/ ./l1sequencer/— cleango vet ./l1sequencer/— cleango test ./l1sequencer/— pass