Skip to content

Commit

Permalink
zk-vm section for introspective precompiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Marchhill committed Jan 8, 2025
1 parent 3c4dc08 commit 4471fbc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions EIPS/eip-7793.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ The precompile is priced to match similar opcodes in the `W_base` set.

Making the feature a precompile rather than an opcode gives L2s flexibility to decide whether to implement it.

### ZK-VM proving

The TXINDEX precompile should not increase the complexity of proving EVM execution, as it is similar to existing opcodes such as GAS. If a whole block is proven then no additional inputs to the circuit are required to prove transaction indices, as they can be inferred from the transaction ordering. If a transaction is proved individually then the index must be provided as an input to the circuit, along with the remaining gas for GAS, and more for other introspective opcodes.

## Backwards Compatibility

No backward compatibility issues found.
Expand Down
8 changes: 6 additions & 2 deletions EIPS/eip-7843.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ The gas cost for `SLOT` is a fixed fee of `2`.

The slot number is calculated in the consensus layer and passed to the execution layer through the engine API.

#### newPayload change
#### Header extension

The `engine_newPayload` endpoint shall include a new parameter `slot_number` of type `uint64`.
The header encoding shall be extended to include a `slot_number` field of type `uint64`.

#### PayloadAttributes change

Expand All @@ -65,6 +65,10 @@ Making the feature a precompile rather than an opcode gives L2s flexibility to d

The slot number could alternatively be calculated in the execution layer using the timestamp, but it is more appropriate to calculate values pertaining to the beacon chain in the consensus layer. Additionally this avoids code duplication, as the slot number is already calculated in the consensus layer.

### ZK-VM proving

The SLOT precompile should not increase the complexity of proving EVM execution, as it is similar to existing opcodes such as TIMESTAMP. The slot number is included in the block header rather than as a `new_payload` parameter, ensuring that the block is self-contained for proving; no extra inputs to the circuit are required.

## Backwards Compatibility

No backward compatibility issues found.
Expand Down

0 comments on commit 4471fbc

Please sign in to comment.