fixes `rpcMakeCall`: using parent.stateRoot
instead of using header.stateRoot, now it is using parent.stateRoot
This commit is contained in:
parent
c200cebb1d
commit
728f3a24be
|
@ -63,10 +63,10 @@ proc rpcDoCall*(call: RpcCallData, header: BlockHeader, chain: BaseChainDB): Hex
|
|||
proc rpcMakeCall*(call: RpcCallData, header: BlockHeader, chain: BaseChainDB): (string, GasInt, bool) =
|
||||
# TODO: handle revert
|
||||
var
|
||||
# we use current header stateRoot, unlike block validation
|
||||
# which use previous block stateRoot
|
||||
vmState = newBaseVMState(header.stateRoot, header, chain)
|
||||
comp = rpcSetupComputation(vmState, call, call.gas)
|
||||
parent = chain.getBlockHeader(header.parentHash)
|
||||
vmState = newBaseVMState(parent.stateRoot, header, chain)
|
||||
fork = toFork(chain.config, header.blockNumber)
|
||||
comp = rpcSetupComputation(vmState, call, call.gas, some(fork))
|
||||
|
||||
let gas = comp.gasMeter.gasRemaining
|
||||
comp.execComputation()
|
||||
|
|
Loading…
Reference in New Issue