-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
C-enhancementNew feature or requestNew feature or requestS-needs-triageThis issue needs to be labelledThis issue needs to be labelled
Description
Describe the feature
This currently creates a new evm instance per call
reth/crates/rpc/rpc/src/trace.rs
Lines 160 to 186 in ca116aa
while let Some((call, trace_types)) = calls.next() { | |
let (evm_env, tx_env) = this.eth_api().prepare_call_env( | |
evm_env.clone(), | |
call, | |
&mut db, | |
Default::default(), | |
)?; | |
let config = TracingInspectorConfig::from_parity_config(&trace_types); | |
let mut inspector = TracingInspector::new(config); | |
let (res, _) = | |
this.eth_api().inspect(&mut db, evm_env, tx_env, &mut inspector)?; | |
let trace_res = inspector | |
.into_parity_builder() | |
.into_trace_results_with_state(&res, &trace_types, &db) | |
.map_err(Eth::Error::from_eth_err)?; | |
results.push(trace_res); | |
// need to apply the state changes of this call before executing the | |
// next call | |
if calls.peek().is_some() { | |
// need to apply the state changes of this call before executing | |
// the next call | |
db.commit(res.state) | |
} | |
} |
but we can likely reuse the helpers:
reth/crates/rpc/rpc-eth-api/src/helpers/trace.rs
Lines 338 to 354 in 4874396
let results = this | |
.evm_config() | |
.evm_factory() | |
.create_tracer(StateCacheDbRefMutWrapper(&mut db), evm_env, inspector_setup()) | |
.try_trace_many(block.transactions_recovered().take(max_transactions), |ctx| { | |
let tx_info = TransactionInfo { | |
hash: Some(*ctx.tx.tx_hash()), | |
index: Some(idx), | |
block_hash: Some(block_hash), | |
block_number: Some(block_number), | |
base_fee: Some(base_fee), | |
}; | |
idx += 1; | |
f(tx_info, ctx) | |
}) | |
.collect::<Result<_, _>>()?; |
maybe we'd need another trait fn for this that just traces calls
Additional context
assigned to @ongyimeng
Metadata
Metadata
Assignees
Labels
C-enhancementNew feature or requestNew feature or requestS-needs-triageThis issue needs to be labelledThis issue needs to be labelled
Type
Projects
Status
Backlog