Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion arbitrum/recordingdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ func (r *RecordingDatabase) GetOrRecreateState(ctx context.Context, header *type
returnedBlockNumber := header.Number.Uint64()
for ctx.Err() == nil {
var block *types.Block
state, block, err = AdvanceStateByBlock(ctx, r.bc, state, blockToRecreate, prevHash, logFunc)
state, block, _, err = AdvanceStateByBlock(ctx, r.bc, state, blockToRecreate, prevHash, logFunc, false)
if err != nil {
return nil, err
}
Expand Down
14 changes: 8 additions & 6 deletions arbitrum/recreatestate.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,22 @@ func FindLastAvailableState(ctx context.Context, bc *core.BlockChain, stateFor S
return state, currentHeader, release, ctx.Err()
}

func AdvanceStateByBlock(ctx context.Context, bc *core.BlockChain, state *state.StateDB, blockToRecreate uint64, prevBlockHash common.Hash, logFunc StateBuildingLogFunction) (*state.StateDB, *types.Block, error) {
func AdvanceStateByBlock(ctx context.Context, bc *core.BlockChain, state *state.StateDB, blockToRecreate uint64, prevBlockHash common.Hash, logFunc StateBuildingLogFunction, exposeMultiGas bool) (*state.StateDB, *types.Block, types.Receipts, error) {
block := bc.GetBlockByNumber(blockToRecreate)
if block == nil {
return nil, nil, fmt.Errorf("block not found while recreating: %d", blockToRecreate)
return nil, nil, nil, fmt.Errorf("block not found while recreating: %d", blockToRecreate)
}
if block.ParentHash() != prevBlockHash {
return nil, nil, fmt.Errorf("reorg detected: number %d expectedPrev: %v foundPrev: %v", blockToRecreate, prevBlockHash, block.ParentHash())
return nil, nil, nil, fmt.Errorf("reorg detected: number %d expectedPrev: %v foundPrev: %v", blockToRecreate, prevBlockHash, block.ParentHash())
}
if logFunc != nil {
logFunc(block.Header(), true)
}
_, err := bc.Processor().Process(block, state, vm.Config{})
result, err := bc.Processor().Process(block, state, vm.Config{
ExposeMultiGas: exposeMultiGas,
})
if err != nil {
return nil, nil, fmt.Errorf("failed recreating state for block %d : %w", blockToRecreate, err)
return nil, nil, nil, fmt.Errorf("failed recreating state for block %d : %w", blockToRecreate, err)
}
return state, block, nil
return state, block, result.Receipts, nil
}