diff --git a/cmd/rpcdaemon/commands/eth_call.go b/cmd/rpcdaemon/commands/eth_call.go index e24acabfe..b3c6203b0 100644 --- a/cmd/rpcdaemon/commands/eth_call.go +++ b/cmd/rpcdaemon/commands/eth_call.go @@ -336,7 +336,6 @@ func (api *APIImpl) CreateAccessList(ctx context.Context, args ethapi.CallArgs, } else { stateReader = state.NewPlainState(tx, blockNumber) } - state := state.New(stateReader) header := block.Header() // If the gas amount is not set, extract this as it will depend on access @@ -373,6 +372,7 @@ func (api *APIImpl) CreateAccessList(ctx context.Context, args ethapi.CallArgs, prevTracer = logger.NewAccessListTracer(*args.AccessList, *args.From, to, precompiles) } for { + state := state.New(stateReader) // Retrieve the current access list to expand accessList := prevTracer.AccessList() log.Trace("Creating access list", "input", accessList) diff --git a/core/state/state_object.go b/core/state/state_object.go index c83da6d09..fc07b680b 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -156,6 +156,11 @@ func (so *stateObject) touch() { // GetState returns a value from account storage. func (so *stateObject) GetState(key *common.Hash, out *uint256.Int) { + // If the fake storage is set, only lookup the state here(in the debugging mode) + if so.fakeStorage != nil { + *out = so.fakeStorage[*key] + return + } value, dirty := so.dirtyStorage[*key] if dirty { *out = value @@ -167,6 +172,11 @@ func (so *stateObject) GetState(key *common.Hash, out *uint256.Int) { // GetCommittedState retrieves a value from the committed account storage trie. func (so *stateObject) GetCommittedState(key *common.Hash, out *uint256.Int) { + // If the fake storage is set, only lookup the state here(in the debugging mode) + if so.fakeStorage != nil { + *out = so.fakeStorage[*key] + return + } // If we have the original value cached, return that { value, cached := so.originStorage[*key] @@ -197,6 +207,11 @@ func (so *stateObject) GetCommittedState(key *common.Hash, out *uint256.Int) { // SetState updates a value in account storage. func (so *stateObject) SetState(key *common.Hash, value uint256.Int) { + // If the fake storage is set, put the temporary state update here. + if so.fakeStorage != nil { + so.fakeStorage[*key] = value + return + } // If the new value is the same as old, don't set var prev uint256.Int so.GetState(key, &prev)