EIP-7702: delegation wins on precompile addresses — diverges from geth/revm (consensus split)

オープン
#1,728 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
22/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
blockchain, cpp
領域
blockchain

調査の方向性

Read test/state/host.cpp (the EVMC_DELEGATED skip around is_precompile / call_precompile) and instructions_calls.cpp get_target_address. Confirm intended precompile-vs-7702 priority from EIP-7702 and execution-specs before changing code. If precompile should win, stop skipping precompiles when delegated; also allow designator-on-precompile fixtures in statetest_loader and add Prague+ tests on 0x01/0x05/0x0a/0x0100. Done is alignment with the spec (and other clients), not a local guess.

索引モデルが issue の本文から書いたものです。

説明

Hi — during a precompile differential campaign we confirmed a
consensus-relevant call-target split when an EIP-7702 designator is installed on a
precompile address.

Summary

Same pre-state + same tx + same fork (Prague+):

Client CALL 0x01 when 0x01 holds 0xef0100‖delegate
geth v1.17.5-128-ga5b90d2a2 runs ecrecover precompile → returndata empty (invalid sig)
revm v118-6 (reth default; source) runs ecrecover precompile
evmone v0.23.0-51-gee0bf394 runs delegate code → returndata 0xdeadbeef…

Measured on evmone at Prague, Osaka, and Amsterdam — delegation wins in all three.

Root cause

evmone test/state/host.cpp:

// Calls to precompile address via EIP-7702 delegation execute empty code instead of precompile.
if ((msg.flags & EVMC_DELEGATED) == 0 && is_precompile(m_rev, msg.code_address))
    return call_precompile(m_rev, msg);

EVMC_DELEGATED is set in instructions_calls.cpp get_target_address when the
account code is a 7702 designator — including when code_address is a precompile.

geth core/vm/evm.go Call:

p, isPrecompile := evm.precompile(addr)
...
if isPrecompile {
    ret, gas, err = RunPrecompiledContract(...)
} else {
    code := evm.resolveCode(addr)  // 7702 only here
    ...
}

revm uses bytecode_address = to and runs precompiles.get(&bytecode_address) before bytecode.

Auth validation accepts this setup on all three: precompile stored code is empty, so
"code empty or already delegated" passes.

Note: evmone statetest_loader rejects JSON fixtures with code at precompile addresses
(unexpected code at precompile address), so this shape does not show up in evmone
statetest CI — but Host still implements delegation-wins.

Repro

Pre-state:

  • delegate 0xd00d: 0x7fdeadbeef…60005260206000f3 (RETURN 32-byte deadbeef)
  • 0x01: 0xef0100000000000000000000000000000000000d

Tx: CALL 0x01, empty input, Prague+.

geth evmone
Executed ecrecover delegate 0xd00d
Returndata empty deadbeef…
Gas ~3000 contract cost

Full probe sources and raw logs are available on request (archive results-9-19/poc/*7702*, raw-results/*7702*).

Impact

  • Consensus split on gas, returndata, logs, and post-state.
  • If delegation wins, arbitrary code can sit at a precompile address — contracts that assume CALL 0x01 = ecrecover observe attacker-controlled return data.
  • Spec does not pin precompile-vs-delegation priority when a designator is on a precompile address.

Asks

  1. Confirm intended behavior for designator-on-precompile (cite EIP-7702 / execution-specs if specified).
  2. If precompile should win (geth/revm behavior): drop the EVMC_DELEGATED skip when is_precompile(rev, code_address).
  3. If delegation should win: geth/revm need to change — please coordinate an execution-specs PR.
  4. Alternative: reject 7702 auth whose authority is a precompile address in all clients.
  5. Add state-transition tests for designator on 0x01 / 0x05 / 0x0a / 0x0100 at Prague+; allow such fixtures in the statetest loader if Host supports them.

Happy to provide probes, raw logs, and a state-test JSON.

Four-client note (2026-09-20): besu 7e05c23424 and nethermind fe11e1c029 both resolve precompile first when a designator sits on a precompile address (besu MessageCallProcessor.start; nethermind IsPrecompile short-circuit in CodeInfoRepository). With geth and revm this is four production clients precompile-wins vs evmone delegation-wins. Details in besu-nethermind-7702-precompile.md.

主要言語
C++
スター
979
フォーク
340
平均マージ
12時間 16分
マージ済み PR(30日)
25

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ipsilon/evmone のほかの issue

ipsilon/evmone の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。