Skip to content

Commit f38e80d

Browse files
committed
core/vm: fix flaw in sstore refund
1 parent b6d287d commit f38e80d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

core/vm/operations_acl.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ func gasSStoreEIP2929(evm *EVM, contract *Contract, stack *Stack, mem *Memory, m
9494
} else { // reset to original existing slot (2.2.2.2)
9595
// EIP 2200 Original clause:
9696
// evm.StateDB.AddRefund(params.SstoreResetGasEIP2200 - params.SloadGasEIP2200)
97-
evm.StateDB.AddRefund(params.SstoreResetGasEIP2200 - WarmStorageReadCostEIP2929)
97+
// - SSTORE_RESET_GAS redefined as (5000 - COLD_SLOAD_COST)
98+
// - SLOAD_GAS redefined as WARM_STORAGE_READ_COST
99+
// Final: (5000 - COLD_SLOAD_COST) - WARM_STORAGE_READ_COST
100+
evm.StateDB.AddRefund((params.SstoreResetGasEIP2200 - ColdSloadCostEIP2929) - WarmStorageReadCostEIP2929)
98101
}
99102
}
100103
// EIP-2200 original clause:

0 commit comments

Comments
 (0)