reth_rpc_api/testing.rs
1//! Testing namespace for building a block in a single call.
2//!
3//! This follows the `testing_buildBlockV1` specification. **Highly sensitive:**
4//! testing-only, powerful enough to include arbitrary transactions; must stay
5//! disabled by default and never be exposed on public-facing RPC without an
6//! explicit operator flag.
7
8use alloy_rpc_types_engine::ExecutionPayloadEnvelopeV5;
9use jsonrpsee::proc_macros::rpc;
10
11pub use alloy_rpc_types_engine::{TestingBuildBlockRequestV1, TESTING_BUILD_BLOCK_V1};
12
13/// Testing RPC interface for building a block in a single call.
14///
15/// # Enabling
16///
17/// This namespace is disabled by default for security reasons. To enable it,
18/// add `testing` to the `--http.api` flag:
19///
20/// ```sh
21/// reth node --http --http.api eth,testing
22/// ```
23///
24/// **Warning:** Never expose this on public-facing RPC endpoints without proper
25/// authentication.
26#[cfg_attr(not(feature = "client"), rpc(server, namespace = "testing"))]
27#[cfg_attr(feature = "client", rpc(server, client, namespace = "testing"))]
28pub trait TestingApi {
29 /// Builds a block using the provided parent, payload attributes, and transactions.
30 ///
31 /// See <https://github.com/marcindsobczak/execution-apis/blob/main/src/testing/testing_buildBlockV1.md>
32 #[method(name = "buildBlockV1")]
33 async fn build_block_v1(
34 &self,
35 request: TestingBuildBlockRequestV1,
36 ) -> jsonrpsee::core::RpcResult<ExecutionPayloadEnvelopeV5>;
37}