Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions crates/optimism/rpc/src/eth/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,4 @@ where
let signature = Signature::new(Default::default(), Default::default(), false);
Ok(tx.into_signed(signature).into())
}

fn otterscan_api_truncate_input(tx: &mut Self::Transaction) {
let input = tx.inner.inner.inner_mut().input_mut();
*input = input.slice(..4);
}
}
5 changes: 0 additions & 5 deletions crates/rpc/rpc-types-compat/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,4 @@ pub trait TransactionCompat<T>: Send + Sync + Unpin + Clone + fmt::Debug {
/// Builds a fake transaction from a transaction request for inclusion into block built in
/// `eth_simulateV1`.
fn build_simulate_v1_transaction(&self, request: TransactionRequest) -> Result<T, Self::Error>;

/// Truncates the input of a transaction to only the first 4 bytes.
// todo: remove in favour of using constructor on `TransactionResponse` or similar
// <https://github.com/alloy-rs/alloy/issues/1315>.
fn otterscan_api_truncate_input(tx: &mut Self::Transaction);
}
5 changes: 0 additions & 5 deletions crates/rpc/rpc/src/eth/helpers/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ where
TransactionRequest::build_typed_simulate_transaction(request)
.map_err(|_| EthApiError::TransactionConversionError)
}

fn otterscan_api_truncate_input(tx: &mut Self::Transaction) {
let input = tx.inner.inner_mut().input_mut();
*input = input.slice(..4);
}
}

//tests for simulate
Expand Down
13 changes: 2 additions & 11 deletions crates/rpc/rpc/src/otterscan.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use alloy_consensus::{BlockHeader, Transaction, Typed2718};
use alloy_consensus::{BlockHeader, Typed2718};
use alloy_eips::{eip1898::LenientBlockNumberOrTag, BlockId};
use alloy_network::{ReceiptResponse, TransactionResponse};
use alloy_primitives::{Address, Bytes, TxHash, B256, U256};
Expand All @@ -15,7 +15,7 @@ use jsonrpsee::{core::RpcResult, types::ErrorObjectOwned};
use reth_rpc_api::{EthApiServer, OtterscanServer};
use reth_rpc_eth_api::{
helpers::{EthTransactions, TraceExt},
FullEthApiTypes, RpcBlock, RpcHeader, RpcReceipt, RpcTransaction, TransactionCompat,
FullEthApiTypes, RpcBlock, RpcHeader, RpcReceipt, RpcTransaction,
};
use reth_rpc_eth_types::{utils::binary_search, EthApiError};
use reth_rpc_server_types::result::internal_rpc_err;
Expand Down Expand Up @@ -240,15 +240,6 @@ where
// Crop transactions
*transactions = transactions.drain(page_start..page_end).collect::<Vec<_>>();

// The input field returns only the 4 bytes method selector instead of the entire
// calldata byte blob
// See also: <https://github.com/ledgerwatch/erigon/blob/aefb97b07d1c4fd32a66097a24eddd8f6ccacae0/turbo/jsonrpc/otterscan_api.go#L610-L617>
for tx in transactions.iter_mut() {
if tx.input().len() > 4 {
Eth::TransactionCompat::otterscan_api_truncate_input(tx);
}
}

// Crop receipts and transform them into OtsTransactionReceipt
let timestamp = Some(block.header.timestamp());
let receipts = receipts
Expand Down
Loading