Skip to content
This repository was archived by the owner on Jul 5, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions specs/error_state/ErrorOutOfGasEXP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# ErrorOutOfGasEXP state for EXP OOG error

## Procedure

Handle the corresponding out of gas error for `EXP`.

### EVM behavior

The EXP gas cost is calculated as:

```
# `exponent.bits()` returns the least number of bits needed to represent exponent.
exponent_byte_size = (exponent.bits() + 7) // 8

gas_cost = exponent_byte_size * 50 + 10
```

### Constraints

1. Constrain `gas_left < gas_cost`.
2. Current call must fail.
3. If it's a root call, it transits to `EndTx`.
4. If it isn't a root call, it restores caller's context by reading to `rw_table`, then does step state transition to it.
5. Constrain `rw_counter_end_of_reversion = rw_counter_end_of_step + reversible_counter`.

### Lookups

4 basic bus-mapping lookups + restore context lookups (for non-root call):

1. 2 stack read for `base` and `exponent`.
2. 2 call context lookups for `is_success` and `rw_counter_end_of_reversion`.
3. Restore context lookups for non-root call.