mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-02-05 08:45:27 +00:00
fix evmc_host.set_storage
This commit is contained in:
parent
95f6711304
commit
2f3a22d840
@ -32,6 +32,9 @@ proc hostAccountExistsImpl(ctx: Computation, address: EthAddress): bool {.cdecl.
|
|||||||
proc hostGetStorageImpl(ctx: Computation, address: EthAddress, key: var evmc_bytes32): evmc_bytes32 {.cdecl.} =
|
proc hostGetStorageImpl(ctx: Computation, address: EthAddress, key: var evmc_bytes32): evmc_bytes32 {.cdecl.} =
|
||||||
ctx.vmState.accountDB.getStorage(address, Uint256.fromEvmc(key)).toEvmc()
|
ctx.vmState.accountDB.getStorage(address, Uint256.fromEvmc(key)).toEvmc()
|
||||||
|
|
||||||
|
proc sstoreNetGasMetering(ctx: Computation): bool {.inline.} =
|
||||||
|
ctx.fork in {FkConstantinople, FkIstanbul}
|
||||||
|
|
||||||
proc hostSetStorageImpl(ctx: Computation, address: EthAddress,
|
proc hostSetStorageImpl(ctx: Computation, address: EthAddress,
|
||||||
key, value: var evmc_bytes32): evmc_storage_status {.cdecl.} =
|
key, value: var evmc_bytes32): evmc_storage_status {.cdecl.} =
|
||||||
let
|
let
|
||||||
@ -51,7 +54,7 @@ proc hostSetStorageImpl(ctx: Computation, address: EthAddress,
|
|||||||
status = EVMC_STORAGE_UNCHANGED
|
status = EVMC_STORAGE_UNCHANGED
|
||||||
else:
|
else:
|
||||||
origValue = statedb.getCommittedStorage(address, slot)
|
origValue = statedb.getCommittedStorage(address, slot)
|
||||||
if origValue == currValue or ctx.fork < FkIstanbul:
|
if origValue == currValue or not ctx.sstoreNetGasMetering():
|
||||||
if currValue == 0:
|
if currValue == 0:
|
||||||
status = EVMC_STORAGE_ADDED
|
status = EVMC_STORAGE_ADDED
|
||||||
elif newValue == 0:
|
elif newValue == 0:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user