diff --git a/crates/rpc/rpc/src/eth/api/call.rs b/crates/rpc/rpc/src/eth/api/call.rs index a90d64ecc5cf..ed26735ee21a 100644 --- a/crates/rpc/rpc/src/eth/api/call.rs +++ b/crates/rpc/rpc/src/eth/api/call.rs @@ -18,8 +18,7 @@ use reth_provider::{ }; use reth_revm::{access_list::AccessListInspector, database::StateProviderDatabase}; use reth_rpc_types::{ - state::StateOverride, AccessListWithGasUsed, BlockError, Bundle, CallRequest, EthCallResponse, - StateContext, + state::StateOverride, AccessListWithGasUsed, Bundle, CallRequest, EthCallResponse, StateContext, }; use reth_transaction_pool::TransactionPool; use revm::{ @@ -87,10 +86,12 @@ where let target_block = block_number.unwrap_or(BlockId::Number(BlockNumberOrTag::Latest)); - let ((cfg, block_env, _), block) = - futures::try_join!(self.evm_env_at(target_block), self.block_by_id(target_block))?; + let ((cfg, block_env, _), block) = futures::try_join!( + self.evm_env_at(target_block), + self.block_with_senders(target_block) + )?; - let block = block.ok_or_else(|| EthApiError::UnknownBlockNumber)?; + let Some(block) = block else { return Err(EthApiError::UnknownBlockNumber) }; let gas_limit = self.inner.gas_cap; // we're essentially replaying the transactions in the block here, hence we need the state @@ -112,11 +113,8 @@ where if replay_block_txs { // only need to replay the transactions in the block if not all transactions are // to be replayed - let transactions = block.body.into_iter().take(num_txs); - - // Execute all transactions until index + let transactions = block.into_transactions_ecrecovered().take(num_txs); for tx in transactions { - let tx = tx.into_ecrecovered().ok_or(BlockError::InvalidSignature)?; let tx = tx_env_with_recovered(&tx); let env = Env { cfg: cfg.clone(), block: block_env.clone(), tx }; let (res, _) = transact(&mut db, env)?; diff --git a/crates/rpc/rpc/src/eth/api/transactions.rs b/crates/rpc/rpc/src/eth/api/transactions.rs index 93577db24037..1e07e4ee372b 100644 --- a/crates/rpc/rpc/src/eth/api/transactions.rs +++ b/crates/rpc/rpc/src/eth/api/transactions.rs @@ -1037,19 +1037,16 @@ where block_id: impl Into, index: Index, ) -> EthResult> { - let block_id = block_id.into(); - - if let Some(block) = self.block(block_id).await? { + if let Some(block) = self.block_with_senders(block_id.into()).await? { let block_hash = block.hash; - let block = block.unseal(); - if let Some(tx_signed) = block.body.into_iter().nth(index.into()) { - let tx = - tx_signed.into_ecrecovered().ok_or(EthApiError::InvalidTransactionSignature)?; + let block_number = block.number; + let base_fee_per_gas = block.base_fee_per_gas; + if let Some(tx) = block.into_transactions_ecrecovered().nth(index.into()) { return Ok(Some(from_recovered_with_block_context( tx, block_hash, - block.header.number, - block.header.base_fee_per_gas, + block_number, + base_fee_per_gas, index.into(), ))) }