mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: install op debug exeuction witness (#12622)
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -8335,6 +8335,7 @@ dependencies = [
|
||||
"reth-primitives",
|
||||
"reth-provider",
|
||||
"reth-revm",
|
||||
"reth-rpc-server-types",
|
||||
"reth-tracing",
|
||||
"reth-transaction-pool",
|
||||
"reth-trie-db",
|
||||
|
||||
@ -399,7 +399,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<N, EthApi, EV> NodeAddOns<N> for RpcAddOns<N, EthApi, EV>
|
||||
impl<N, EthApi, EV> RpcAddOns<N, EthApi, EV>
|
||||
where
|
||||
N: FullNodeComponents<
|
||||
Types: ProviderNodeTypes,
|
||||
@ -408,9 +408,16 @@ where
|
||||
EthApi: EthApiTypes + FullEthApiServer + AddDevSigners + Unpin + 'static,
|
||||
EV: EngineValidatorBuilder<N>,
|
||||
{
|
||||
type Handle = RpcHandle<N, EthApi>;
|
||||
|
||||
async fn launch_add_ons(self, ctx: AddOnsContext<'_, N>) -> eyre::Result<Self::Handle> {
|
||||
/// Launches the RPC servers with the given context and an additional hook for extending
|
||||
/// modules.
|
||||
pub async fn launch_add_ons_with<F>(
|
||||
self,
|
||||
ctx: AddOnsContext<'_, N>,
|
||||
ext: F,
|
||||
) -> eyre::Result<RpcHandle<N, EthApi>>
|
||||
where
|
||||
F: FnOnce(&mut TransportRpcModules) -> eyre::Result<()>,
|
||||
{
|
||||
let Self { eth_api_builder, engine_validator_builder, hooks, _pd: _ } = self;
|
||||
|
||||
let engine_validator = engine_validator_builder.build(&ctx).await?;
|
||||
@ -467,6 +474,7 @@ where
|
||||
|
||||
let RpcHooks { on_rpc_started, extend_rpc_modules } = hooks;
|
||||
|
||||
ext(ctx.modules)?;
|
||||
extend_rpc_modules.extend_rpc_modules(ctx)?;
|
||||
|
||||
let server_config = config.rpc.rpc_server_config();
|
||||
@ -513,6 +521,22 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<N, EthApi, EV> NodeAddOns<N> for RpcAddOns<N, EthApi, EV>
|
||||
where
|
||||
N: FullNodeComponents<
|
||||
Types: ProviderNodeTypes,
|
||||
PayloadBuilder: PayloadBuilder<PayloadType = <N::Types as NodeTypesWithEngine>::Engine>,
|
||||
>,
|
||||
EthApi: EthApiTypes + FullEthApiServer + AddDevSigners + Unpin + 'static,
|
||||
EV: EngineValidatorBuilder<N>,
|
||||
{
|
||||
type Handle = RpcHandle<N, EthApi>;
|
||||
|
||||
async fn launch_add_ons(self, ctx: AddOnsContext<'_, N>) -> eyre::Result<Self::Handle> {
|
||||
self.launch_add_ons_with(ctx, |_| Ok(())).await
|
||||
}
|
||||
}
|
||||
|
||||
/// Helper trait implemented for add-ons producing [`RpcHandle`]. Used by common node launcher
|
||||
/// implementations.
|
||||
pub trait RethRpcAddOns<N: FullNodeComponents>:
|
||||
|
||||
@ -29,6 +29,7 @@ reth-evm.workspace = true
|
||||
reth-revm = { workspace = true, features = ["std"] }
|
||||
reth-beacon-consensus.workspace = true
|
||||
reth-trie-db.workspace = true
|
||||
reth-rpc-server-types.workspace = true
|
||||
|
||||
# op-reth
|
||||
reth-optimism-payload-builder.workspace = true
|
||||
|
||||
@ -1,7 +1,11 @@
|
||||
//! Optimism Node types config.
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::{
|
||||
args::RollupArgs,
|
||||
engine::OpEngineValidator,
|
||||
txpool::{OpTransactionPool, OpTransactionValidator},
|
||||
OpEngineTypes,
|
||||
};
|
||||
use alloy_consensus::Header;
|
||||
use reth_basic_payload_builder::{BasicPayloadJobGenerator, BasicPayloadJobGeneratorConfig};
|
||||
use reth_chainspec::{EthChainSpec, Hardforks};
|
||||
@ -23,23 +27,21 @@ use reth_optimism_chainspec::OpChainSpec;
|
||||
use reth_optimism_consensus::OpBeaconConsensus;
|
||||
use reth_optimism_evm::{OpEvmConfig, OpExecutionStrategyFactory};
|
||||
use reth_optimism_payload_builder::builder::OpPayloadTransactions;
|
||||
use reth_optimism_rpc::OpEthApi;
|
||||
use reth_optimism_rpc::{
|
||||
witness::{DebugExecutionWitnessApiServer, OpDebugWitnessApi},
|
||||
OpEthApi,
|
||||
};
|
||||
use reth_payload_builder::{PayloadBuilderHandle, PayloadBuilderService};
|
||||
use reth_primitives::{Block, Receipt, TransactionSigned, TxType};
|
||||
use reth_provider::CanonStateSubscriptions;
|
||||
use reth_rpc_server_types::RethRpcModule;
|
||||
use reth_tracing::tracing::{debug, info};
|
||||
use reth_transaction_pool::{
|
||||
blobstore::DiskFileBlobStore, CoinbaseTipOrdering, TransactionPool,
|
||||
TransactionValidationTaskExecutor,
|
||||
};
|
||||
use reth_trie_db::MerklePatriciaTrie;
|
||||
|
||||
use crate::{
|
||||
args::RollupArgs,
|
||||
engine::OpEngineValidator,
|
||||
txpool::{OpTransactionPool, OpTransactionValidator},
|
||||
OpEngineTypes,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
|
||||
/// Optimism primitive types.
|
||||
#[derive(Debug, Default, Clone)]
|
||||
@ -163,7 +165,17 @@ where
|
||||
self,
|
||||
ctx: reth_node_api::AddOnsContext<'_, N>,
|
||||
) -> eyre::Result<Self::Handle> {
|
||||
self.0.launch_add_ons(ctx).await
|
||||
// install additional OP specific rpc methods
|
||||
let debug_ext =
|
||||
OpDebugWitnessApi::new(ctx.node.provider().clone(), ctx.node.evm_config().clone());
|
||||
|
||||
self.0
|
||||
.launch_add_ons_with(ctx, move |modules| {
|
||||
debug!(target: "reth::cli", "Installing debug payload witness rpc endpoint");
|
||||
modules.merge_if_module_configured(RethRpcModule::Debug, debug_ext.into_rpc())?;
|
||||
Ok(())
|
||||
})
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ use reth_optimism_chainspec::OpChainSpec;
|
||||
use reth_optimism_payload_builder::OpPayloadBuilder;
|
||||
use reth_primitives::SealedHeader;
|
||||
use reth_provider::{BlockReaderIdExt, ProviderError, ProviderResult, StateProviderFactory};
|
||||
use reth_rpc_api::DebugExecutionWitnessApiServer;
|
||||
pub use reth_rpc_api::DebugExecutionWitnessApiServer;
|
||||
use reth_rpc_server_types::{result::internal_rpc_err, ToRpcResult};
|
||||
use std::{fmt::Debug, sync::Arc};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user