fixes EIP2200 gas cost and refund
This commit is contained in:
parent
dda26611c2
commit
11f67f87fd
|
@ -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)
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue