Skip to content

Commit

Permalink
Update EIP-7545: clarify precompile interface
Browse files Browse the repository at this point in the history
Merged by EIP-Bot.
  • Loading branch information
gballet authored Dec 17, 2023
1 parent d88d99f commit bcb19a7
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions EIPS/eip-7545.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
eip: 7545
title: Verkle proof verification precompile
description: Add a precompile to help dapps verify verkle proofs
author: Guillaume Ballet (@gballet), ...
author: Guillaume Ballet (@gballet), Diederik Loerakker (@protolambda)
discussions-to: https://ethereum-magicians.org/t/verkle-proof-verification-precompile/16274
status: Draft
type: Standards Track
Expand All @@ -24,20 +24,27 @@ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "S

A precompiled contract is added at address `0x21`, wrapping the stateless ethereum proof verification function.

The precompile `input` requires 4 items concatenated:
The precompile's `input` is the tightly packed concatenation of the following fields:

* `version` (1 byte) specifies which version of the stateless proof verification function should be used
* `proof_data_location` (32 bytes) is a memory address where the start of the proof data can be found
* `proof_data_size` (8 bytes) specifies the length of the proof data.
* `version` (1 byte) specifies which version of the stateless proof verification function should be used. Version 0 is used for an MPT and version 1 is used for the polynomial commitment scheme multiproof used in [EIP-6800](./eip-6800.md).
* `state_root` (32 bytes) specifies the state root that the proof is proving against.
* `proof_data` (arbitrary long) is the proof data.

Pseudo-code behavior of the precompile:

```python
def proof_verification_precompile(version, loc, size, root):
def proof_verification_precompile(input):
version = input[0]
state_root = input[1:33]
proof_data = input[33:33+proof_data_size]

if version == 0:
proof = deserialize_proof(root, memory[loc:loc+size])
return verify_multiproof_pcs(proof)
proof = deserialize_proof(state_root, proof_data)
return verify_mpt_multiproof(proof)

if version == 1:
proof = deserialize_proof(state_root, proof_data)
return verify_pcs_multiproof(proof)

return 0
```
Expand Down Expand Up @@ -82,7 +89,9 @@ TODO

## Reference Implementation

TODO
WIP

* First implementation in Optimism, pull request #192 of ethereum-optimism/op-geth by @protolambda

## Security Considerations

Expand Down

0 comments on commit bcb19a7

Please sign in to comment.