Add stateful EST generator and executor + first generated XEN test#57
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:
|
…ermindEth/gas-benchmarks into kch/EEST-stateful-generator
…ermindEth/gas-benchmarks into kch/EEST-stateful-generator
…ermindEth/gas-benchmarks into kch/EEST-stateful-generator
* Implement mitmproxy addon for JSON-RPC interception * Add eest_stateful_generator.py for Ethereum state management * fix pip pkg * fix now? * fix dependency issue * fix * fix pythonpath * stateful tests generated * Add overlayFS support to gas-benchmarks and adjust the format of tests * Fix path resolution * Skip measuring not needed paylaods * Edit env and docker compose to work well with overlayFS * fix nethermind * Fix nethermin2 * fix nethermind 3 * Dummy replace with log flag if no genesis passed * mock temporarily gas value for Xen purpose * Change file names to 60M * run_and_post_mertics.py * add tempalte mechanism * Add missing parameter * Add proper waiting mechanism for rpc to be ready * Increase the timeout * Make sure containers are local * fix * add restart on testing flag * Add restart before testing flag * Fix nethermind flag * Extra klog to rpc waiter * Remove internal * add less * maybe fix * fix2 * Improve generator * Move Gas size to the end of test name * add gas values flag * generate ordering * improve order of execution * Add possibility to switch image * New schema * Better logging for Nethermind * Fixes * Add cleanup after test * Fix geth and logs * Change overlay directory location * comment out init * comment dependency * overlay renames handling * fix reth * 8545 enabled * trace logs geth * fix the ordering * Ensure with single gas limit and nothing in output gas will be filled * fix to generator * fix * fixes * Try new approach for test generation * fix * fix * skip cleanup * fixes * fix MGas * fix after adding --skip-cleanup * wait for request * cmd fixes * fix on overlay mountings * Fixes to remounting * log * fix * move second overlay later * wait for payload * Moce rewind of chain a bit later * fixes * Debug logs * Add trace log * chanhge the place of rewind * try fix * add seed sweep * small ammount * remove sweep * Revert to ifno * revert skip cleanup * Fix to reenable cleanup * fix * fix the ordering * speed up loop * fix * fix error * Proper rewind on cleanup * increase timeout a bit * faster building? * Faster2 * imrpovement + timing * timestamps * Apply speedup flag for eest * Improve test filtering * Internal Network * One minute wait * FIx besu * change besu block * Trace besu * p2p enabled for besu * Remove unnecessary flags in Besu * discovery disabled for besu * test * remove 1337 * remove init * revert init * fixes * fix run_and_ * remove init * depends remove * remove custom args * adjust reth * add rust log * reorgs behind flag * pull and branch selector * scenario ordering * Fix ordering * ordering fix * Fix ordering again * fix generator * run even if testing missing * Try again * Imporve eest tests capturing * Adjust generators * Gas bump configurable * Increase eest execute timeout * cange mroe defaults * Print balance * add execution time to postgres * fixes * fixes2 * remove not needed tests * Cleanup * try fixes * revert execution-sync for geth * palceholder * fix * fix customs * fix logs * try empty custom for reth * rethj init revert * fix reth? * fix geth * try improvements * invlaid erigon startup * fix erigon * add genesis file * fix erigon 214124124 * revamp tests * fix warmup generation * warmup tests for eest * fix ethrex and nimbus * fix nimbnus * maybe fix postgres * Fix geth maybe * cleanup * improve pipeline * try adding FCU to EEST compute * FCU fix * Try always zero FCU * regenrated tests * add duration --------- Co-authored-by: Marcin Sobczak <77129288+marcindsobczak@users.noreply.github.com> Co-authored-by: root <root@ns3254482.ip-217-182-92.eu>
Summary
This PR adds two cooperating tools:
eest_stateful_generator.py— a one-shot orchestrator that:mitmdumpreverse proxy for JSON-RPC,mitm_addon.py— a mitmproxy addon that groups interceptedeth_sendRawTransactioncalls 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-hackedThat 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_forkchoiceUpdatedV3carrying 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.pymitm_config.jsonfor the addon, including a dynamicfinalized_block.mitmdumpon:8549with the addon and runs EST viauv.--keep).mitm_addon.pyeth_sendRawTransactionby(file_base, test_name, phase)derived from request metadata (idJSON orX-EEST-IDheader).engine_getPayloadV4([txrlps, "EMPTY"]), saves payload JSON topayloads/<file>/<test>/<phase>/<n>.json, then submitsengine_newPayloadV4andengine_forkchoiceUpdatedV3with head/safe/finalized anchored.Step-by-step:
eest_stateful_generator.pyruntime flowParse arguments
Reads chain, test path, fork, RPC seed info, snapshot flags,
--keep, etc.Bootstrap tools & repo
requestsis installed.execution-spec-testsrepo if missing.uvis 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-snapshotisn’t set.--no-snapshot, ensuresexecution-data/exists (empty).JWT setup
Writes a random
engine-jwt/jwt.hexif missing.OverlayFS mount
overlay-upper/,overlay-work/,overlay-merged/.lowerdir=execution-data, upperdir=overlay-upper, workdir=overlay-workintooverlay-merged/(usessudoif not root).Nethermind container
eest-nethermind.nethermindeth/nethermind:gp-hackedwith:/db(overlay-mergedbind),:8551, RPC on:8545, JWT at/jwt/jwt.hex,Health checks
127.0.0.1:8545to accept TCP.eth_blockNumberuntil RPC is responsive or fails with logs and cleanup.Chain ID
rpc_chain_idfrom CLI; else mapping; elseeth_chainId; else defaults to1.Mitmproxy install
Ensures
mitmproxyis available.Engine pre-seeding
payloads/gas-bump-*.json) to increase gas limit to desired 1 TeraGas.--rpc-address; captures the resultingblockHashand uses it asfinalized_block. Funding long.Max ETH amount so it is enough for any testing.Add-on config
mitm_config.jsonwith:rpc_direct = http://127.0.0.1:8545engine_url = http://127.0.0.1:8551jwt_hex_path = engine-jwt/jwt.hexfinalized_block = <block hash from funding prep>Start mitmdump + addon
mitm_addon.pyis present.mitmdumpon:8549in reverse mode to:8545, with addon and conservative connection settings.:8549to 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 1in the EST repo.Teardown
--keep:/root/nethermind.log.overlay-*dirs.mitmdump.Done.Artifacts produced
payloads/:gas-bump-*.jsonandfunding-*.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.pyruntime flowMITM_ADDON_CONFIGenv ormitm_config.json).eth_sendRawTransaction, derives(file_base, test_name, phase)fromidorX-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:{ "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": "0x..." }