-
Notifications
You must be signed in to change notification settings - Fork 261
fix: Publisher-mode synchronization option for failover scenario #3222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
954a74a
74641e0
53f5ded
a2607e5
1b8da2e
0f55e6a
5218cc6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,10 +2,10 @@ module github.com/evstack/ev-node/apps/evm | |
|
|
||
| go 1.25.7 | ||
|
|
||
| // replace ( | ||
| // github.com/evstack/ev-node => ../../ | ||
| // github.com/evstack/ev-node/execution/evm => ../../execution/evm | ||
| // ) | ||
| replace ( | ||
| github.com/evstack/ev-node => ../../ | ||
| github.com/evstack/ev-node/execution/evm => ../../execution/evm | ||
| ) | ||
|
Comment on lines
+5
to
+8
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check if execution/evm has local replace directives or uses registry versions
echo "=== Checking execution/evm/go.mod for replace directives ==="
rg -n "^replace" execution/evm/go.mod
echo ""
echo "=== Checking what version of ev-node execution/evm requires ==="
rg -n "github.com/evstack/ev-node" execution/evm/go.mod | head -5
echo ""
echo "=== Checking for active go.work file that might reconcile versions ==="
fd -H '^go\.work$' . --max-depth 1Repository: evstack/ev-node Length of output: 385 Add replace directive to
🤖 Prompt for AI Agents |
||
|
|
||
| require ( | ||
| github.com/ethereum/go-ethereum v1.17.2 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -694,6 +694,12 @@ var ( | |
| // TrySyncNextBlock attempts to sync the next available block | ||
| // the event is always the next block in sequence as processHeightEvent ensures it. | ||
| func (s *Syncer) TrySyncNextBlock(ctx context.Context, event *common.DAHeightEvent) error { | ||
| return s.trySyncNextBlockWithState(ctx, event, s.getLastState()) | ||
| } | ||
|
|
||
| // trySyncNextBlockWithState attempts to sync the next available block using | ||
| // the provided current state as the validation/apply baseline. | ||
| func (s *Syncer) trySyncNextBlockWithState(ctx context.Context, event *common.DAHeightEvent, currentState types.State) error { | ||
| select { | ||
| case <-ctx.Done(): | ||
| return ctx.Err() | ||
|
|
@@ -703,7 +709,6 @@ func (s *Syncer) TrySyncNextBlock(ctx context.Context, event *common.DAHeightEve | |
| header := event.Header | ||
| data := event.Data | ||
| nextHeight := event.Header.Height() | ||
| currentState := s.getLastState() | ||
| headerHash := header.Hash().String() | ||
|
|
||
| s.logger.Info().Uint64("height", nextHeight).Str("source", string(event.Source)).Msg("syncing block") | ||
|
|
@@ -1189,6 +1194,7 @@ func (s *Syncer) RecoverFromRaft(ctx context.Context, raftState *raft.RaftBlockS | |
| } | ||
|
|
||
| currentState := s.getLastState() | ||
| stateBootstrapped := false | ||
|
|
||
| // Defensive: if lastState is not yet initialized (e.g., RecoverFromRaft called before Start), | ||
| // load it from the store to ensure we have valid state for validation. | ||
|
|
@@ -1201,8 +1207,10 @@ func (s *Syncer) RecoverFromRaft(ctx context.Context, raftState *raft.RaftBlockS | |
| s.logger.Debug().Err(err).Msg("no state in store, using genesis defaults for recovery") | ||
| currentState = types.State{ | ||
| ChainID: s.genesis.ChainID, | ||
| InitialHeight: s.genesis.InitialHeight, | ||
| LastBlockHeight: s.genesis.InitialHeight - 1, | ||
| } | ||
| stateBootstrapped = true | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -1214,11 +1222,18 @@ func (s *Syncer) RecoverFromRaft(ctx context.Context, raftState *raft.RaftBlockS | |
| return nil | ||
| } else if currentState.LastBlockHeight+1 == raftState.Height { // raft is 1 block ahead | ||
| // apply block | ||
| err := s.TrySyncNextBlock(ctx, &common.DAHeightEvent{ | ||
| event := &common.DAHeightEvent{ | ||
| Header: &header, | ||
| Data: &data, | ||
| Source: "", | ||
| }) | ||
| } | ||
| err := s.trySyncNextBlockWithState(ctx, event, currentState) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this change is effectivelly to use the correct state when we override it at L1207 right?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, before it was re-read in the method and could be empty |
||
| if err != nil && stateBootstrapped && errors.Is(err, errInvalidState) { | ||
| s.logger.Debug().Err(err).Msg("raft recovery failed after bootstrap state init, retrying once") | ||
| // Keep strict validation semantics; this retry only guards startup ordering races. | ||
| s.SetLastState(currentState) | ||
| err = s.trySyncNextBlockWithState(ctx, event, currentState) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The retry cannot clear Lines 719-727 validate against the 🤖 Prompt for AI Agents |
||
| } | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.