EIP-7545 - Verkle proof verification precompile

Created 2023-10-13
Status Stagnant
Category Core
Type Standards Track
Authors

Abstract

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.

Motivation

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.

Specification

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.

The precompile's input is the tightly packed concatenation of the following fields:

Pseudo-code behavior of the precompile:

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(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

If version is 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 0 otherwise.

Gas costs

Constant name cost
POINT_COST TBD
POLY_EVAL_COST TBD

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))]

where:

Rationale

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.

Backwards Compatibility

No backward compatibility issues found.

Test Cases

TODO

Reference Implementation

WIP

Security Considerations

Needs discussion.

Copyright

Copyright and related rights waived via CC0.