Fixtures: Change fixture tests to use shared `setupComputation`

Change fixtures tests to use shared `setupComputation` instead of
their own slightly different variant.

Signed-off-by: Jamie Lokier <jamie@shareable.org>
This commit is contained in:
Jamie Lokier 2021-05-17 11:04:38 +01:00
parent a5385e5344
commit 4e51a5bb35
No known key found for this signature in database
GPG Key ID: CBC25C68435C30A2
1 changed files with 12 additions and 18 deletions

View File

@ -320,24 +320,18 @@ proc asmCallEvm*(blockNumber: Uint256, chainDB: BaseChainDB, code, data: seq[byt
proc fixtureSetupComputation(vmState: BaseVMState, call: RpcCallData, proc fixtureSetupComputation(vmState: BaseVMState, call: RpcCallData,
origin: EthAddress, forkOverride = none(Fork)): Computation = origin: EthAddress, forkOverride = none(Fork)): Computation =
vmState.setupTxContext( return setupComputation(CallParams(
origin = origin, # Differs from `rpcSetupComputation` vmState: vmState,
gasPrice = call.gasPrice, forkOverride: forkOverride,
forkOverride = forkOverride, origin: some(origin),
) gasPrice: call.gasPrice,
gasLimit: call.gas, # Differs from `rpcSetupComputation`
var msg = Message( sender: call.source,
kind: if call.contractCreation: evmcCreate else: evmcCall, to: call.to,
depth: 0, isCreate: call.contractCreation,
gas: call.gas, # Differs from `rpcSetupComputation` value: call.value,
sender: call.source, input: call.data
contractAddress: call.to, ))
codeAddress: call.to,
value: call.value,
data: call.data
)
return newComputation(vmState, msg)
type type
FixtureResult* = object FixtureResult* = object