feat(rpc): relax VaidationApi and EngineApi (#13241)

This commit is contained in:
Arsenii Kulikov
2024-12-10 01:48:29 +04:00
committed by GitHub
parent af5dc60867
commit eb6080863b
20 changed files with 259 additions and 193 deletions

View File

@ -34,7 +34,9 @@ use reth::rpc::builder::{
// Configuring the network parts, ideally also wouldn't need to think about this.
use myrpc_ext::{MyRpcExt, MyRpcExtApiServer};
use reth::{blockchain_tree::noop::NoopBlockchainTree, tasks::TokioTaskExecutor};
use reth_node_ethereum::{EthEvmConfig, EthExecutorProvider, EthereumNode};
use reth_node_ethereum::{
node::EthereumEngineValidator, EthEvmConfig, EthExecutorProvider, EthereumNode,
};
use reth_provider::{test_utils::TestCanonStateSubscriptions, ChainSpecProvider};
// Custom rpc extension
@ -70,11 +72,15 @@ async fn main() -> eyre::Result<()> {
.with_evm_config(EthEvmConfig::new(spec.clone()))
.with_events(TestCanonStateSubscriptions::default())
.with_block_executor(EthExecutorProvider::ethereum(provider.chain_spec()))
.with_consensus(EthBeaconConsensus::new(spec));
.with_consensus(EthBeaconConsensus::new(spec.clone()));
// Pick which namespaces to expose.
let config = TransportRpcModuleConfig::default().with_http([RethRpcModule::Eth]);
let mut server = rpc_builder.build(config, Box::new(EthApi::with_spawner));
let mut server = rpc_builder.build(
config,
Box::new(EthApi::with_spawner),
Arc::new(EthereumEngineValidator::new(spec)),
);
// Add a custom rpc namespace
let custom_rpc = MyRpcExt { provider };