|
EVMC
|
The description of evmc_storage_status enum design and its relation to the specification in EIP-2200 and others.
This is the EIP-2200 specification with modifications:
- the clause tree has been converted to ordered lists to be referenceable,
- the cost constant names has been replaced with matching Yellow Paper names.
| Yellow Paper | EIP-2200 | EIP-2200 Value | EIP-2929 Value |
|---|---|---|---|
| Gwarmaccess | SLOAD_GAS | 800 | 100 |
| Gsset | SSTORE_SET_GAS | 20000 | 20000 |
| Gsreset | SSTORE_RESET_GAS | 5000 | 2900 |
| Rsclear | SSTORE_CLEARS_SCHEDULE | 15000 | 15000 |
0 - zero valueX - non-zero valueY - non-zero value different from XZ - non-zero value different form X and Yo - original valuec - current valuev - new value| name | o | c | v | dirty | restored | clause | gas cost | gas refund |
|---|---|---|---|---|---|---|---|---|
| ASSIGNED | 0 | 0 | 0 | no | yes | 2 | Gwarmaccess | 0 |
| X | 0 | 0 | yes | no | 2 | |||
| 0 | Y | Y | yes | no | 2 | |||
| X | Y | Y | yes | no | 2 | |||
| Y | Y | Y | no | yes | 2 | |||
| 0 | Y | Z | yes | no | 3.2 | |||
| X | Y | Z | yes | no | 3.2 | |||
| ADDED | 0 | 0 | Z | no | no | 3.1.1 | Gsset | 0 |
| DELETED | X | X | 0 | no | no | 3.1.2.1 | Gsreset | Rsclear |
| MODIFIED | X | X | Z | no | no | 3.1.2 | Gsreset | 0 |
| DELETED_ADDED | X | 0 | Z | yes | no | 3.2.1.1 | Gwarmaccess | -Rsclear |
| MODIFIED_DELETED | X | Y | 0 | yes | no | 3.2.1.2 | Gwarmaccess | Rsclear |
| DELETED_RESTORED | X | 0 | X | yes | yes | 3.2.1.1 + 3.2.2.2 | Gwarmaccess | -Rsclear + Gsreset - Gwarmaccess |
| ADDED_DELETED | 0 | Y | 0 | yes | yes | 3.2.2.1 | Gwarmaccess | Gsset - Gwarmaccess |
| MODIFIED_RESTORED | X | Y | X | yes | yes | 3.2.2.2 | Gwarmaccess | Gsreset - Gwarmaccess |
All distinctive storage change statuses can be unambiguously selected by combination of the 4 following checks:
original != current (dirty),original == new (restored),current != 0,new != 0.| name | o | c | v | o ≠ c | o = v | c ≠ 0 | v ≠ 0 | checksum | proof |
|---|---|---|---|---|---|---|---|---|---|
| ASSIGNED | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 4 (0b0100) | |
| X | 0 | 0 | 1 | 0 | 0 | 0 | 8 (0b1000) | ||
| 0 | Y | Y | 1 | 0 | 1 | 1 | 11 (0b1011) | ||
| X | Y | Y | 1 | 0 | 1 | 1 | 11 (0b1011) | ||
| Y | Y | Y | 0 | 1 | 1 | 1 | 7 (0b0111) | ||
| 0 | Y | Z | 1 | 0 | 1 | 1 | 11 (0b1011) | ||
| X | Y | Z | 1 | 0 | 1 | 1 | 11 (0b1011) | ||
| ADDED | 0 | 0 | Z | 0 | 0 | 0 | 1 | 1 (0b0001) | |
| DELETED | X | X | 0 | 0 | 0 | 1 | 0 | 2 (0b0010) | |
| MODIFIED | X | X | Z | 0 | 0 | 1 | 1 | 3 (0b0011) | |
| DELETED_ADDED | X | 0 | Z | 1 | 0 | 0 | 1 | 9 (0b1001) | |
| MODIFIED_DELETED | X | Y | 0 | 1 | 0 | 1 | 0 | 10 (0b1010) | |
| DELETED_RESTORED | X | 0 | X | 1 | 1 | 0 | 1 | 13 (0b1101) | |
| ADDED_DELETED | 0 | Y | 0 | 1 | 1 | 1 | 0 | 14 (0b1110) | |
| MODIFIED_RESTORED | X | Y | X | 1 | 1 | 1 | 1 | 15 (0b1111) | |
| impossible | 0 | 0 | 0 | 0 | 0 (0b0000) | o=c ∧ o≠v ∧ c=0 ⇒ v≠0 | |||
| 0 | 1 | 0 | 1 | 5 (0b0101) | o=c ∧ o=v ∧ c=0 ⇒ v=0 | ||||
| 0 | 1 | 1 | 0 | 6 (0b0110) | o=c ∧ o=v ∧ c≠0 ⇒ v≠0 | ||||
| 1 | 1 | 0 | 0 | 12 (0b1100) | o≠c ∧ o=v ∧ c=0 ⇒ v≠0 |