Add a precompile to help dapps verify verkle proofs
|Authors||Guillaume Ballet (@gballet), ...|
Table of Contents
This EIP proposes the addition of a precompiled contract to provide up-to-date state proof verification capabilities to smart contracts in a stateless Ethereum context.
The proposed proof systems for stateless Ethereum require an upgrade to many tools and applications, that need a simple path to keep their proving systems up-to-date, without having to develop and deploy new proving libraries each time another proof format must be supported.
The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119 and RFC 8174.
A precompiled contract is added at address
0x21, wrapping the stateless ethereum proof verification function.
input requires 4 items concatenated:
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.
state_root(32 bytes) specifies the state root that the proof is proving against.
Pseudo-code behavior of the precompile:
def proof_verification_precompile(version, loc, size, root): if version == 0: proof = deserialize_proof(root, memory[loc:loc+size]) return verify_multiproof_pcs(proof) return 0
0 then the proof is expected to follow the SSZ format described in “the verge” proposal in the consensus spec.
The precompile returns
1 if it was able to verify the proof, and
The precompile cost is:
cost = (POINT_COST + 1)*len(get_commitments(input)) + POLY_EVAL_COST * [leaf_depth(key, get_tree(input)) for key in get_keys(input))]
get_commitmentsextracts the list of commitments in the proof, as encoded in
get_keysextracts the list of keys in the proof, as encoded in
leaf_depthreturns the depth of the leaf in the tree
get treereconstruct a stateless view of the tree from
Stateless Ethereum relies on proofs using advanced mathematical concepts and tools from a fast-moving area of cryptography. As a result, a soft-fork approach is currently favored in the choice of the proof format: proofs are going to be distributed outside of consensus, and in the future, stateless clients will be able to chose their favorite proof format.
This introduces a burden on several application, e.g. bridges, as they will potentially need to support proof formats designed after the release of the bridge contract.
Delegating the proof verification burden to a version-aware precompile will ensure that these applications can support newer proving primitives without having to upgrade their contracts.
No backward compatibility issues found.
Copyright and related rights waived via CC0.
Please cite this document as:
Guillaume Ballet (@gballet), ..., "EIP-7545: Verkle proof verification precompile [DRAFT]," Ethereum Improvement Proposals, no. 7545, October 2023. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7545.