feat: SequencerHA interface + StateV2 dynamic block interval#32
Open
tomatoishealthy wants to merge 1 commit intofeat/p2p-broadcast-validationfrom
Open
feat: SequencerHA interface + StateV2 dynamic block interval#32tomatoishealthy wants to merge 1 commit intofeat/p2p-broadcast-validationfrom
tomatoishealthy wants to merge 1 commit intofeat/p2p-broadcast-validationfrom
Conversation
SequencerHA interface (sequencer/interfaces.go): - Start/Stop/IsLeader/Join/Commit/Subscribe/SetOnBlockApplied - Abstracts Raft cluster for StateV2 block production StateV2 changes (sequencer/state_v2.go): - Dynamic block interval: fastTicker (300ms) polls txpool, slowTimer (3s) produces empty blocks as fallback for chain liveness - Split produceBlock into assembleBlock + commitBlock for clean separation of block assembly (read-only) vs signing+committing (side-effecting) - HA path: signBlock -> ha.Commit (Raft replication, FSM handles apply) - Non-HA path: signBlock -> ApplyBlock -> broadcastCh - ApplyBlock: reorg detection + idempotent skip + signature enforcement - Remove blockInterval constructor parameter, use package-level constants node/node.go: - Accept SequencerHA parameter, inject SetOnBlockApplied callback Test fixes: - Add Start/Stop/SetOnBlockApplied to mockSequencerHA - Add Signature field to ApplyBlock test blocks (signature enforcement) - Fix RollbackTo_All assertion (count should be 0, not 1) - Remove blockInterval parameter from all NewStateV2 test calls Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
5 tasks
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
SequencerHAinterface (sequencer/interfaces.go) abstracting the Raft cluster for StateV2. Methods:Start,Stop,IsLeader,Join,Commit,Subscribe,SetOnBlockApplied.fastTicker(300ms) polls txpool viaassembleBlockand commits immediately when transactions are found;slowTimer(3s) produces empty blocks as a chain-liveness fallback.produceBlockintoassembleBlock(read-only block assembly, safe to call and discard) andcommitBlock(sign + Raft commit or local apply + broadcast).commitBlock: leader callsha.Commitfor Raft replication; FSM callback handlesApplyBlock+SaveSignaturefor all nodes.ApplyBlock: reorg detection, idempotent skip (same block.Number + same hash), signature enforcement.node/node.go: acceptSequencerHAparameter and injectSetOnBlockAppliedcallback.blockIntervalfromNewStateV2constructor; use package-level constantsBlockInterval(3s) andFastBlockInterval(300ms).Test plan
go test ./sequencer/... -v— 37 tests pass (block_cache + state_v2)run-ha-test.sh test(29/29)🤖 Generated with Claude Code