Skip to content

Commit 6bb8357

Browse files
committed
remove unused code
1 parent 437bccf commit 6bb8357

File tree

2 files changed

+6
-75
lines changed

2 files changed

+6
-75
lines changed

crates/ingress-rpc/src/service.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use alloy_consensus::transaction::{Recovered, SignerRecoverable};
2-
use alloy_primitives::{Address, B256, Bytes};
1+
use alloy_consensus::transaction::SignerRecoverable;
2+
use alloy_primitives::{B256, Bytes};
33
use alloy_provider::{Provider, RootProvider, network::eip2718::Decodable2718};
44
use alloy_rpc_types_mev::{EthBundleHash, EthCancelBundle, EthSendBundle};
55
use jsonrpsee::{
@@ -91,13 +91,6 @@ where
9191
.try_into_recovered()
9292
.map_err(|_| EthApiError::FailedToDecodeSignedTransaction.into_rpc_err())?;
9393

94-
/*let mut l1_block_info = self.provider.fetch_l1_block_info().await?;
95-
let account = self
96-
.provider
97-
.fetch_account_info(transaction.signer())
98-
.await?;
99-
validate_tx(account, &transaction, &data, &mut l1_block_info).await?;*/
100-
10194
// Send transaction data to ExEx for validation
10295
// TODO: in the endgame version, this would push to a Redis cluster which the "Store" ExEx
10396
// would read from. Instead, we are implementing v1 of this by having the ingress-rpc

crates/rpc-exex/src/validation.rs

Lines changed: 4 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
use alloy_consensus::private::alloy_eips::{BlockId, BlockNumberOrTag};
2-
use alloy_consensus::{Transaction, Typed2718, constants::KECCAK_EMPTY, transaction::Recovered};
3-
use alloy_primitives::{Address, B256, U256};
4-
use alloy_provider::{Provider, RootProvider};
5-
use async_trait::async_trait;
1+
use alloy_consensus::{Transaction, constants::KECCAK_EMPTY, transaction::Recovered};
2+
use alloy_primitives::{B256, U256};
63
use jsonrpsee::core::RpcResult;
74
use op_alloy_consensus::interop::CROSS_L2_INBOX_ADDRESS;
8-
use op_alloy_network::Optimism;
95
use op_revm::{OpSpecId, l1block::L1BlockInfo};
10-
use reth_optimism_evm::extract_l1_info_from_tx;
11-
use reth_rpc_eth_types::{EthApiError, RpcInvalidTransactionError, SignError};
6+
use reth_rpc_eth_types::{EthApiError, RpcInvalidTransactionError};
127
use tracing::warn;
138

149
/// Account info for a given address
@@ -18,64 +13,6 @@ pub struct AccountInfo {
1813
pub code_hash: B256,
1914
}
2015

21-
/// Interface for fetching account info for a given address
22-
#[async_trait]
23-
pub trait AccountInfoLookup: Send + Sync {
24-
async fn fetch_account_info(&self, address: Address) -> RpcResult<AccountInfo>;
25-
}
26-
27-
/// Implementation of the `AccountInfoLookup` trait for the `RootProvider`
28-
#[async_trait]
29-
impl AccountInfoLookup for RootProvider<Optimism> {
30-
async fn fetch_account_info(&self, address: Address) -> RpcResult<AccountInfo> {
31-
let account = self
32-
.get_account(address)
33-
.await
34-
.map_err(|_| EthApiError::Signing(SignError::NoAccount))?;
35-
Ok(AccountInfo {
36-
balance: account.balance,
37-
nonce: account.nonce,
38-
code_hash: account.code_hash,
39-
})
40-
}
41-
}
42-
43-
/// Interface for fetching L1 block info for a given block number
44-
#[async_trait]
45-
pub trait L1BlockInfoLookup: Send + Sync {
46-
async fn fetch_l1_block_info(&self) -> RpcResult<L1BlockInfo>;
47-
}
48-
49-
/// Implementation of the `L1BlockInfoLookup` trait for the `RootProvider`
50-
#[async_trait]
51-
impl L1BlockInfoLookup for RootProvider<Optimism> {
52-
async fn fetch_l1_block_info(&self) -> RpcResult<L1BlockInfo> {
53-
let block = self
54-
.get_block(BlockId::Number(BlockNumberOrTag::Latest))
55-
.full()
56-
.await
57-
.map_err(|e| {
58-
warn!(message = "failed to fetch latest block", err = %e);
59-
EthApiError::InternalEthError.into_rpc_err()
60-
})?
61-
.ok_or_else(|| {
62-
warn!(message = "empty latest block returned");
63-
EthApiError::InternalEthError.into_rpc_err()
64-
})?;
65-
66-
let txs = block.transactions.clone();
67-
let first_tx = txs.first_transaction().ok_or_else(|| {
68-
warn!(message = "block contains no transactions");
69-
EthApiError::InternalEthError.into_rpc_err()
70-
})?;
71-
72-
Ok(extract_l1_info_from_tx(&first_tx.clone()).map_err(|e| {
73-
warn!(message = "failed to extract l1_info from tx", err = %e);
74-
EthApiError::InternalEthError.into_rpc_err()
75-
})?)
76-
}
77-
}
78-
7916
/// Helper function to validate a transaction. A valid transaction must satisfy the following criteria:
8017
/// - If the transaction is not EIP-4844
8118
/// - If the transaction is not a cross chain tx
@@ -164,6 +101,7 @@ mod tests {
164101
use alloy_consensus::SignableTransaction;
165102
use alloy_consensus::{Transaction, constants::KECCAK_EMPTY, transaction::SignerRecoverable};
166103
use alloy_consensus::{TxEip1559, TxEip4844, TxEip7702};
104+
use alloy_primitives::Address;
167105
use alloy_primitives::{bytes, keccak256};
168106
use alloy_signer_local::PrivateKeySigner;
169107
use op_alloy_consensus::OpTxEnvelope;

0 commit comments

Comments
 (0)