mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
use SealedBlockedWithSenders in block-level tracing (#5620)
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
@ -30,8 +30,8 @@ use reth_revm::{
|
||||
tracing::{TracingInspector, TracingInspectorConfig},
|
||||
};
|
||||
use reth_rpc_types::{
|
||||
BlockError, CallRequest, Index, Log, Transaction, TransactionInfo, TransactionReceipt,
|
||||
TransactionRequest, TypedTransactionRequest,
|
||||
CallRequest, Index, Log, Transaction, TransactionInfo, TransactionReceipt, TransactionRequest,
|
||||
TypedTransactionRequest,
|
||||
};
|
||||
use reth_rpc_types_compat::transaction::from_recovered_with_block_context;
|
||||
use reth_transaction_pool::{TransactionOrigin, TransactionPool};
|
||||
@ -779,12 +779,9 @@ where
|
||||
R: Send + 'static,
|
||||
{
|
||||
let ((cfg, block_env, _), block) =
|
||||
futures::try_join!(self.evm_env_at(block_id), self.block_by_id(block_id),)?;
|
||||
futures::try_join!(self.evm_env_at(block_id), self.block_with_senders(block_id))?;
|
||||
|
||||
let block = match block {
|
||||
Some(block) => block,
|
||||
None => return Ok(None),
|
||||
};
|
||||
let Some(block) = block else { return Ok(None) };
|
||||
|
||||
// replay all transactions of the block
|
||||
self.spawn_tracing_task_with(move |this| {
|
||||
@ -799,13 +796,13 @@ where
|
||||
// prepare transactions, we do everything upfront to reduce time spent with open state
|
||||
let max_transactions =
|
||||
highest_index.map_or(block.body.len(), |highest| highest as usize);
|
||||
let transactions = block
|
||||
.body
|
||||
.into_iter()
|
||||
let mut results = Vec::with_capacity(max_transactions);
|
||||
|
||||
let mut transactions = block
|
||||
.into_transactions_ecrecovered()
|
||||
.take(max_transactions)
|
||||
.enumerate()
|
||||
.map(|(idx, tx)| -> EthResult<_> {
|
||||
let tx = tx.into_ecrecovered().ok_or(BlockError::InvalidSignature)?;
|
||||
.map(|(idx, tx)| {
|
||||
let tx_info = TransactionInfo {
|
||||
hash: Some(tx.hash()),
|
||||
index: Some(idx as u64),
|
||||
@ -814,19 +811,14 @@ where
|
||||
base_fee: Some(base_fee),
|
||||
};
|
||||
let tx_env = tx_env_with_recovered(&tx);
|
||||
|
||||
Ok((tx_info, tx_env))
|
||||
(tx_info, tx_env)
|
||||
})
|
||||
.collect::<Result<Vec<_>, _>>()?;
|
||||
|
||||
let mut results = Vec::with_capacity(transactions.len());
|
||||
.peekable();
|
||||
|
||||
// now get the state
|
||||
let state = this.state_at(state_at.into())?;
|
||||
let mut db = CacheDB::new(StateProviderDatabase::new(state));
|
||||
|
||||
let mut transactions = transactions.into_iter().peekable();
|
||||
|
||||
while let Some((tx_info, tx)) = transactions.next() {
|
||||
let env = Env { cfg: cfg.clone(), block: block_env.clone(), tx };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user