fixes EIP2200 gas cost and refund

This commit is contained in:
andri lim 2019-11-18 20:33:10 +07:00
parent dda26611c2
commit 11f67f87fd
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
2 changed files with 3 additions and 3 deletions

View File

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

View File

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