@@ -1460,21 +1460,6 @@ Task<std::vector<Trace>> TraceCallExecutor::trace_transaction(const BlockWithHas
1460
1460
co_return traces;
1461
1461
}
1462
1462
1463
- bool TraceCallExecutor::run_previous_transactions (EVMExecutor& executor, const silkworm::Block& block, uint64_t tx_id) {
1464
- if (tx_id == 0 ) {
1465
- return true ;
1466
- }
1467
- for (size_t idx = 0 ; idx < block.transactions .size (); idx++) {
1468
- const auto & txn = block.transactions .at (idx);
1469
-
1470
- if (tx_id == idx) {
1471
- return true ;
1472
- }
1473
- executor.call (block, txn, {}, /* refund=*/ true , /* gas_bailout=*/ false );
1474
- }
1475
- return false ;
1476
- }
1477
-
1478
1463
Task<TraceEntriesResult> TraceCallExecutor::trace_transaction_entries (const TransactionWithBlock& transaction_with_block) {
1479
1464
const auto & block = transaction_with_block.block_with_hash ->block ;
1480
1465
const auto block_number = block.header .number ;
@@ -1489,10 +1474,7 @@ Task<TraceEntriesResult> TraceCallExecutor::trace_transaction_entries(const Tran
1489
1474
auto curr_state = tx_.create_state (current_executor, database_reader_, chain_storage_, block_number - 1 );
1490
1475
EVMExecutor executor{*chain_config_ptr, workers_, curr_state};
1491
1476
1492
- if (!run_previous_transactions (executor, block, transaction_with_block.transaction .transaction_index )) {
1493
- SILK_ERROR << " trace_operations: transaction idx: " << transaction_with_block.transaction .transaction_index << " not found" ;
1494
- return {};
1495
- }
1477
+ executor.call_first_n (block, transaction_with_block.transaction .transaction_index );
1496
1478
1497
1479
const auto entry_tracer = std::make_shared<trace::EntryTracer>(initial_ibs);
1498
1480
Tracers tracers{entry_tracer};
@@ -1520,10 +1502,7 @@ Task<std::string> TraceCallExecutor::trace_transaction_error(const TransactionWi
1520
1502
auto curr_state = tx_.create_state (current_executor, database_reader_, chain_storage_, block_number - 1 );
1521
1503
EVMExecutor executor{*chain_config_ptr, workers_, curr_state};
1522
1504
1523
- if (!run_previous_transactions (executor, block, transaction_with_block.transaction .transaction_index )) {
1524
- SILK_ERROR << " trace_transaction_error: transaction idx: " << transaction_with_block.transaction .transaction_index << " not found" ;
1525
- return {};
1526
- }
1505
+ executor.call_first_n (block, transaction_with_block.transaction .transaction_index );
1527
1506
1528
1507
const auto & txn = block.transactions .at (transaction_with_block.transaction .transaction_index );
1529
1508
auto execution_result = executor.call (block, txn, {}, /* refund=*/ true , /* gas_bailout=*/ false );
@@ -1553,10 +1532,7 @@ Task<TraceOperationsResult> TraceCallExecutor::trace_operations(const Transactio
1553
1532
auto curr_state = tx_.create_state (current_executor, database_reader_, chain_storage_, block_number - 1 );
1554
1533
EVMExecutor executor{*chain_config_ptr, workers_, curr_state};
1555
1534
1556
- if (!run_previous_transactions (executor, block, transaction_with_block.transaction .transaction_index )) {
1557
- SILK_ERROR << " trace_operations: transaction idx: " << transaction_with_block.transaction .transaction_index << " not found" ;
1558
- return {};
1559
- }
1535
+ executor.call_first_n (block, transaction_with_block.transaction .transaction_index );
1560
1536
1561
1537
auto entry_tracer = std::make_shared<trace::OperationTracer>(initial_ibs);
1562
1538
Tracers tracers{entry_tracer};
@@ -1785,6 +1761,8 @@ void EntryTracer::on_execution_start(evmc_revision rev, const evmc_message& msg,
1785
1761
const auto str_value = " 0x" + intx::hex (intx::be::load<intx::uint256>(msg.value ));
1786
1762
auto str_input = " 0x" + silkworm::to_hex (input);
1787
1763
1764
+ current_depth_ = msg.depth ;
1765
+
1788
1766
// Ignore precompiles in the returned trace (maybe we shouldn't?)
1789
1767
if (precompile::is_precompile (msg.code_address , rev)) {
1790
1768
// writes special value for index
@@ -1817,7 +1795,6 @@ void EntryTracer::on_execution_start(evmc_revision rev, const evmc_message& msg,
1817
1795
}
1818
1796
}
1819
1797
traces_stack_idx_.emplace (result_.size () - 1 );
1820
- current_depth_ = msg.depth ;
1821
1798
1822
1799
SILK_DEBUG << " EntryTracer::on_execution_start: gas: " << std::dec << msg.gas
1823
1800
<< " , msg.depth: " << msg.depth
0 commit comments