smlxl / evm.codes

Source for evm.codes an Ethereum Virtual Machine Opcodes Interactive Reference
https://evm.codes/
MIT License
718 stars 132 forks source link

fix: `SSTORE` gas #335

Closed trocher closed 2 months ago

trocher commented 3 months ago
  1. Fix an incorrect and unreachable case of the gas refund computation for SSTORE
  2. Fix #312

1.

If and only if the following conditions are met:

value != current_value
value == original_value != 0
key is cold

The gas refund computation would do:

gas_refunds += 4900

However, this behaviour is not defined by EIP-2200 and EIP-2929 and the conditions are impossible to reach given that if original_value != current_value, it must be that the key is warm.

2.

According to both EIP-2200 and EIP-2929, the defined computations are correct and there is no distinct case when the key is cold or warm. There is hence no need for branches.

vercel[bot] commented 3 months ago

@trocher is attempting to deploy a commit to the smlXL Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] commented 2 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
evm-codes ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 5, 2024 8:21am