feat(rpc): update testing_buildBlockV1 to match latest spec#22276
Open
feat(rpc): update testing_buildBlockV1 to match latest spec#22276
Conversation
Updates the testing_buildBlockV1 RPC implementation to match the latest execution-apis spec (PR #747): - Use positional params (parentBlockHash, payloadAttributes, transactions, extraData) instead of a single request object - Make transactions nullable (Option<Vec<Bytes>>): null means build from mempool (returns error for now, not yet supported) - Duplicate TestingBuildBlockRequestV1 in reth to avoid breaking the alloy type Amp-Thread-ID: https://ampcode.com/threads/T-019c6be8-84fe-755e-881f-37b7fc990875 Co-authored-by: Amp <amp@ampcode.com>
Contributor
|
When transactions=null, build a block from the local transaction pool instead of returning an error. Uses the same pool tx selection logic as pending block building: - Gas limit capacity checks with mark_invalid - Blob gas accounting with skip_blobs - Private transaction filtering - EIP-7934 block size limit checks - Nonce-too-low skipping (without pruning descendants) - Fatal vs validation error distinction Also adds a Pool generic to TestingApi to avoid cascading Primitives = EthPrimitives bounds through the trait hierarchy. Amp-Thread-ID: https://ampcode.com/threads/T-019c6be8-84fe-755e-881f-37b7fc990875 Co-authored-by: Amp <amp@ampcode.com>
mattsse
reviewed
Feb 17, 2026
Comment on lines
+14
to
+20
| /// Request payload for `testing_buildBlockV1`. | ||
| /// | ||
| /// This is a reth-local duplicate of the alloy type, updated to match the latest | ||
| /// spec changes where `transactions` can be `null` (to build from mempool). | ||
| #[derive(Clone, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)] | ||
| #[serde(rename_all = "camelCase")] | ||
| pub struct TestingBuildBlockRequestV1 { |
Collaborator
There was a problem hiding this comment.
if this container is not part of the api, do we even need it? if not lets remove
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Updates
testing_buildBlockV1RPC to match the latest execution-apis spec.Motivation
The spec changed to use positional params and nullable transactions (null = build from mempool). Changing the alloy
TestingBuildBlockRequestV1type would be a breaking change, so we duplicate it locally in reth.Changes
crates/rpc/rpc-api/src/testing.rs: Define localTestingBuildBlockRequestV1withtransactions: Option<Vec<Bytes>>instead of re-exporting from alloy. RPC trait now uses 4 separate positional params.crates/rpc/rpc/src/testing.rs: Update impl to take separate params. Whentransactions=null, build block from mempool usingpool.best_transactions_with_attributes()— same tx selection logic as pending block building (gas limit checks, blob gas, EIP-7934 size limits, nonce-too-low handling, private tx filtering).crates/ethereum/node/src/node.rs: Pass pool toTestingApi::new()(TestingApinow takes aPoolgeneric).e2e-test-utils,reth-bench, integration tests) updated to pass positional params tuple and useSome(vec![...])for transactions.Testing
cargo checkpasses for all affected crates (reth-rpc-api,reth-rpc,reth-node-ethereum --tests,reth-e2e-test-utils,reth-bench).Prompted by: mattsse