Skip to content

Commit

Permalink
Merge pull request ethereum#13 from sei-protocol/evm-set-evm
Browse files Browse the repository at this point in the history
Set EVM in StateDB in gasestimator
  • Loading branch information
codchen authored Jan 30, 2024
2 parents b6b7630 + 39ab532 commit c047698
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/state/statedb.go
Original file line number Diff line number Diff line change
Expand Up @@ -1389,6 +1389,8 @@ func (s *StateDB) convertAccountSet(set map[common.Address]*types.StateAccount)
return ret
}

func (s *StateDB) SetEVM(evm *vm.EVM) {}

// copySet returns a deep-copied set.
func copySet[k comparable](set map[k][]byte) map[k][]byte {
copied := make(map[k][]byte, len(set))
Expand Down
1 change: 1 addition & 0 deletions core/vm/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ type StateDB interface {
GetLogs(hash common.Hash, blockNumber uint64, blockHash common.Hash) []*types.Log
TxIndex() int
Preimages() map[common.Hash][]byte
SetEVM(evm *EVM)
}

// CallContext provides a basic interface for the EVM calling conventions. The EVM
Expand Down
1 change: 1 addition & 0 deletions eth/gasestimator/gasestimator.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ func run(ctx context.Context, call *core.Message, opts *Options) (*core.Executio
dirtyState = opts.State.Copy()
evm = vm.NewEVM(evmContext, msgContext, dirtyState, opts.Config, vm.Config{NoBaseFee: true})
)
dirtyState.SetEVM(evm)
// Monitor the outer context and interrupt the EVM upon cancellation. To avoid
// a dangling goroutine until the outer estimation finishes, create an internal
// context for the lifetime of this method call.
Expand Down

0 comments on commit c047698

Please sign in to comment.