mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
remove transaction forwarder trait (#9678)
This commit is contained in:
5
Cargo.lock
generated
5
Cargo.lock
generated
@ -6297,6 +6297,7 @@ dependencies = [
|
||||
"reth-node-optimism",
|
||||
"reth-optimism-cli",
|
||||
"reth-optimism-primitives",
|
||||
"reth-optimism-rpc",
|
||||
"reth-payload-builder",
|
||||
"reth-payload-primitives",
|
||||
"reth-payload-validator",
|
||||
@ -8066,10 +8067,10 @@ name = "reth-optimism-rpc"
|
||||
version = "1.0.5"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"derive_more 1.0.0",
|
||||
"jsonrpsee-types",
|
||||
"op-alloy-network",
|
||||
"parking_lot 0.12.3",
|
||||
"reqwest",
|
||||
"reth-chainspec",
|
||||
"reth-evm",
|
||||
"reth-evm-optimism",
|
||||
@ -8086,8 +8087,10 @@ dependencies = [
|
||||
"reth-tasks",
|
||||
"reth-transaction-pool",
|
||||
"revm",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@ -72,6 +72,7 @@ reth-engine-util.workspace = true
|
||||
reth-prune.workspace = true
|
||||
reth-stages-api.workspace = true
|
||||
reth-optimism-cli = { workspace = true, optional = true }
|
||||
reth-optimism-rpc.workspace = true
|
||||
|
||||
# crypto
|
||||
alloy-rlp.workspace = true
|
||||
|
||||
@ -3,11 +3,9 @@
|
||||
use clap::Parser;
|
||||
use reth::cli::Cli;
|
||||
use reth_node_builder::EngineNodeLauncher;
|
||||
use reth_node_optimism::{
|
||||
args::RollupArgs, node::OptimismAddOns, rpc::SequencerClient, OptimismNode,
|
||||
};
|
||||
use reth_node_optimism::{args::RollupArgs, node::OptimismAddOns, OptimismNode};
|
||||
use reth_optimism_rpc::eth::rpc::SequencerClient;
|
||||
use reth_provider::providers::BlockchainProvider2;
|
||||
use std::sync::Arc;
|
||||
|
||||
// We use jemalloc for performance reasons
|
||||
#[cfg(all(feature = "jemalloc", unix))]
|
||||
@ -38,9 +36,9 @@ fn main() {
|
||||
.extend_rpc_modules(move |ctx| {
|
||||
// register sequencer tx forwarder
|
||||
if let Some(sequencer_http) = sequencer_http_arg {
|
||||
ctx.registry.set_eth_raw_transaction_forwarder(Arc::new(
|
||||
SequencerClient::new(sequencer_http),
|
||||
));
|
||||
ctx.registry
|
||||
.eth_api()
|
||||
.set_sequencer_client(SequencerClient::new(sequencer_http));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@ -62,9 +60,9 @@ fn main() {
|
||||
.extend_rpc_modules(move |ctx| {
|
||||
// register sequencer tx forwarder
|
||||
if let Some(sequencer_http) = sequencer_http_arg {
|
||||
ctx.registry.set_eth_raw_transaction_forwarder(Arc::new(
|
||||
SequencerClient::new(sequencer_http),
|
||||
));
|
||||
ctx.registry
|
||||
.eth_api()
|
||||
.set_sequencer_client(SequencerClient::new(sequencer_http));
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
@ -22,8 +22,6 @@ pub use node::OptimismNode;
|
||||
|
||||
pub mod txpool;
|
||||
|
||||
pub mod rpc;
|
||||
|
||||
pub use reth_optimism_payload_builder::{
|
||||
OptimismBuiltPayload, OptimismPayloadBuilder, OptimismPayloadBuilderAttributes,
|
||||
};
|
||||
|
||||
@ -37,13 +37,15 @@ revm.workspace = true
|
||||
# async
|
||||
parking_lot.workspace = true
|
||||
tokio.workspace = true
|
||||
reqwest = { workspace = true, features = ["rustls-tls-native-roots"] }
|
||||
|
||||
# rpc
|
||||
jsonrpsee-types.workspace = true
|
||||
serde_json.workspace = true
|
||||
|
||||
# misc
|
||||
thiserror.workspace = true
|
||||
derive_more.workspace = true
|
||||
tracing.workspace = true
|
||||
|
||||
[features]
|
||||
optimism = [
|
||||
|
||||
@ -6,11 +6,12 @@ pub mod transaction;
|
||||
mod block;
|
||||
mod call;
|
||||
mod pending_block;
|
||||
pub mod rpc;
|
||||
|
||||
use std::{fmt, sync::Arc};
|
||||
|
||||
use crate::eth::rpc::SequencerClient;
|
||||
use alloy_primitives::U256;
|
||||
use derive_more::Deref;
|
||||
use op_alloy_network::Optimism;
|
||||
use reth_chainspec::ChainSpec;
|
||||
use reth_evm::ConfigureEvm;
|
||||
@ -56,10 +57,9 @@ pub type EthApiNodeBackend<N> = EthApiInner<
|
||||
///
|
||||
/// This type implements the [`FullEthApi`](reth_rpc_eth_api::helpers::FullEthApi) by implemented
|
||||
/// all the `Eth` helper traits and prerequisite traits.
|
||||
#[derive(Clone, Deref)]
|
||||
pub struct OpEthApi<N: FullNodeComponents> {
|
||||
#[deref]
|
||||
inner: Arc<EthApiNodeBackend<N>>,
|
||||
sequencer_client: parking_lot::RwLock<Option<SequencerClient>>,
|
||||
}
|
||||
|
||||
impl<N: FullNodeComponents> OpEthApi<N> {
|
||||
@ -81,11 +81,23 @@ impl<N: FullNodeComponents> OpEthApi<N> {
|
||||
ctx.new_fee_history_cache(),
|
||||
ctx.evm_config.clone(),
|
||||
ctx.executor.clone(),
|
||||
None,
|
||||
ctx.config.proof_permits,
|
||||
);
|
||||
|
||||
Self { inner: Arc::new(inner) }
|
||||
Self { inner: Arc::new(inner), sequencer_client: parking_lot::RwLock::new(None) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<N> Clone for OpEthApi<N>
|
||||
where
|
||||
N: FullNodeComponents,
|
||||
Self: Send + Sync,
|
||||
{
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
inner: self.inner.clone(),
|
||||
sequencer_client: parking_lot::RwLock::new(self.sequencer_client.read().clone()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4,8 +4,7 @@ use std::sync::{atomic::AtomicUsize, Arc};
|
||||
|
||||
use jsonrpsee_types::error::{ErrorObject, INTERNAL_ERROR_CODE};
|
||||
use reqwest::Client;
|
||||
use reth_rpc_eth_api::RawTransactionForwarder;
|
||||
use reth_rpc_eth_types::error::{EthApiError, EthResult};
|
||||
use reth_rpc_eth_types::error::EthApiError;
|
||||
use reth_rpc_types::ToRpcError;
|
||||
|
||||
/// Error type when interacting with the Sequencer
|
||||
@ -104,14 +103,6 @@ impl SequencerClient {
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl RawTransactionForwarder for SequencerClient {
|
||||
async fn forward_raw_transaction(&self, tx: &[u8]) -> EthResult<()> {
|
||||
Self::forward_raw_transaction(self, tx).await?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
struct SequencerClientInner {
|
||||
/// The endpoint of the sequencer
|
||||
@ -1,6 +1,6 @@
|
||||
//! Loads and formats OP transaction RPC response.
|
||||
|
||||
use std::sync::Arc;
|
||||
use alloy_primitives::{Bytes, B256};
|
||||
|
||||
use reth_evm_optimism::RethL1BlockInfo;
|
||||
use reth_node_api::FullNodeComponents;
|
||||
@ -8,12 +8,13 @@ use reth_primitives::TransactionSigned;
|
||||
use reth_provider::{BlockReaderIdExt, TransactionsProvider};
|
||||
use reth_rpc_eth_api::{
|
||||
helpers::{EthApiSpec, EthSigner, EthTransactions, LoadTransaction, SpawnBlocking},
|
||||
EthApiTypes, RawTransactionForwarder,
|
||||
EthApiTypes, FromEthApiError,
|
||||
};
|
||||
use reth_rpc_eth_types::EthStateCache;
|
||||
use reth_rpc_eth_types::{utils::recover_raw_transaction, EthStateCache};
|
||||
use reth_transaction_pool::{PoolTransaction, TransactionOrigin, TransactionPool};
|
||||
use revm::L1BlockInfo;
|
||||
|
||||
use crate::{OpEthApi, OpEthApiError};
|
||||
use crate::{eth::rpc::SequencerClient, OpEthApi, OpEthApiError};
|
||||
|
||||
impl<N> EthTransactions for OpEthApi<N>
|
||||
where
|
||||
@ -24,13 +25,35 @@ where
|
||||
self.inner.provider()
|
||||
}
|
||||
|
||||
fn raw_tx_forwarder(&self) -> Option<Arc<dyn RawTransactionForwarder>> {
|
||||
self.inner.raw_tx_forwarder()
|
||||
}
|
||||
|
||||
fn signers(&self) -> &parking_lot::RwLock<Vec<Box<dyn EthSigner>>> {
|
||||
self.inner.signers()
|
||||
}
|
||||
|
||||
/// Decodes and recovers the transaction and submits it to the pool.
|
||||
///
|
||||
/// Returns the hash of the transaction.
|
||||
async fn send_raw_transaction(&self, tx: Bytes) -> Result<B256, Self::Error> {
|
||||
let recovered = recover_raw_transaction(tx.clone())?;
|
||||
let pool_transaction = <Self::Pool as TransactionPool>::Transaction::from_pooled(recovered);
|
||||
|
||||
// On optimism, transactions are forwarded directly to the sequencer to be included in
|
||||
// blocks that it builds.
|
||||
if let Some(client) = self.raw_tx_forwarder().as_ref() {
|
||||
tracing::debug!( target: "rpc::eth", "forwarding raw transaction to");
|
||||
let _ = client.forward_raw_transaction(&tx).await.inspect_err(|err| {
|
||||
tracing::debug!(target: "rpc::eth", %err, hash=% *pool_transaction.hash(), "failed to forward raw transaction");
|
||||
});
|
||||
}
|
||||
|
||||
// submit the transaction to the pool with a `Local` origin
|
||||
let hash = self
|
||||
.pool()
|
||||
.add_transaction(TransactionOrigin::Local, pool_transaction)
|
||||
.await
|
||||
.map_err(Self::Error::from_eth_err)?;
|
||||
|
||||
Ok(hash)
|
||||
}
|
||||
}
|
||||
|
||||
impl<N> LoadTransaction for OpEthApi<N>
|
||||
@ -113,3 +136,18 @@ where
|
||||
Ok(OptimismTxMeta::new(Some(l1_block_info), l1_fee, l1_data_gas))
|
||||
}
|
||||
}
|
||||
|
||||
impl<N> OpEthApi<N>
|
||||
where
|
||||
N: FullNodeComponents,
|
||||
{
|
||||
/// Sets a `SequencerClient` for `eth_sendRawTransaction` to forward transactions to.
|
||||
pub fn set_sequencer_client(&self, sequencer_client: SequencerClient) {
|
||||
*self.sequencer_client.write() = Some(sequencer_client);
|
||||
}
|
||||
|
||||
/// Returns the `SequencerClient` if one is set.
|
||||
pub fn raw_tx_forwarder(&self) -> Option<SequencerClient> {
|
||||
self.sequencer_client.read().clone()
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,7 +136,6 @@
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
net::{Ipv4Addr, SocketAddr, SocketAddrV4},
|
||||
sync::Arc,
|
||||
time::{Duration, SystemTime, UNIX_EPOCH},
|
||||
};
|
||||
|
||||
@ -165,10 +164,8 @@ use reth_rpc::{
|
||||
};
|
||||
use reth_rpc_api::servers::*;
|
||||
use reth_rpc_eth_api::{
|
||||
helpers::{
|
||||
Call, EthApiSpec, EthTransactions, LoadPendingBlock, TraceExt, UpdateRawTxForwarder,
|
||||
},
|
||||
EthApiServer, FullEthApiServer, RawTransactionForwarder,
|
||||
helpers::{Call, EthApiSpec, EthTransactions, LoadPendingBlock, TraceExt},
|
||||
EthApiServer, FullEthApiServer,
|
||||
};
|
||||
use reth_rpc_eth_types::{EthConfig, EthStateCache, EthSubscriptionIdProvider};
|
||||
use reth_rpc_layer::{AuthLayer, Claims, JwtAuthValidator, JwtSecret};
|
||||
@ -741,20 +738,6 @@ impl<Provider, Pool, Network, Tasks, Events, EthApi>
|
||||
}
|
||||
}
|
||||
|
||||
impl<Provider, Pool, Network, Tasks, Events, EthApi>
|
||||
RpcRegistryInner<Provider, Pool, Network, Tasks, Events, EthApi>
|
||||
where
|
||||
EthApi: UpdateRawTxForwarder,
|
||||
{
|
||||
/// Sets a forwarder for `eth_sendRawTransaction`
|
||||
///
|
||||
/// Note: this might be removed in the future in favor of a more generic approach.
|
||||
pub fn set_eth_raw_transaction_forwarder(&self, forwarder: Arc<dyn RawTransactionForwarder>) {
|
||||
// in case the eth api has been created before the forwarder was set: <https://github.com/paradigmxyz/reth/issues/8661>
|
||||
self.eth.api.set_eth_raw_transaction_forwarder(forwarder.clone());
|
||||
}
|
||||
}
|
||||
|
||||
impl<Provider, Pool, Network, Tasks, Events, EthApi>
|
||||
RpcRegistryInner<Provider, Pool, Network, Tasks, Events, EthApi>
|
||||
where
|
||||
|
||||
@ -21,8 +21,7 @@ use tracing::trace;
|
||||
|
||||
use crate::{
|
||||
helpers::{
|
||||
transaction::UpdateRawTxForwarder, EthApiSpec, EthBlocks, EthCall, EthFees, EthState,
|
||||
EthTransactions, FullEthApi, LoadState,
|
||||
EthApiSpec, EthBlocks, EthCall, EthFees, EthState, EthTransactions, FullEthApi, LoadState,
|
||||
},
|
||||
RpcBlock, RpcTransaction,
|
||||
};
|
||||
@ -30,17 +29,13 @@ use crate::{
|
||||
/// Helper trait, unifies functionality that must be supported to implement all RPC methods for
|
||||
/// server.
|
||||
pub trait FullEthApiServer:
|
||||
EthApiServer<RpcTransaction<Self::NetworkTypes>, RpcBlock<Self::NetworkTypes>>
|
||||
+ FullEthApi
|
||||
+ UpdateRawTxForwarder
|
||||
+ Clone
|
||||
EthApiServer<RpcTransaction<Self::NetworkTypes>, RpcBlock<Self::NetworkTypes>> + FullEthApi + Clone
|
||||
{
|
||||
}
|
||||
|
||||
impl<T> FullEthApiServer for T where
|
||||
T: EthApiServer<RpcTransaction<T::NetworkTypes>, RpcBlock<T::NetworkTypes>>
|
||||
+ FullEthApi
|
||||
+ UpdateRawTxForwarder
|
||||
+ Clone
|
||||
{
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ pub use signer::{AddDevSigners, EthSigner};
|
||||
pub use spec::EthApiSpec;
|
||||
pub use state::{EthState, LoadState};
|
||||
pub use trace::Trace;
|
||||
pub use transaction::{EthTransactions, LoadTransaction, UpdateRawTxForwarder};
|
||||
pub use transaction::{EthTransactions, LoadTransaction};
|
||||
|
||||
use crate::EthApiTypes;
|
||||
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
//! Database access for `eth_` transaction RPC methods. Loads transaction and receipt data w.r.t.
|
||||
//! network.
|
||||
|
||||
use std::{fmt, ops::Deref, sync::Arc};
|
||||
|
||||
use alloy_dyn_abi::TypedData;
|
||||
use futures::Future;
|
||||
use reth_primitives::{
|
||||
@ -11,8 +9,7 @@ use reth_primitives::{
|
||||
};
|
||||
use reth_provider::{BlockReaderIdExt, ReceiptProvider, TransactionsProvider};
|
||||
use reth_rpc_eth_types::{
|
||||
utils::recover_raw_transaction, EthApiError, EthResult, EthStateCache, SignError,
|
||||
TransactionSource,
|
||||
utils::recover_raw_transaction, EthApiError, EthStateCache, SignError, TransactionSource,
|
||||
};
|
||||
use reth_rpc_types::{
|
||||
transaction::{
|
||||
@ -59,11 +56,6 @@ pub trait EthTransactions: LoadTransaction {
|
||||
/// Data access in default (L1) trait method implementations.
|
||||
fn provider(&self) -> impl BlockReaderIdExt;
|
||||
|
||||
/// Returns a handle for forwarding received raw transactions.
|
||||
///
|
||||
/// Access to transaction forwarder in default (L1) trait method implementations.
|
||||
fn raw_tx_forwarder(&self) -> Option<Arc<dyn RawTransactionForwarder>>;
|
||||
|
||||
/// Returns a handle for signing data.
|
||||
///
|
||||
/// Singer access in default (L1) trait method implementations.
|
||||
@ -254,15 +246,6 @@ pub trait EthTransactions: LoadTransaction {
|
||||
let pool_transaction =
|
||||
<Self::Pool as TransactionPool>::Transaction::from_pooled(recovered);
|
||||
|
||||
// On optimism, transactions are forwarded directly to the sequencer to be included in
|
||||
// blocks that it builds.
|
||||
if let Some(client) = self.raw_tx_forwarder().as_ref() {
|
||||
tracing::debug!( target: "rpc::eth", "forwarding raw transaction to");
|
||||
let _ = client.forward_raw_transaction(&tx).await.inspect_err(|err| {
|
||||
tracing::debug!(target: "rpc::eth", %err, hash=% *pool_transaction.hash(), "failed to forward raw transaction");
|
||||
});
|
||||
}
|
||||
|
||||
// submit the transaction to the pool with a `Local` origin
|
||||
let hash = self
|
||||
.pool()
|
||||
@ -660,30 +643,3 @@ pub trait LoadTransaction: SpawnBlocking {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A trait that allows for forwarding raw transactions.
|
||||
///
|
||||
/// For example to a sequencer.
|
||||
#[async_trait::async_trait]
|
||||
pub trait RawTransactionForwarder: fmt::Debug + Send + Sync + 'static {
|
||||
/// Forwards raw transaction bytes for `eth_sendRawTransaction`
|
||||
async fn forward_raw_transaction(&self, raw: &[u8]) -> EthResult<()>;
|
||||
}
|
||||
|
||||
/// Configure server's forwarder for `eth_sendRawTransaction`, at runtime.
|
||||
pub trait UpdateRawTxForwarder {
|
||||
/// Sets a forwarder for `eth_sendRawTransaction`
|
||||
///
|
||||
/// Note: this might be removed in the future in favor of a more generic approach.
|
||||
fn set_eth_raw_transaction_forwarder(&self, forwarder: Arc<dyn RawTransactionForwarder>);
|
||||
}
|
||||
|
||||
impl<T, K> UpdateRawTxForwarder for T
|
||||
where
|
||||
T: Deref<Target = Arc<K>>,
|
||||
K: UpdateRawTxForwarder,
|
||||
{
|
||||
fn set_eth_raw_transaction_forwarder(&self, forwarder: Arc<dyn RawTransactionForwarder>) {
|
||||
self.deref().deref().set_eth_raw_transaction_forwarder(forwarder);
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,10 +22,7 @@ pub mod types;
|
||||
pub use bundle::{EthBundleApiServer, EthCallBundleApiServer};
|
||||
pub use core::{EthApiServer, FullEthApiServer};
|
||||
pub use filter::EthFilterApiServer;
|
||||
pub use helpers::{
|
||||
error::{AsEthApiError, FromEthApiError, FromEvmError, IntoEthApiError},
|
||||
transaction::RawTransactionForwarder,
|
||||
};
|
||||
pub use helpers::error::{AsEthApiError, FromEthApiError, FromEvmError, IntoEthApiError};
|
||||
pub use pubsub::EthPubSubApiServer;
|
||||
pub use types::{EthApiTypes, RpcBlock, RpcTransaction};
|
||||
|
||||
|
||||
@ -9,8 +9,8 @@ use reth_node_api::{BuilderProvider, FullNodeComponents};
|
||||
use reth_primitives::{BlockNumberOrTag, U256};
|
||||
use reth_provider::{BlockReaderIdExt, CanonStateSubscriptions, ChainSpecProvider};
|
||||
use reth_rpc_eth_api::{
|
||||
helpers::{transaction::UpdateRawTxForwarder, EthSigner, SpawnBlocking},
|
||||
EthApiTypes, RawTransactionForwarder,
|
||||
helpers::{EthSigner, SpawnBlocking},
|
||||
EthApiTypes,
|
||||
};
|
||||
use reth_rpc_eth_types::{
|
||||
EthApiBuilderCtx, EthApiError, EthStateCache, FeeHistoryCache, GasCap, GasPriceOracle,
|
||||
@ -60,7 +60,6 @@ where
|
||||
blocking_task_pool: BlockingTaskPool,
|
||||
fee_history_cache: FeeHistoryCache,
|
||||
evm_config: EvmConfig,
|
||||
raw_transaction_forwarder: Option<Arc<dyn RawTransactionForwarder>>,
|
||||
proof_permits: usize,
|
||||
) -> Self {
|
||||
let inner = EthApiInner::new(
|
||||
@ -75,7 +74,6 @@ where
|
||||
fee_history_cache,
|
||||
evm_config,
|
||||
TokioTaskExecutor::default(),
|
||||
raw_transaction_forwarder,
|
||||
proof_permits,
|
||||
);
|
||||
|
||||
@ -113,7 +111,6 @@ where
|
||||
ctx.new_fee_history_cache(),
|
||||
ctx.evm_config.clone(),
|
||||
ctx.executor.clone(),
|
||||
None,
|
||||
ctx.config.proof_permits,
|
||||
);
|
||||
|
||||
@ -202,8 +199,7 @@ pub struct EthApiInner<Provider, Pool, Network, EvmConfig> {
|
||||
fee_history_cache: FeeHistoryCache,
|
||||
/// The type that defines how to configure the EVM
|
||||
evm_config: EvmConfig,
|
||||
/// Allows forwarding received raw transactions
|
||||
raw_transaction_forwarder: parking_lot::RwLock<Option<Arc<dyn RawTransactionForwarder>>>,
|
||||
|
||||
/// Guard for getproof calls
|
||||
blocking_task_guard: BlockingTaskGuard,
|
||||
}
|
||||
@ -226,7 +222,6 @@ where
|
||||
fee_history_cache: FeeHistoryCache,
|
||||
evm_config: EvmConfig,
|
||||
task_spawner: impl TaskSpawner + 'static,
|
||||
raw_transaction_forwarder: Option<Arc<dyn RawTransactionForwarder>>,
|
||||
proof_permits: usize,
|
||||
) -> Self {
|
||||
let signers = parking_lot::RwLock::new(Default::default());
|
||||
@ -255,7 +250,6 @@ where
|
||||
blocking_task_pool,
|
||||
fee_history_cache,
|
||||
evm_config,
|
||||
raw_transaction_forwarder: parking_lot::RwLock::new(raw_transaction_forwarder),
|
||||
blocking_task_guard: BlockingTaskGuard::new(proof_permits),
|
||||
}
|
||||
}
|
||||
@ -304,12 +298,6 @@ impl<Provider, Pool, Network, EvmConfig> EthApiInner<Provider, Pool, Network, Ev
|
||||
&self.pool
|
||||
}
|
||||
|
||||
/// Returns a handle to the transaction forwarder.
|
||||
#[inline]
|
||||
pub fn raw_tx_forwarder(&self) -> Option<Arc<dyn RawTransactionForwarder>> {
|
||||
self.raw_transaction_forwarder.read().clone()
|
||||
}
|
||||
|
||||
/// Returns the gas cap.
|
||||
#[inline]
|
||||
pub const fn gas_cap(&self) -> u64 {
|
||||
@ -359,14 +347,6 @@ impl<Provider, Pool, Network, EvmConfig> EthApiInner<Provider, Pool, Network, Ev
|
||||
}
|
||||
}
|
||||
|
||||
impl<Provider, Pool, Network, EvmConfig> UpdateRawTxForwarder
|
||||
for EthApiInner<Provider, Pool, Network, EvmConfig>
|
||||
{
|
||||
fn set_eth_raw_transaction_forwarder(&self, forwarder: Arc<dyn RawTransactionForwarder>) {
|
||||
self.raw_transaction_forwarder.write().replace(forwarder);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use jsonrpsee_types::error::INVALID_PARAMS_CODE;
|
||||
@ -419,7 +399,6 @@ mod tests {
|
||||
BlockingTaskPool::build().expect("failed to build tracing pool"),
|
||||
fee_history_cache,
|
||||
evm_config,
|
||||
None,
|
||||
DEFAULT_PROOF_PERMITS,
|
||||
)
|
||||
}
|
||||
|
||||
@ -73,7 +73,6 @@ mod tests {
|
||||
BlockingTaskPool::build().expect("failed to build tracing pool"),
|
||||
FeeHistoryCache::new(cache, FeeHistoryCacheConfig::default()),
|
||||
evm_config,
|
||||
None,
|
||||
DEFAULT_PROOF_PERMITS,
|
||||
)
|
||||
}
|
||||
@ -99,7 +98,6 @@ mod tests {
|
||||
BlockingTaskPool::build().expect("failed to build tracing pool"),
|
||||
FeeHistoryCache::new(cache, FeeHistoryCacheConfig::default()),
|
||||
evm_config,
|
||||
None,
|
||||
DEFAULT_PROOF_PERMITS,
|
||||
)
|
||||
}
|
||||
|
||||
@ -1,12 +1,7 @@
|
||||
//! Contains RPC handler implementations specific to transactions
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use reth_provider::{BlockReaderIdExt, TransactionsProvider};
|
||||
use reth_rpc_eth_api::{
|
||||
helpers::{EthSigner, EthTransactions, LoadTransaction, SpawnBlocking},
|
||||
RawTransactionForwarder,
|
||||
};
|
||||
use reth_rpc_eth_api::helpers::{EthSigner, EthTransactions, LoadTransaction, SpawnBlocking};
|
||||
use reth_rpc_eth_types::EthStateCache;
|
||||
use reth_transaction_pool::TransactionPool;
|
||||
|
||||
@ -24,11 +19,6 @@ where
|
||||
self.inner.provider()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn raw_tx_forwarder(&self) -> Option<Arc<dyn RawTransactionForwarder>> {
|
||||
self.inner.raw_tx_forwarder()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn signers(&self) -> &parking_lot::RwLock<Vec<Box<dyn EthSigner>>> {
|
||||
self.inner.signers()
|
||||
@ -98,7 +88,6 @@ mod tests {
|
||||
BlockingTaskPool::build().expect("failed to build tracing pool"),
|
||||
fee_history_cache,
|
||||
evm_config,
|
||||
None,
|
||||
DEFAULT_PROOF_PERMITS,
|
||||
);
|
||||
|
||||
|
||||
@ -14,4 +14,4 @@ pub use pubsub::EthPubSub;
|
||||
|
||||
pub use helpers::signer::DevSigner;
|
||||
|
||||
pub use reth_rpc_eth_api::{EthApiServer, RawTransactionForwarder};
|
||||
pub use reth_rpc_eth_api::EthApiServer;
|
||||
|
||||
Reference in New Issue
Block a user