Skip to content

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

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

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
@JackCC703

JackCC703 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Hey, I’m interested in helping move this forward.

I noticed this PR’s REST+SSZ path is based on the earlier ethereum/execution-apis#773 design:

  • POST /new-payload-with-witness
  • JSON request body
  • custom NewPayloadWithWitnessResponse SSZ container

Since the newer REST-SSZ Engine API draft in ethereum/execution-apis#793 has moved toward /engine/v1/... with Eth-Execution-Version, and MariusVanDerWijden/execution-apis#1 folds the witness route into POST /engine/v1/payloads/witness with PayloadStatusWithWitness, would it be useful if I worked on a small follow-up to compare/update this simulator against the current draft?

I’m thinking of starting narrowly with the REST+SSZ branch :
update the endpoint assumptions and the SSZ response container shape

@jsign

jsign commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Hey, I’m interested in helping move this forward.

I noticed this PR’s REST+SSZ path is based on the earlier ethereum/execution-apis#773 design:

  • POST /new-payload-with-witness
  • JSON request body
  • custom NewPayloadWithWitnessResponse SSZ container

Since the newer REST-SSZ Engine API draft in ethereum/execution-apis#793 has moved toward /engine/v1/... with Eth-Execution-Version, and MariusVanDerWijden/execution-apis#1 folds the witness route into POST /engine/v1/payloads/witness with PayloadStatusWithWitness, would it be useful if I worked on a small follow-up to compare/update this simulator against the current draft?

I’m thinking of starting narrowly with the REST+SSZ branch : update the endpoint assumptions and the SSZ response container shape

This PR actaully should be closed, since it is already merged (with some fixes in projects/zkevm). I think your point of updating REST+SSZ still applies reg new formats. Maybe you can try doing a PR against projects/zkevm if youre interested in the update?

I'll close this PR to avoid confusion!

@jsign jsign closed this Jul 3, 2026
@JackCC703

Copy link
Copy Markdown
Contributor

Hey, I’m interested in helping move this forward.
I noticed this PR’s REST+SSZ path is based on the earlier ethereum/execution-apis#773 design:

  • POST /new-payload-with-witness
  • JSON request body
  • custom NewPayloadWithWitnessResponse SSZ container

Since the newer REST-SSZ Engine API draft in ethereum/execution-apis#793 has moved toward /engine/v1/... with Eth-Execution-Version, and MariusVanDerWijden/execution-apis#1 folds the witness route into POST /engine/v1/payloads/witness with PayloadStatusWithWitness, would it be useful if I worked on a small follow-up to compare/update this simulator against the current draft?
I’m thinking of starting narrowly with the REST+SSZ branch : update the endpoint assumptions and the SSZ response container shape

This PR actaully should be closed, since it is already merged (with some fixes in projects/zkevm). I think your point of updating REST+SSZ still applies reg new formats. Maybe you can try doing a PR against projects/zkevm if youre interested in the update?

I'll close this PR to avoid confusion!

OK, thanks! I will do it in projects/zkevm.

@jsign

jsign commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

cc @developeruche ^ fyi

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.

3 participants