mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore(rpc): expose ethapi in node builder for op customisation (#9444)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -46,7 +46,8 @@ use reth_node_api::{
|
||||
};
|
||||
use reth_node_core::{args::RpcServerArgs, node_config::NodeConfig};
|
||||
use reth_node_ethereum::node::{
|
||||
EthereumConsensusBuilder, EthereumExecutorBuilder, EthereumNetworkBuilder, EthereumPoolBuilder,
|
||||
EthereumAddOns, EthereumConsensusBuilder, EthereumExecutorBuilder, EthereumNetworkBuilder,
|
||||
EthereumPoolBuilder,
|
||||
};
|
||||
use reth_payload_builder::{
|
||||
error::PayloadBuilderError, EthBuiltPayload, EthPayloadBuilderAttributes, PayloadBuilderHandle,
|
||||
@ -212,8 +213,9 @@ where
|
||||
EthereumExecutorBuilder,
|
||||
EthereumConsensusBuilder,
|
||||
>;
|
||||
type AddOns = EthereumAddOns;
|
||||
|
||||
fn components_builder(self) -> Self::ComponentsBuilder {
|
||||
fn components_builder(&self) -> Self::ComponentsBuilder {
|
||||
ComponentsBuilder::default()
|
||||
.node_types::<N>()
|
||||
.pool(EthereumPoolBuilder::default())
|
||||
|
||||
@ -22,7 +22,7 @@ use reth_chainspec::{Chain, ChainSpec, Head};
|
||||
use reth_evm_ethereum::EthEvmConfig;
|
||||
use reth_node_api::{ConfigureEvm, ConfigureEvmEnv, FullNodeTypes};
|
||||
use reth_node_core::{args::RpcServerArgs, node_config::NodeConfig};
|
||||
use reth_node_ethereum::{EthExecutorProvider, EthereumNode};
|
||||
use reth_node_ethereum::{node::EthereumAddOns, EthExecutorProvider, EthereumNode};
|
||||
use reth_primitives::{
|
||||
revm_primitives::{AnalysisKind, CfgEnvWithHandlerCfg, TxEnv},
|
||||
Address, Header, TransactionSigned, U256,
|
||||
@ -180,6 +180,7 @@ async fn main() -> eyre::Result<()> {
|
||||
.with_types::<EthereumNode>()
|
||||
// use default ethereum components but with our executor
|
||||
.with_components(EthereumNode::components().executor(MyExecutorBuilder::default()))
|
||||
.with_add_ons::<EthereumAddOns>()
|
||||
.launch()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
@ -10,7 +10,7 @@ use reth::{
|
||||
blobstore::InMemoryBlobStore, EthTransactionPool, TransactionValidationTaskExecutor,
|
||||
},
|
||||
};
|
||||
use reth_node_ethereum::EthereumNode;
|
||||
use reth_node_ethereum::{node::EthereumAddOns, EthereumNode};
|
||||
use reth_tracing::tracing::{debug, info};
|
||||
use reth_transaction_pool::PoolConfig;
|
||||
|
||||
@ -23,6 +23,7 @@ fn main() {
|
||||
// Configure the components of the node
|
||||
// use default ethereum components but use our custom pool
|
||||
.with_components(EthereumNode::components().pool(CustomPoolBuilder::default()))
|
||||
.with_add_ons::<EthereumAddOns>()
|
||||
.launch()
|
||||
.await?;
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ use reth::{
|
||||
transaction_pool::TransactionPool,
|
||||
};
|
||||
use reth_basic_payload_builder::BasicPayloadJobGeneratorConfig;
|
||||
use reth_node_ethereum::{EthEngineTypes, EthereumNode};
|
||||
use reth_node_ethereum::{node::EthereumAddOns, EthEngineTypes, EthereumNode};
|
||||
use reth_payload_builder::PayloadBuilderService;
|
||||
|
||||
pub mod generator;
|
||||
@ -78,6 +78,7 @@ fn main() {
|
||||
.with_components(
|
||||
EthereumNode::components().payload(CustomPayloadBuilder::default()),
|
||||
)
|
||||
.with_add_ons::<EthereumAddOns>()
|
||||
.launch()
|
||||
.await?;
|
||||
|
||||
|
||||
@ -19,6 +19,7 @@ use reth::{
|
||||
providers::{BlockchainProvider, StaticFileProvider},
|
||||
ProviderFactory,
|
||||
},
|
||||
rpc::eth::EthApi,
|
||||
utils::open_db_read_only,
|
||||
};
|
||||
use reth_chainspec::ChainSpecBuilder;
|
||||
@ -27,7 +28,7 @@ use reth_db_api::models::ClientVersion;
|
||||
|
||||
// Bringing up the RPC
|
||||
use reth::rpc::builder::{
|
||||
EthApiBuild, RethRpcModule, RpcModuleBuilder, RpcServerConfig, TransportRpcModuleConfig,
|
||||
RethRpcModule, RpcModuleBuilder, RpcServerConfig, TransportRpcModuleConfig,
|
||||
};
|
||||
// Configuring the network parts, ideally also wouldn't need to think about this.
|
||||
use myrpc_ext::{MyRpcExt, MyRpcExtApiServer};
|
||||
@ -70,7 +71,7 @@ async fn main() -> eyre::Result<()> {
|
||||
|
||||
// Pick which namespaces to expose.
|
||||
let config = TransportRpcModuleConfig::default().with_http([RethRpcModule::Eth]);
|
||||
let mut server = rpc_builder.build(config, EthApiBuild::build);
|
||||
let mut server = rpc_builder.build(config, Box::new(EthApi::with_spawner));
|
||||
|
||||
// Add a custom rpc namespace
|
||||
let custom_rpc = MyRpcExt { provider };
|
||||
|
||||
@ -21,7 +21,7 @@ use reth::{
|
||||
use reth_chainspec::{Chain, ChainSpec};
|
||||
use reth_node_api::{ConfigureEvm, ConfigureEvmEnv, FullNodeTypes};
|
||||
use reth_node_core::{args::RpcServerArgs, node_config::NodeConfig};
|
||||
use reth_node_ethereum::{EthEvmConfig, EthExecutorProvider, EthereumNode};
|
||||
use reth_node_ethereum::{node::EthereumAddOns, EthEvmConfig, EthExecutorProvider, EthereumNode};
|
||||
use reth_primitives::{
|
||||
revm_primitives::{SpecId, StatefulPrecompileMut},
|
||||
Header, TransactionSigned,
|
||||
@ -244,6 +244,7 @@ async fn main() -> eyre::Result<()> {
|
||||
.with_types::<EthereumNode>()
|
||||
// use default ethereum components but with our executor
|
||||
.with_components(EthereumNode::components().executor(MyExecutorBuilder::default()))
|
||||
.with_add_ons::<EthereumAddOns>()
|
||||
.launch()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
Reference in New Issue
Block a user