Skip to content

feat(rpc): update testing_buildBlockV1 to match latest spec#22276

Open
gakonst wants to merge 2 commits intomainfrom
mattsse/testing-build-block-v1-update
Open

feat(rpc): update testing_buildBlockV1 to match latest spec#22276
gakonst wants to merge 2 commits intomainfrom
mattsse/testing-build-block-v1-update

Conversation

@gakonst
Copy link
Member

@gakonst gakonst commented Feb 17, 2026

Summary

Updates testing_buildBlockV1 RPC 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 TestingBuildBlockRequestV1 type would be a breaking change, so we duplicate it locally in reth.

Changes

  • crates/rpc/rpc-api/src/testing.rs: Define local TestingBuildBlockRequestV1 with transactions: 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. When transactions=null, build block from mempool using pool.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 to TestingApi::new() (TestingApi now takes a Pool generic).
  • All call sites (e2e-test-utils, reth-bench, integration tests) updated to pass positional params tuple and use Some(vec![...]) for transactions.

Testing

cargo check passes for all affected crates (reth-rpc-api, reth-rpc, reth-node-ethereum --tests, reth-e2e-test-utils, reth-bench).

Prompted by: mattsse

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>
@github-actions
Copy link
Contributor

github-actions bot commented Feb 17, 2026

⚠️ Changelog not found.

A changelog entry is required before merging. We've generated a suggested changelog based on your changes:

Preview
---
reth-bench: patch
reth-e2e-test-utils: patch
reth-ethereum: patch
reth-rpc-api: minor
reth-rpc: minor
---

Updated `testing_buildBlockV1` RPC method to match latest spec where `transactions` parameter can be `null` to build blocks from the mempool, an empty array for empty blocks, or an array of transactions to force-include. Modified request structure and implementation to support mempool transaction selection with proper validation and gas limit enforcement.

Add changelog to commit this to your branch.

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>
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 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this container is not part of the api, do we even need it? if not lets remove

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants