-
Notifications
You must be signed in to change notification settings - Fork 12
Add stateful EST generator and executor + first generated XEN test #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
I need some help here, I likely have something setup wrong or have the wrong
I think the config of |
Ok, it's definitely something wrong loading the snapshot:
This is the snapshot downloaded from EthPandaOps. Logs: (I executed the
So it's somehow at chain head 0 🤔 EDIT: just discovered I can also read the logs from |
Ok, I have moved the |
OK so two things which are noted:
|
Summary
This PR adds two cooperating tools:
eest_stateful_generator.py
— a one-shot orchestrator that:mitmdump
reverse proxy for JSON-RPC,mitm_addon.py
— a mitmproxy addon that groups interceptedeth_sendRawTransaction
calls by test metadata and produces engine payloads without ever triggering a reorg (reorg is fully disabled for now).Both tools save artifacts under
payloads/
and extensive logs under/root/mitm_addon.log
(proxy) and/root/nethermind.log
(container logs).Why
Important engine behavior note (custom Nethermind image)
This setup uses a custom Nethermind image:
nethermindeth/nethermind:gp-hacked
That image intentionally implements a non-standard variant of
engine_getPayloadV4
:engine_getPayloadV4([txrlp_list_or_None, rpc_address_or_EMPTY])
), which is not per the EL Engine API spec.engine_forkchoiceUpdatedV3
carrying payload attributes.In other words, the block is produced immediately on
getPayload
, rather than first configuring payload attributes via FCU and then callinggetPayload
.What’s in this PR
eest_stateful_generator.py
mitm_config.json
for the addon, including a dynamicfinalized_block
.mitmdump
on:8549
with the addon and runs EST viauv
.--keep
).mitm_addon.py
eth_sendRawTransaction
by(file_base, test_name, phase)
derived from request metadata (id
JSON orX-EEST-ID
header).engine_getPayloadV4([txrlps, "EMPTY"])
, saves payload JSON topayloads/<file>/<test>/<phase>/<n>.json
, then submitsengine_newPayloadV4
andengine_forkchoiceUpdatedV3
with head/safe/finalized anchored.Step-by-step:
eest_stateful_generator.py
runtime flowParse arguments
Reads chain, test path, fork, RPC seed info, snapshot flags,
--keep
, etc.Bootstrap tools & repo
requests
is installed.execution-spec-tests
repo if missing.uv
is available, pins Python 3.11 for the repo, and runsuv sync --all-extras
.Snapshot prep
--no-snapshot
, downloads the latest Nethermind snapshot for the selected chain (via Docker/alpine) toexecution-data/
, unless it already exists and--refresh-snapshot
isn’t set.--no-snapshot
, ensuresexecution-data/
exists (empty).JWT setup
Writes a random
engine-jwt/jwt.hex
if missing.OverlayFS mount
overlay-upper/
,overlay-work/
,overlay-merged/
.lowerdir=execution-data, upperdir=overlay-upper, workdir=overlay-work
intooverlay-merged/
(usessudo
if not root).Nethermind container
eest-nethermind
.nethermindeth/nethermind:gp-hacked
with:/db
(overlay-merged
bind),:8551
, RPC on:8545
, JWT at/jwt/jwt.hex
,Health checks
127.0.0.1:8545
to accept TCP.eth_blockNumber
until RPC is responsive or fails with logs and cleanup.Chain ID
rpc_chain_id
from CLI; else mapping; elseeth_chainId
; else defaults to1
.Mitmproxy install
Ensures
mitmproxy
is available.Engine pre-seeding
payloads/gas-bump-*.json
) to increase gas limit to desired 1 TeraGas.--rpc-address
; captures the resultingblockHash
and uses it asfinalized_block
. Funding long.Max ETH amount so it is enough for any testing.Add-on config
mitm_config.json
with:rpc_direct = http://127.0.0.1:8545
engine_url = http://127.0.0.1:8551
jwt_hex_path = engine-jwt/jwt.hex
finalized_block = <block hash from funding prep>
Start mitmdump + addon
mitm_addon.py
is present.mitmdump
on:8549
in reverse mode to:8545
, with addon and conservative connection settings.:8549
to bind.Run EST
uv run execute remote -v --fork=<fork> --rpc-seed-key=<key> --rpc-chain-id=<id> --rpc-endpoint=http://127.0.0.1:8549 <tests_path> -- -m benchmark -n 1
in the EST repo.Teardown
--keep
:/root/nethermind.log
.overlay-*
dirs.mitmdump
.Done.
Artifacts produced
payloads/
:gas-bump-*.json
andfunding-*.json
(pre-seed),payloads/<file>/<test>/<phase>/<n>.json
./root/mitm_addon.log
(addon & proxy),/root/nethermind.log
(container logs).Step-by-step:
mitm_addon.py
runtime flowMITM_ADDON_CONFIG
env ormitm_config.json
).eth_sendRawTransaction
, derives(file_base, test_name, phase)
fromid
orX-EEST-ID
.engine_getPayloadV4([txrlps, "EMPTY"])
(custom image returns block immediately).payloads/<file>/<test>/<phase>/<n>.json
.engine_newPayloadV4
+engine_forkchoiceUpdatedV3
.global-setup
.Configuration & flags
Generator
--chain
(mainnet|sepolia|holesky|goerli|ethereum
; defaultmainnet
)--test-path
(path inside EST repo; defaulttests
)--fork
(e.g.,Prague
; defaultPrague
)--rpc-endpoint
(defaults to proxyhttp://127.0.0.1:8549
)--rpc-seed-key
(required) seed private key for EST funding--rpc-address
(required) address to pre-fund--rpc-chain-id
(override chain id)--no-snapshot
,--refresh-snapshot
--keep
(preserve container/mounts/logs)Addon
MITM_ADDON_CONFIG
→ path tomitm_config.json
: