EVM cleanup
This commit is contained in:
parent
26620eb672
commit
7d113b839f
|
@ -246,10 +246,6 @@ template gasCosts*(c: Computation): untyped =
|
|||
template fork*(c: Computation): untyped =
|
||||
c.vmState.fork
|
||||
|
||||
proc isOriginComputation*(c: Computation): bool =
|
||||
# Is this computation the computation initiated by a transaction
|
||||
c.msg.sender == c.vmState.txOrigin
|
||||
|
||||
template isSuccess*(c: Computation): bool =
|
||||
c.error.isNil
|
||||
|
||||
|
|
|
@ -89,6 +89,12 @@ else:
|
|||
c.vmState.mutateStateDB:
|
||||
db.setStorage(c.msg.contractAddress, slot, newValue)
|
||||
|
||||
template sstoreEvmcOrSstore(cpt, slot, newValue: untyped) =
|
||||
when evmc_enabled:
|
||||
sstoreEvmc(cpt, slot, newValue, 0.GasInt)
|
||||
else:
|
||||
sstoreImpl(cpt, slot, newValue)
|
||||
|
||||
template sstoreEvmcOrNetGasMetering(cpt, slot, newValue: untyped, coldAccess = 0.GasInt) =
|
||||
when evmc_enabled:
|
||||
sstoreEvmc(cpt, slot, newValue, coldAccess)
|
||||
|
@ -191,7 +197,7 @@ const
|
|||
|
||||
checkInStaticContext(cpt)
|
||||
cpt.asyncChainTo(ifNecessaryGetSlot(cpt.vmState, cpt.msg.contractAddress, slot)):
|
||||
sstoreEvmcOrNetGasMetering(cpt, slot, newValue)
|
||||
sstoreEvmcOrSstore(cpt, slot, newValue)
|
||||
|
||||
|
||||
sstoreEIP1283Op: Vm2OpFn = proc (k: var Vm2Ctx) =
|
||||
|
|
|
@ -39,7 +39,6 @@ export
|
|||
vmc.getStorage,
|
||||
vmc.getTimestamp,
|
||||
vmc.isError,
|
||||
vmc.isOriginComputation,
|
||||
vmc.isSuccess,
|
||||
vmc.merge,
|
||||
vmc.newComputation,
|
||||
|
|
|
@ -92,7 +92,6 @@ export
|
|||
bChp.getStorage,
|
||||
bChp.getTimestamp,
|
||||
bChp.isError,
|
||||
bChp.isOriginComputation,
|
||||
bChp.isSuccess,
|
||||
bChp.merge,
|
||||
bChp.newComputation,
|
||||
|
|
Loading…
Reference in New Issue