From 18eb255758f592abf798f51311539c5f037c84fa Mon Sep 17 00:00:00 2001 From: andri lim Date: Wed, 22 Jan 2020 11:57:34 +0700 Subject: [PATCH] convert 'block' into 'if-else' in evmc 'setStorage' --- nimbus/vm/evmc_host.nim | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/nimbus/vm/evmc_host.nim b/nimbus/vm/evmc_host.nim index cfdd47279..809d678c5 100644 --- a/nimbus/vm/evmc_host.nim +++ b/nimbus/vm/evmc_host.nim @@ -51,13 +51,10 @@ proc hostSetStorageImpl(ctx: Computation, address: var evmc_address, gasRefund = 0.GasInt origValue = 0.u256 - block: - if newValue == currValue: - status = EVMC_STORAGE_UNCHANGED - break - + if newValue == currValue: + status = EVMC_STORAGE_UNCHANGED + else: origValue = statedb.getCommittedStorage(storageAddr, slot) - if origValue == currValue or ctx.fork < FkIstanbul: if currValue == 0: status = EVMC_STORAGE_ADDED @@ -65,7 +62,6 @@ proc hostSetStorageImpl(ctx: Computation, address: var evmc_address, status = EVMC_STORAGE_DELETED else: status = EVMC_STORAGE_MODIFIED_AGAIN - ctx.vmState.mutateStateDB: db.setStorage(storageAddr, slot, newValue)