Skip to content

Commit

Permalink
save
Browse files Browse the repository at this point in the history
  • Loading branch information
blxdyx committed Jan 2, 2024
1 parent 6a06135 commit 81f2969
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,13 @@ func (b *SimulatedBackend) emptyPendingBlock() {
// stateByBlockNumber retrieves a state by a given blocknumber.
func (b *SimulatedBackend) stateByBlockNumber(db kv.Tx, blockNumber *big.Int) *state.IntraBlockState {
if blockNumber == nil || blockNumber.Cmp(b.pendingBlock.Number()) == 0 {
return state.New(b.m.NewHistoryStateReader(b.pendingBlock.NumberU64()+1, db))
return state.New(b.m.NewHistoryStateReader(b.pendingBlock.NumberU64()+1, b.pendingBlock.Time(), db))
}
return state.New(b.m.NewHistoryStateReader(blockNumber.Uint64()+1, db))
header, err := b.BlockReader().HeaderByNumber(context.Background(), db, blockNumber.Uint64()+1)
if err != nil {
return nil
}
return state.New(b.m.NewHistoryStateReader(blockNumber.Uint64()+1, header.Time, db))
}

// CodeAt returns the code associated with a certain account in the blockchain.
Expand Down
4 changes: 2 additions & 2 deletions turbo/stages/mock_sentry.go
Original file line number Diff line number Diff line change
Expand Up @@ -762,8 +762,8 @@ func (ms *MockSentry) HeaderDownload() *headerdownload.HeaderDownload {
return ms.sentriesClient.Hd
}

func (ms *MockSentry) NewHistoryStateReader(blockNum uint64, tx kv.Tx) state.StateReader {
r, err := rpchelper.CreateHistoryStateReader(tx, blockNum, 0, ms.HistoryV3, ms.ChainConfig.ChainName)
func (ms *MockSentry) NewHistoryStateReader(blockNum uint64, blockTime uint64, tx kv.Tx) state.StateReader {
r, err := rpchelper.CreateHistoryStateReader(tx, blockNum, 0, ms.HistoryV3, blockTime, ms.ChainConfig.ChainName)
if err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion turbo/transactions/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type BlockGetter interface {

// ComputeTxEnv returns the execution environment of a certain transaction.
func ComputeTxEnv(ctx context.Context, engine consensus.EngineReader, block *types.Block, cfg *chain.Config, headerReader services.HeaderReader, dbtx kv.Tx, txIndex int, historyV3 bool) (core.Message, evmtypes.BlockContext, evmtypes.TxContext, *state.IntraBlockState, state.StateReader, error) {
reader, err := rpchelper.CreateHistoryStateReader(dbtx, block.NumberU64(), txIndex, historyV3, cfg.ChainName)
reader, err := rpchelper.CreateHistoryStateReader(dbtx, block.NumberU64(), txIndex, historyV3, block.Time(), cfg.ChainName)
if err != nil {
return nil, evmtypes.BlockContext{}, evmtypes.TxContext{}, nil, nil, err
}
Expand Down

0 comments on commit 81f2969

Please sign in to comment.