feat(test-cli): Add support for testing block building via simulator#2679
Conversation
- Test build building via ``testing_buildBlockV1``, validating the built block, and re-consuming against the client
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## forks/amsterdam #2679 +/- ##
===================================================
+ Coverage 86.25% 90.01% +3.75%
===================================================
Files 599 539 -60
Lines 37032 32618 -4414
Branches 3795 3030 -765
===================================================
- Hits 31943 29361 -2582
+ Misses 4525 2699 -1826
+ Partials 564 558 -6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Wire up slotnum for `testing_buildBlockV1` for `bal-devnet-3` branch We are experimenting testing block building through hive via EELS (PR [here](ethereum/execution-specs#2679)). This is the only change needed to test against `bal-devnet-3` - missing slotnum.
marioevz
left a comment
There was a problem hiding this comment.
Looks great! Just two comments to try to improve maintainability.
5852e2d to
795a4f9
Compare
|
@marioevz lmk if the last commit here is what you meant. I re-ran against geth |
There was a problem hiding this comment.
Thank you @fselmo for this feature! I leave some comment but they are all style-related issue.
For test_via_build.py, i think test_blockchain_via_build is too large as a single function and has too much nested logic. Could we split it into smaller helpers?
My proposal:
test_blockchain_via_build
-> bootstrap_engine_at_genesis: handle genesis block FCU, verify genesis hash
-> Extract valid payload and calls build_validate_and_advance for each payload
build_validate_and_advance
-> build block
-> validate block response and gas limit
-> proceed the chain with newPayload
-> update the chain with FCU
edit: two more things for the new command
- Could we add some docs for the new command?
- Should we PR to Hive for the new simulator?
danceratopz
left a comment
There was a problem hiding this comment.
Really nice!! 🔥
Nice review by @LouisTsai-Csie. In addition, I added one comment below about adding execution request verification for forks >= Prague.
About the naming, imo, I don't think this merits a new top-level command namespace and it that this rather belongs under consume, please see the comment below.
Docs
Also, could you please add some docs for this? Assuming you rename under consume, we could add it to:
docs/running_tests/running.mddocs/consume/simulators.md?
If we don't rename, then it will be trickier to find a spot to document this, but I think this demonstrates that it belongs to the consume family? But it could go in a new section docs/running_tests/build_block/index.md. But I'm strongly in favor of not adding a new top-level entry-point for this functionality.
System Test
Last request, could you add an e2e test in https://github.com/ethereum/execution-specs/blob/c9d8be0101c6649e060950317e14fb4f515f70e9/.github/workflows/hive-consume.yaml ? It should be pretty quick!
@danceratopz I gave my reasoning in your first comment but I'm curious why the strong favor here. Imo it muddies what |
|
The recent 2 commits fix all my review comment, but i think we still need the e2e tests: https://github.com/ethereum/execution-specs/blob/c9d8be0101c6649e060950317e14fb4f515f70e9/.github/workflows/hive-consume.yaml This could be done after we decided whether it should be an individual command or under consume family |
Totally fair and I agree it's a different breed of simulator! My consume rationale stems from the fact that this simulator loads a You have a different interpretation of "consume" (send blocks/payloads then validate against post state), which is also legitimate. I'm happy to reconcile my understanding of The following is out of scope for this PR, but it'd be great to have names that are intuitive,... in that spirit, I'll just float these ideas while we're on the topic... 😆 Perhaps the name consume itself is too overloaded? I think if we named it again (and perhaps we even can?), I would prefer to call the simulators (in hive path language; not CLI names) as:
I think we discussed this naming once, @spencer-tb. This would break everyone's CIs, but if we did it when (if) we make breaking changes to the release layout, then I think it'd be reasonable if it helps everyone's understanding. Then (as is currently in this PR) we could have:
Or if we think we'll have other build-block simulators, then
When it comes to the CLI command, a unified top-level entry point such as |
|
I honestly would like to think on naming conventions a bit harder. And align it with what ever " The hive versions:
Then the native cli version, replace
That being said, I'd lean on keeping what we have here and pushing for a naming overhaul/alignment once the fast cli runners are complete and actively in use! |
|
@fselmo happy to go with |
Hmm I'm not sure I understand what you and @LouisTsai-Csie mean here with e2e test because Either way I need both of you to remove your |
I won't manage a review until tomorrow, so if you want to add it in the meantime, you could add a new
Will do! :) |
b4a687a to
5902613
Compare
5902613 to
a884759
Compare
danceratopz
left a comment
There was a problem hiding this comment.
This is looking great. I took it for a spin locally and generally got it working well out the box for Geth/v1.17.4-unstable-da34eb59-20260513.
I did see some fails for tests that I'd filled (with -m eels_base_coverage --from Paris) on this branch, but I don't think it's worth reporting them in detail here. Ship it. I think these can be investigated and fixed in follow-ups.
| - name: Dev Mode Build Block | ||
| mode: dev | ||
| cli_command: build-block | ||
| test_filter: "Osaka and test_clz_stack_underflow" |
There was a problem hiding this comment.
I did wonder if there was a better test set to use here, something with multiple blocks? test_clz_stack_underflow is a state test, therefore single block.
| test_filter: "Osaka and test_clz_stack_underflow" | |
| test_filter: "Osaka and test_block_hashes_history" |
🗒️ Description
Adds a hive-based simulator that verifies EL clients build correct blocks via
testing_buildBlockV1For each payload in a blockchain_test_engine fixture, the test sends the expected transactions and block attributes to the client's block building endpoint. The resulting block is validated against the fixture's expected output (
state_root,receipts_root, etc). The fixture block is then imported viaengine_newPayloadVXto advance the chain for subsequent blocks.gas_limitis validated a bit different for now, sincetesting_buildBlockV1doesn't accept a gas limit parameter. The client picks its own within the EIP-1559 adjustment range so we validate it is within that range until we can actually account for the gas limit. For this reason,block_hashis also excluded from comparison as it depends ongas_limit.Also looking for recs on the naming (
uv run build-block). We could go withbuildby itself but it feels vague to me. That said, I can be easily convinced here 😄.🔗 Related Issues or PRs
closes #2560
✅ Checklist
just statictype(scope):.Cute Animal Picture