Skip to content

feat(test-consume): add engine-witness simulator for witness verification#2724

Draft
spencer-tb wants to merge 1 commit into
ethereum:projects/zkevmfrom
spencer-tb:projects/zkevm/consume-engine-witness
Draft

feat(test-consume): add engine-witness simulator for witness verification#2724
spencer-tb wants to merge 1 commit into
ethereum:projects/zkevmfrom
spencer-tb:projects/zkevm/consume-engine-witness

Conversation

@spencer-tb

@spencer-tb spencer-tb commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

🗒️ Description

Fully vibe coded experimental.

Adds a new consume engine-witness Hive simulator that drives Amsterdam blockchain-engine fixtures through a witness-emitting Engine API endpoint and verifies the client-generated ExecutionWitness against the
fixture's expected witness.

Supports two transports on a single simulator:

Mode Endpoint Witness encoding Clients today
Default (no flag) JSON-RPC engine_newPayloadWithWitnessVX RLP go-ethereum
--ssz REST POST /new-payload-with-witness SSZ Ethrex feat/zkengine-http prototype only

Both paths converge on a shared NewPayloadWithWitnessResponse dataclass and the same assert_witness_matches helper. Clients that do not implement the chosen transport skip cleanly:

  • REST: HTTP 404 / 405 raises EngineWitnessEndpointNotImplementedError
  • JSON-RPC: -32601 Method not found is caught and turned into pytest.skip

The simulator also skips whole fixtures with no executionWitness on any payload (i.e. pre-Amsterdam forks).

Usage

Still to test!

# Fill witness-bearing fixtures
uv run fill tests/amsterdam/ --fork=Amsterdam --output=fixtures_witness

# Hive in dev mode (separate shell)
./hive --dev --client go-ethereum
export HIVE_SIMULATOR=http://127.0.0.1:3000

# Default: JSON-RPC + RLP (Geth)
uv run consume engine-witness --input=fixtures_witness

# Alternative: REST + SSZ (Ethrex zkengine-http branch)
uv run consume engine-witness --input=fixtures_witness --ssz

🔗 Related Issues or PRs

✅ Checklist

  • All: Ran fast static checks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:
    just static
  • All: PR title adheres to the repo standard - it will be used as the squash commit message and should start type(scope):.
  • All: Considered updating the online docs in the ./docs/ directory.
  • All: Set appropriate labels for the changes (only maintainers can apply labels).

Adds `consume engine-witness`, a Hive simulator that drives Amsterdam
blockchain-engine fixtures through a witness-emitting endpoint and diffs
the client-generated `ExecutionWitness` against the fixture's expected
witness (set-equality on state/codes/headers).

Supports two transports:

- Default: JSON-RPC `engine_newPayloadWithWitnessVX` with RLP witness
  (geth PR #30069, already implemented in go-ethereum and forks).
- `--ssz`: REST `POST /new-payload-with-witness` with SSZ witness
  (execution-apis PR ethereum#773, implemented on Ethrex `feat/zkengine-http`).

Both paths converge on a shared `NewPayloadWithWitnessResponse` dataclass
and the same assertion helper. Clients that do not implement the chosen
transport skip cleanly (HTTP 404/405 for REST, `-32601 Method not found`
for JSON-RPC).
@spencer-tb spencer-tb added zkEVM zkEVM project related issues/PRs C-feat Category: an improvement or new feature A-test-consume Area: execution_testing.cli.pytest_commands.plugins.consume labels Apr 20, 2026
@spencer-tb spencer-tb changed the title feat(consume): add engine-witness simulator for witness verification feat(test-consume): add engine-witness simulator for witness verification Apr 20, 2026


@pytest.fixture(scope="module")
def test_suite_name() -> str:

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.

Should this new name be added to

@pytest.fixture(scope="function")
def check_live_port(test_suite_name: str) -> Literal[8545, 8551]:
"""Port used by hive to check for liveness of the client."""
if test_suite_name == "eels/consume-rlp":
return 8545
elif test_suite_name in {
"eels/consume-engine",
"eels/consume-enginex",
"eels/consume-sync",
}:
return 8551
raise ValueError(
f"Unexpected test suite name '{test_suite_name}' while setting "
"HIVE_CHECK_LIVE_PORT."
)
?

"requires empty witness when not VALID)"
)

if payload.valid():

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.

Is this missing an else and some check payload.validation_error?

@github-actions

Copy link
Copy Markdown

This PR has had no recent activity and has been marked as stale.

@github-actions github-actions Bot added the stale The Issue/PR has not had any activity for 60 days. PRs will be automatically closed. label Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-test-consume Area: execution_testing.cli.pytest_commands.plugins.consume C-feat Category: an improvement or new feature P-low stale The Issue/PR has not had any activity for 60 days. PRs will be automatically closed. zkEVM zkEVM project related issues/PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants