chore(rpc): config network specific transaction type in node builder (#10417)

This commit is contained in:
Emilia Hane
2024-08-22 16:36:38 +02:00
committed by GitHub
parent 7fb9a04337
commit 7d8196e29c
54 changed files with 518 additions and 272 deletions

View File

@ -19,6 +19,9 @@ reth-rpc-eth-api.workspace = true
reth-engine-primitives.workspace = true
reth-network-peers.workspace = true
# ethereum
alloy-json-rpc.workspace = true
# misc
jsonrpsee = { workspace = true, features = ["server", "macros"] }

View File

@ -3,6 +3,7 @@
//! This contains the `engine_` namespace and the subset of the `eth_` namespace that is exposed to
//! the consensus client.
use alloy_json_rpc::RpcObject;
use jsonrpsee::{core::RpcResult, proc_macros::rpc};
use reth_engine_primitives::EngineTypes;
use reth_primitives::{Address, BlockHash, BlockId, BlockNumberOrTag, Bytes, B256, U256, U64};
@ -13,8 +14,8 @@ use reth_rpc_types::{
ForkchoiceState, ForkchoiceUpdated, PayloadId, PayloadStatus, TransitionConfiguration,
},
state::StateOverride,
BlockOverrides, EIP1186AccountProofResponse, Filter, JsonStorageKey, Log, RichBlock,
SyncStatus, TransactionRequest,
BlockOverrides, EIP1186AccountProofResponse, Filter, JsonStorageKey, Log, SyncStatus,
TransactionRequest,
};
// NOTE: We can't use associated types in the `EngineApi` trait because of jsonrpsee, so we use a
// generic here. It would be nice if the rpc macro would understand which types need to have serde.
@ -219,7 +220,7 @@ pub trait EngineApi<Engine: EngineTypes> {
/// Specifically for the engine auth server: <https://github.com/ethereum/execution-apis/blob/main/src/engine/common.md#underlying-protocol>
#[cfg_attr(not(feature = "client"), rpc(server, namespace = "eth"))]
#[cfg_attr(feature = "client", rpc(server, client, namespace = "eth"))]
pub trait EngineEthApi {
pub trait EngineEthApi<T: RpcObject, B: RpcObject> {
/// Returns an object with data about the sync status or false.
#[method(name = "syncing")]
fn syncing(&self) -> RpcResult<SyncStatus>;
@ -248,15 +249,11 @@ pub trait EngineEthApi {
/// Returns information about a block by hash.
#[method(name = "getBlockByHash")]
async fn block_by_hash(&self, hash: B256, full: bool) -> RpcResult<Option<RichBlock>>;
async fn block_by_hash(&self, hash: B256, full: bool) -> RpcResult<Option<B>>;
/// Returns information about a block by number.
#[method(name = "getBlockByNumber")]
async fn block_by_number(
&self,
number: BlockNumberOrTag,
full: bool,
) -> RpcResult<Option<RichBlock>>;
async fn block_by_number(&self, number: BlockNumberOrTag, full: bool) -> RpcResult<Option<B>>;
/// Sends signed transaction, returning its hash.
#[method(name = "sendRawTransaction")]