diff --git a/nimbus/vm/interpreter/gas_costs.nim b/nimbus/vm/interpreter/gas_costs.nim index ebe06a560..2185440e0 100644 --- a/nimbus/vm/interpreter/gas_costs.nim +++ b/nimbus/vm/interpreter/gas_costs.nim @@ -273,9 +273,9 @@ template gasCosts(fork: Fork, prefix, ResultGasCostsName: untyped) = if gasParams.s_originalValue == value: if gasParams.s_originalValue.isZero: # reset to original inexistent slot (2.2.2.1) - result.gasRefund = InitRefundEIP2200 + result.gasRefund += InitRefundEIP2200 else: # reset to original existing slot (2.2.2.2) - result.gasRefund = CleanRefundEIP2200 + result.gasRefund += CleanRefundEIP2200 result.gasCost = DirtyGasEIP2200 # dirty update (2.2) diff --git a/nimbus/vm/interpreter/opcodes_impl.nim b/nimbus/vm/interpreter/opcodes_impl.nim index 9b135f5d8..91d5ab3a8 100644 --- a/nimbus/vm/interpreter/opcodes_impl.nim +++ b/nimbus/vm/interpreter/opcodes_impl.nim @@ -951,7 +951,7 @@ op sstoreEIP2200, inline = false, slot, value: computation.gasMeter.consumeGas(gasCost, &"SSTORE EIP2200: {computation.msg.storageAddress}[{slot}] -> {value} ({currentValue})") - if gasRefund > 0: + if gasRefund != 0: computation.gasMeter.refundGas(gasRefund) computation.vmState.mutateStateDB: