EVM cleanup

This commit is contained in:
jangko 2023-08-29 07:12:31 +07:00
parent 26620eb672
commit 7d113b839f
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
4 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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) =

View File

@ -39,7 +39,6 @@ export
vmc.getStorage,
vmc.getTimestamp,
vmc.isError,
vmc.isOriginComputation,
vmc.isSuccess,
vmc.merge,
vmc.newComputation,

View File

@ -92,7 +92,6 @@ export
bChp.getStorage,
bChp.getTimestamp,
bChp.isError,
bChp.isOriginComputation,
bChp.isSuccess,
bChp.merge,
bChp.newComputation,