Skip to content

Commit

Permalink
chore(rpc): remove redundant LoadTransaction::cache (#12148)
Browse files Browse the repository at this point in the history
  • Loading branch information
emhane authored Oct 28, 2024
1 parent 3d62bfd commit 28f8c47
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
6 changes: 1 addition & 5 deletions crates/optimism/rpc/src/eth/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use reth_rpc_eth_api::{
helpers::{EthSigner, EthTransactions, LoadTransaction, SpawnBlocking},
FromEthApiError, FullEthApiTypes, RpcNodeCore, TransactionCompat,
};
use reth_rpc_eth_types::{utils::recover_raw_transaction, EthStateCache};
use reth_rpc_eth_types::utils::recover_raw_transaction;
use reth_transaction_pool::{PoolTransaction, TransactionOrigin, TransactionPool};

use crate::{OpEthApi, SequencerClient};
Expand Down Expand Up @@ -59,10 +59,6 @@ where
Self: SpawnBlocking + FullEthApiTypes,
N: RpcNodeCore<Provider: TransactionsProvider, Pool: TransactionPool>,
{
#[inline]
fn cache(&self) -> &EthStateCache {
self.inner.cache()
}
}

impl<N> OpEthApi<N>
Expand Down
14 changes: 6 additions & 8 deletions crates/rpc/rpc-eth-api/src/helpers/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ use reth_primitives::{
use reth_provider::{BlockNumReader, BlockReaderIdExt, ReceiptProvider, TransactionsProvider};
use reth_rpc_eth_types::{
utils::{binary_search, recover_raw_transaction},
EthApiError, EthStateCache, SignError, TransactionSource,
EthApiError, SignError, TransactionSource,
};
use reth_rpc_types_compat::transaction::{from_recovered, from_recovered_with_block_context};
use reth_transaction_pool::{PoolTransaction, TransactionOrigin, TransactionPool};
use std::sync::Arc;

use crate::{
FromEthApiError, FullEthApiTypes, IntoEthApiError, RpcNodeCore, RpcReceipt, RpcTransaction,
FromEthApiError, FullEthApiTypes, IntoEthApiError, RpcNodeCore, RpcNodeCoreExt, RpcReceipt,
RpcTransaction,
};

use super::{
Expand Down Expand Up @@ -461,13 +462,10 @@ pub trait EthTransactions: LoadTransaction<Provider: BlockReaderIdExt> {
/// Behaviour shared by several `eth_` RPC methods, not exclusive to `eth_` transactions RPC
/// methods.
pub trait LoadTransaction:
SpawnBlocking + FullEthApiTypes + RpcNodeCore<Provider: TransactionsProvider, Pool: TransactionPool>
SpawnBlocking
+ FullEthApiTypes
+ RpcNodeCoreExt<Provider: TransactionsProvider, Pool: TransactionPool>
{
/// Returns a handle for reading data from memory.
///
/// Data access in default (L1) trait method implementations.
fn cache(&self) -> &EthStateCache;

/// Returns the transaction by hash.
///
/// Checks the pool and state.
Expand Down
5 changes: 0 additions & 5 deletions crates/rpc/rpc/src/eth/helpers/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use reth_rpc_eth_api::{
helpers::{EthSigner, EthTransactions, LoadTransaction, SpawnBlocking},
FullEthApiTypes, RpcNodeCore,
};
use reth_rpc_eth_types::EthStateCache;
use reth_transaction_pool::TransactionPool;

use crate::EthApi;
Expand All @@ -28,10 +27,6 @@ where
+ FullEthApiTypes
+ RpcNodeCore<Provider: TransactionsProvider, Pool: TransactionPool>,
{
#[inline]
fn cache(&self) -> &EthStateCache {
self.inner.cache()
}
}

#[cfg(test)]
Expand Down

0 comments on commit 28f8c47

Please sign in to comment.