feat: Sequencer HA V2 — Raft-based high availability#928
Open
tomatoishealthy wants to merge 2 commits intofeat/p2p-broadcast-validationfrom
Open
feat: Sequencer HA V2 — Raft-based high availability#928tomatoishealthy wants to merge 2 commits intofeat/p2p-broadcast-validationfrom
tomatoishealthy wants to merge 2 commits intofeat/p2p-broadcast-validationfrom
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ncer Add hakeeper module implementing a 3-node Raft cluster for sequencer HA. The HA cluster provides automatic leader election, block replication, and failover without changing the on-chain sequencer identity. node/hakeeper/: - HAService: wraps hashicorp/raft, implements SequencerHA interface - Config: layered loading (defaults -> TOML file -> CLI flags -> resolve -> validate) supports auto-detection of server_id (hostname) and advertised_addr (local IP) - BlockFSM: Raft FSM for block replication; onApplied callback drives geth apply - leaderMonitor: gates block production behind Barrier to ensure log catch-up - rpc/: JSON-RPC admin API (ha_leader, ha_clusterMembership, ha_addServerAsVoter, ha_removeServer, ha_transferLeader, ha_transferLeaderToServer) with HTTP middleware token auth on write operations node/flags/flags.go: - New flags: --ha.enabled, --ha.config, --ha.bootstrap, --ha.join, --ha.server-id, --ha.advertised-addr, --ha.rpc-token node/cmd/node/main.go: - initHAService(): init HA from flags/config when --ha.enabled is set - Fix typed-nil interface bug: pass untyped nil when HA is disabled node/sequencer/tm_node.go: - Pass HA service to tendermint node setup node/go.mod: - Add hashicorp/raft v1.7.1, raft-boltdb/v2 ops/docker-sequencer-test/: - docker-compose.ha-override.yml: 3-node Raft cluster config for devnet - run-ha-test.sh: 29-case integration test suite (config, cluster, block production, failover, admin API, lifecycle) - run-perf-test.sh: performance test harness Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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)
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. Comment |
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.
Summary
Three nodes share the same sequencer key; Raft leader is the sole block producer.
Automatic failover in ~2s when leader fails.
node/hakeeper/module: HAService, BlockFSM, Config (layered loading withauto-detection), leaderMonitor (Barrier-gated block production), RPC admin API
with token auth middleware.
--ha.enabled,--ha.config,--ha.bootstrap,--ha.join,--ha.server-id,--ha.advertised-addr,--ha.rpc-token) with correspondingMORPH_NODE_HA_*environment variables.ha_leader,ha_leaderWithID,ha_clusterMembership,ha_addServerAsVoter,ha_addServerAsNonvoter,ha_removeServer,ha_transferLeader,ha_transferLeaderToServer. Write ops require auth token.advertised_addr (survives container IP changes).
run-ha-test.sh): config validation, clusterformation, block production, leader failover, admin API, lifecycle management.
Depends on: morph-l2/tendermint#32
Test plan
go test ./node/hakeeper/rpc/... -v— 8 unit tests (RPC token auth)go build ./...— clean compilationrun-ha-test.sh test— 29/29 integration tests pass🤖 Generated with Claude Code