Skip to content

feat(spec-specs,test-types,tests): replace the EIP-8141 signature list with proof frames - #4108

Closed
Marchhill wants to merge 34 commits into
ethereum:forks/bogotafrom
Marchhill:feature/eip8141-proof-frames
Closed

Marchhill wants to merge 34 commits into
ethereum:forks/bogotafrom
Marchhill:feature/eip8141-proof-frames

Conversation

@Marchhill

@Marchhill Marchhill commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Description

Implements EIP-8141 PROOF frames (ethereum/EIPs#12714 at 9c7074e01b), replacing the signature list, with tests.

Spec:

  • PROOF mode 4 with PROOF_COMMIT_FLAG (0x8) and PROOF_READ_FLAG (0x10), and the static constraints: proof frames lead, no state gas, a 64-byte claim with a nonzero key, and a committed proof names an explicit msg.
  • Pure context for the verifier: an instruction allowlist, STATICCALL only to active precompiles, a 7702 delegation halts, its own EIP-2929 access sets, and the full limits.execution charged.
  • Verifier precompiles at placeholder addresses 0x81a1/0x81a2/0x81a3: SECP256K1 (3000), P256 (6900), LEANSPHINCS (13200).
  • PROOFPARAM (0xb4), TXPARAM_PROOF_COUNT, the readable-proof rule for FRAMEDATALOAD/FRAMEDATACOPY, the default code's proof_index, the proof elision in compute_sig_hash, and proofs priced by length.

Tests:

  • Frame.proof(...); a sender holding a key gets a leading proof frame, and default-code VERIFY frames point at it. The existing EIP-8141 tests move onto proof frames.
  • New: every static constraint and flag, each verifier precompile (valid, malformed, invalid, gas boundaries), contract verifiers (cold access, delegated and missing targets, calldata, the sender as verifier), the pure context, the signature hash, readable proofs (also from a nested call), PROOFPARAM/FRAMEPARAM, and receipts.
  • Accounts authorized by claims, over the secp256k1, P256 and leanSPHINCS precompiles and a contract verifier: counterfactual [proof, deploy, self_verify] deployment, self-paid or sponsored; rejection of another key's claim and of the owner's key under an accept-all verifier; EIP-1271-style attestations read with PROOFPARAM; an EOA migrated with a 7702 delegation.
  • LeanSphincsKey signs proof frames with py-lean-pq.

Notes:

  • leanSPHINCS is EthLib's Cryptography/Sphincs at f0e41b61, as the EIP pins it. ethereum.crypto.lean_sphincs verifies through py-lean-pq 0.19.2 (built from leanVM's bindings/ at bindings-v0.19.2, 17cb5cc6), which reproduces all 35 of EthLib's sphincs vectors; a unit test checks EthLib's known answer.
  • A proof frame's verifier read lands in the block access list; the EIP doesn't say.

fill passes for the EIP-8141 suite (1906 fixtures). NethermindEth/nethermind#16461 passes all of them (state, blockchain and engine), leanSPHINCS included.

Checklist

  • Ran fast static checks to avoid CI fails, see Code Standards & Verifying Changes: just static
  • PR title has the form <type>(<area>): <description>, where <type> and <area> come from an appropriate C-<type>, respectively A-<area>, label. The title should match the target squash commit message.

@gurukamath

gurukamath commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Is this ready for review? @Marchhill

PS: Also, we recently merged the eips/bogota/eip-8141 branch into trunk (forks/bogota) since the EIP is SFI'd. Could we re-target this to forks/bogota?

@gurukamath gurukamath left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial review of the spec changes. Will do a deeper review later

@Marchhill
Marchhill changed the base branch from eips/bogota/eip-8141 to forks/bogota December 2, 2026 10:01
…t with proof frames

Implement PROOF frames per ethereum/EIPs#12714: leading proof frames
prove claims with a verifier called in the pure context, the canonical
signature hash elides their proofs, and the SECP256K1, P256 and
leanSPHINCS verifier precompiles (placeholder addresses 0x81a1-0x81a3)
replace the signature schemes. Add PROOFPARAM, the PROOF_COMMIT and
PROOF_READ flags, the readable-proof rule for FRAMEDATALOAD and
FRAMEDATACOPY, and the default code's proof_index.

Move the test types and the existing EIP-8141 tests onto proof frames:
a sender holding a key gets a leading proof frame by default.
Cover the proof frame static constraints, each verifier precompile with
valid and invalid proofs and its gas edges, contract verifiers (cold
access, empty and delegated targets, calldata), every instruction the
pure context bans, the canonical signature hash with committed and
uncommitted proofs, readable proofs, PROOFPARAM, FRAMEPARAM of proof
frames, the default code's proof_index, and receipts charging each
proof frame its full budget.
Re-port `ethereum.crypto.lean_sphincs` from the Cryptography/Sphincs
module of ethereum/EthLib at f0e41b61, which EIP-8141 names as the
normative scheme, in place of leanVM's crate. Each section follows one
EthLib module (Constants, Types, Address, TweakableHash, Encoding, Ots,
Tree, Fors, Digest, Verify, Serialization) with its names, and
verification takes a decoded public key and signature.

Add EthLib's KeyGen and Sign to the testing package with a
`LeanSphincsSigner`, so proof frames can carry leanSPHINCS signatures
over the canonical signature hash. Vendor all 35 EthLib sphincs vectors,
rebuilt and checked against EthLib's SHA256SUMS: key generation,
signing and verification reproduce every one byte for byte.
Replace the pure-Python leanSPHINCS port with a thin wrapper around
py-lean-pq 0.11.1, leanVM's bindings (leanVM 28368657, after its FIPS
205 layout at 5e3ade21), and pin the scheme in the docstring to EthLib's
Cryptography/Sphincs at f0e41b61, as EIP-8141 does.

Sign in the testing framework with a `LeanSphincsKey` grown from a
32-byte seed, which proof frames take as a signer, and drop the
pure-Python signer, the vendored vectors and the precomputed signature
JSON. One test checks the key against EthLib's known answer through
EthLib's SHA256SUMS.
`resolve_frames` treated a proof frame whose empty target resolves to
the sender as warm. A proof frame's own access sets hold only the
precompiles, so its entry access charge for the sender is cold.
Port the account scenarios of the signature-list draft onto proof
frames, parametrized over the secp256k1, P-256 and leanSPHINCS verifier
precompiles and a contract verifier: counterfactual deployment with
`[proof, deploy, self_verify]`, self-paid or sponsored; rejection of
another key's claim and of the owner's key under an accept-all
verifier; EIP-1271-style attestations read with PROOFPARAM; and an EOA
migrated with an EIP-7702 delegation.

Add the uncovered rules: a proof frame with an empty target runs the
sender as its verifier, charged cold, with PROOFPARAM reporting it; and
a readable proof stays readable from a call a VERIFY frame makes.
Raise the halt after the instruction's OpStart trace, so it is attributed to the instruction, and use a dedicated ExceptionalHalt for both a banned instruction and a STATICCALL to a non-precompile.
An instruction a later EIP introduces then halts in the pure context unless that EIP admits it, as EIP-8141 requires.
…kage

Give each verifier precompile a module with a Markdown docstring, and drop the RST contents block from the leanSPHINCS module's docstring.
@Marchhill
Marchhill force-pushed the feature/eip8141-proof-frames branch from e96626d to 1b44a7a Compare December 2, 2026 10:08
@gurukamath gurukamath added this to the Bogota-Devnet-3 milestone Dec 2, 2026
@gurukamath gurukamath linked an issue Dec 2, 2026 that may be closed by this pull request
@qu0b

qu0b commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

core implementation looks solid and matches ethereum/EIPs#12714 (9c7074e01b). fill passes all 1,906 fixtures in tests/bogota/eip8141_frame_transactions/ and the 955 framework unit tests.

a few blockers and test bugs to fix before merge:

  1. 112 existing Bogota fixtures fail across 4 with_all_precompiles suites after adding 0x81a1/0x81a2/0x81a3 to EIP8141.precompiles():
    • tests/amsterdam/eip7928_block_level_access_lists/test_block_access_lists.py::test_bal_precompile_funded (30 failures: precompile_min_input falls back to empty calldata, halting the verifiers; needs real vectors like in proof_helpers.py)
    • tests/amsterdam/eip2780_reduce_intrinsic_tx_gas/test_value_moving_transactions.py::test_value_move_to_precompiles (36 failures: same in _precompile_calldata, reverting transfer and dropping the EIP-7708 log)
    • tests/spurious_dragon/eip161_state_trie_clearing/test_touched_account_emptiness.py::test_extcodehash_after_precompile_touch (36 failures: REJECTS_EMPTY_INPUT needs 0x81a1/0x81a2/0x81a3)
    • tests/byzantium/eip214_staticcall/test_staticcall.py (10 failures on 0x81a1 + nonzero_value + *_frame_tx variants: Transaction._prove_sender (transaction_types.py:1237-1238) adds the leading proof frame so 0x81a1 lands in the BAL while expected_block_access_list expects 0x81a1: None. looks like the same issue worked around manually in test_value_transfer.py:194-197; general fix probably belongs in convert_to_frame_transaction_variant)
  2. Two bugs in the new tests:
    • p256_invalid_proof off_curve (test_proof_frames.py:449-451) tweaks qy without updating key, so p256.py:63 fires on key mismatch and p256.py:67-72 (coordinate range, point at infinity, and on-curve check) are never reached by any test. needs matching key = keccak(qx||qy)[12:] for off_curve, qx >= P, qy >= P, and (0, 0), plus s == 0 / s == N//2 boundaries (and r == SECP256K1N / non-square r / s == N//2 on secp256k1).
    • test_pure_context_opcodes (test_proof_frames.py:1022-1024, 1058-1066) pushes zeros for CALL/CALLCODE/DELEGATECALL, so they target 0x0 rather than a precompile. a client that wrongly allows those calls to precompiles in pure context would still pass; add cases targeting 0x04 or 0x81a1.
  3. BAL alignment & coverage gaps:
    • verify_claim (vm/frame_interpreter.py:438) records 0x81a1/0x81a2/0x81a3 in the BAL via get_account after the entry gas charge. EIP-7928 already requires called precompiles in the BAL, while eip-8141.md:234 invites fast-pathing precompile proof frames outside the EVM (opened 8141: pure-context ECRECOVER under EIP-8151, EIP-8298 verifier notes lightclient/EIPs#18 to clarify). test_block_access_lists.py:419 should also assert presence of 0x81a1/0x81a2/0x81a3, contract verifiers, and STATICCALLed precompiles instead of only checking 0x01/0x100 absence.
    • test_signature_constraints_transaction was deleted without a transaction_test replacement for test_proof_frame_static_constraints.
    • add direct EVM CALL/STATICCALL tests against all three verifier precompiles (including from a normal non-frame tx) pinning exact gas with unused gas returned to caller on success, full sub-call gas burn + empty returndata on invalid input, and literal zero-msg verification outside PROOF frames.
    • add pure-context STATICCALL to inactive precompile-range addresses (0x81a0/0x81a4/0x12) and to an EOA delegated to a precompile, plus DUPN/SWAPN/EXCHANGE/RETURNDATACOPY in test_pure_context_opcodes, zero-proof-frame TXPARAM(0x0B) == 0 / PROOFPARAM(0, *) halt, and FRAMEDATA* offset 0 / OOB reads on readable proofs.
  4. Nits: TYPE_6_INVALID_SIGNATURE (exceptions/exceptions/transaction.py:203-207) is now dead across client mappers; a few stale "signature entry" comments remain (gas_costs.py:79, test_block_access_lists.py:46,49, test_admission_validity.py:182, test_static_validity.py:806, test_target_resolution.py:534, test_transactions.py:465,879); and bump ref_spec_8141 (spec.py:29) once #12714 lands.

…nputs

The with_all_precompiles suites called the verifier precompiles with empty
or zeroed input, which halts them. Sign a valid claim for each through
proof_verifier_input, and list the verifiers among the precompiles that
reject empty input.
… the BAL

The frame_tx rewrite proves the sender in a proof frame that calls the
secp256k1 verifier, which EIP-7928 records. Turn an expected absence of
that verifier into an expected read, rather than leaving each test to
work around it.
…t calls

A P-256 variant replacing the public key now names the new key in its
claim, so the coordinate range, infinity and on-curve checks are reached
instead of the key mismatch. Add the r and s boundaries on both curves,
including a valid signature with s = N // 2 and an r with no curve point.

Cover CALL, CALLCODE and DELEGATECALL to an active precompile, STATICCALL
to unassigned precompile-range addresses and to an account delegated to a
precompile, and the EIP-8024 stack instructions and RETURNDATACOPY.
Expect each verifier precompile, a contract verifier, and a precompile
the contract verifier STATICCALLs in the block access list, alongside
the existing absence of ecrecover and P256VERIFY.
Pin from a contract, in a plain and a frame transaction, that a call
consumes exactly the verifier's cost and returns the word 1, that one
short of the cost or an invalid proof burns the call's gas and returns
nothing, and that a zero msg is verified literally.
…ATA reads

With no proof frame, TXPARAM counts zero and PROOFPARAM on frame 0
halts. A VERIFY frame reading a readable proof gets the key at offset 0
and zero-padded words past the data's end.
…NATURE

Proof frames replaced the signature list: a proof that does not hold
invalidates execution and a malformed one is a format failure, so no
fixture expects a signature exception any more.
…es and claim length once

Tie the verifier precompile costs and the proof frame entry charge that
Frame.proof budgets to the fork's gas costs with a unit test.
A zero msg on the wire stands for the canonical signature hash, so a
proof over the zero digest could never hold.
A zero msg with a proof over the zero digest, and an explicit msg with a
proof over the canonical signature hash, must both fail the claim.
Derive the admitted side from fork.valid_opcodes() so that refusing any
admitted instruction fails the fill, and halt LOG1-LOG4 as well as LOG0.
@gurukamath

Copy link
Copy Markdown
Contributor

@Marchhill The proposal spec has moved towards protocol verifiers instead of precompiles and HASCLAIM instead of PROOFPARAM. Have created this PR to incorporate these changes. PTAL

Marchhill#6

@codecov

codecov Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.25784% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.40%. Comparing base (4220d10) to head (9ff6996).
⚠️ Report is 7 commits behind head on forks/bogota.

Files with missing lines Patch % Lines
src/ethereum/crypto/lean_sphincs.py 87.50% 1 Missing and 1 partial ⚠️
src/ethereum/forks/bogota/vm/instructions/frame.py 93.93% 1 Missing and 1 partial ⚠️
...eum/forks/bogota/transactions/frame_transaction.py 98.43% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@               Coverage Diff                @@
##           forks/bogota    #4108      +/-   ##
================================================
+ Coverage         95.31%   95.40%   +0.08%     
================================================
  Files               677      682       +5     
  Lines             41907    41992      +85     
  Branches           3939     3945       +6     
================================================
+ Hits              39944    40061     +117     
+ Misses             1370     1354      -16     
+ Partials            593      577      -16     
Flag Coverage Δ
unittests 95.39% <98.25%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bt-recneps bt-recneps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran five spec mutants against the 8141 suite: proof_index shape, FRAMEPARAM gating, access sets, the cap and legacy v all survive :(

Reviewed in 1h 02m

Comment on lines +1623 to +1624
case "index_past_proofs":
data = b"\x02"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index_past_proofs names the one-byte VERIFY frame, which never matches the claim, so default code that skips the proof-mode check on proof_index still passes.

Suggested change
case "index_past_proofs":
data = b"\x02"
case "index_past_proofs":
own = Frame.default(
target=Spec.SECP256K1_VERIFIER,
data=bytes(sender).rjust(32, b"\x00") + bytes(32),
)
data = b"\x01"

Comment on lines +1862 to +1868
verifier, proof=b"\x01" * 10, gas_limit=50_000, read=True
)
params = {
Spec.FRAMEPARAM_RESOLVED_TARGET: verifier,
Spec.FRAMEPARAM_EXECUTION_GAS_LIMIT: 50_000,
Spec.FRAMEPARAM_MODE: int(Spec.MODE_PROOF),
Spec.FRAMEPARAM_FLAGS: int(Spec.PROOF_READ_FLAG),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only FRAMEPARAM read of a proof frame sets PROOF_READ_FLAG, so a client that gates FRAMEPARAM behind that flag still passes, though the EIP lets every frame read it.

Suggested change
verifier, proof=b"\x01" * 10, gas_limit=50_000, read=True
)
params = {
Spec.FRAMEPARAM_RESOLVED_TARGET: verifier,
Spec.FRAMEPARAM_EXECUTION_GAS_LIMIT: 50_000,
Spec.FRAMEPARAM_MODE: int(Spec.MODE_PROOF),
Spec.FRAMEPARAM_FLAGS: int(Spec.PROOF_READ_FLAG),
verifier, proof=b"\x01" * 10, gas_limit=50_000, commit=True
)
params = {
Spec.FRAMEPARAM_RESOLVED_TARGET: verifier,
Spec.FRAMEPARAM_EXECUTION_GAS_LIMIT: 50_000,
Spec.FRAMEPARAM_MODE: int(Spec.MODE_PROOF),
Spec.FRAMEPARAM_FLAGS: int(Spec.PROOF_COMMIT_FLAG),

sender = pre.deploy_contract(account_code(owner), balance=10**18)
target = pre.deploy_contract(BODY_CODE)
if forger == "other_key":
proof = make_owner(scheme, pre, 2).proof()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For scheme_contract, make_owner(scheme, pre, 2) deploys a second verifier, so the account rejects on the verifier and the key check this case names is never reached.

Suggested change
proof = make_owner(scheme, pre, 2).proof()
other = make_owner(scheme, pre, 2).signer
proof = Owner(other, owner.verifier).proof()

case "v_2":
proof = tampered_secp256k1(proof, v=2)
case "v_27":
proof = tampered_secp256k1(proof, v=27)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this signer, v = 27 maps to the other recovery id and fails on the key, so a verifier that accepts legacy v values of 27 and 28 still passes.

Suggested change
proof = tampered_secp256k1(proof, v=27)
proof = tampered_secp256k1(proof, v=27 + proof[0])

address = pre.fund_eoa(amount=0, delegation=Address(0x04))
case _:
raise ValueError(callee)
code = Op.POP(Op.STATICCALL(gas=50_000, address=address)) + Op.STOP

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No test pins the warm charge of a contract verifier's STATICCALL to a precompile, so add exact and one-short budget cases next to test_pure_context_staticcall.

Comment on lines 768 to 771
# The gas boundary tests use a contract sender: contract senders carry
# no signature entries, so the transaction's intrinsic cost reduces to
# no proof frames, so the transaction's intrinsic cost reduces to
# the base and per-frame constants plus its data tokens, keeping the
# boundary arithmetic exact and content-independent.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The EIP-7825 cap tests use only proof-less contract senders, so add at-cap and above-cap cases whose excess comes from a proof frame's limits.execution.

@gurukamath

Copy link
Copy Markdown
Contributor

CIFO #4123

@gurukamath gurukamath closed this Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EIP-8141 Implement PROOF frame

4 participants