Skip to content

Commit

Permalink
update blocks reexecutor
Browse files Browse the repository at this point in the history
  • Loading branch information
magicxyyz committed Feb 23, 2024
1 parent ab310ac commit 251abe0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions blocks_reexecutor/blocks_reexecutor.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ type BlocksReExecutor struct {
stopwaiter.StopWaiter
config *Config
blockchain *core.BlockChain
stateFor func(header *types.Header) (*state.StateDB, error)
stateFor arbitrum.StateForHeaderFunction
done chan struct{}
fatalErrChan chan error
startBlock uint64
Expand Down Expand Up @@ -110,7 +110,10 @@ func New(c *Config, blockchain *core.BlockChain, fatalErrChan chan error) *Block
startBlock: start,
done: make(chan struct{}, c.Room),
fatalErrChan: fatalErrChan,
stateFor: func(header *types.Header) (*state.StateDB, error) { return blockchain.StateAt(header.Root) },
stateFor: func(header *types.Header) (*state.StateDB, arbitrum.StateReleaseFunc, error) {
state, err := blockchain.StateAt(header.Root)
return state, arbitrum.NoopStateRelease, err
},
}
}

Expand All @@ -120,7 +123,9 @@ func (s *BlocksReExecutor) LaunchBlocksReExecution(ctx context.Context, currentB
if start < s.startBlock {
start = s.startBlock
}
startState, startHeader, err := arbitrum.FindLastAvailableState(ctx, s.blockchain, s.stateFor, s.blockchain.GetHeaderByNumber(start), nil, -1)
// we don't use state release pattern here
// TODO do we want to use release pattern here?
startState, startHeader, _, err := arbitrum.FindLastAvailableState(ctx, s.blockchain, s.stateFor, s.blockchain.GetHeaderByNumber(start), nil, -1)
if err != nil {
s.fatalErrChan <- fmt.Errorf("blocksReExecutor failed to get last available state while searching for state at %d, err: %w", start, err)
return s.startBlock
Expand Down
2 changes: 1 addition & 1 deletion go-ethereum

0 comments on commit 251abe0

Please sign in to comment.