mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-09 15:28:01 -05:00
feat: record if callee account was created
This commit is contained in:
@@ -241,8 +241,9 @@ impl TracingInspector {
|
|||||||
created_address: Option<Address>,
|
created_address: Option<Address>,
|
||||||
) {
|
) {
|
||||||
let trace_idx = self.pop_trace_idx();
|
let trace_idx = self.pop_trace_idx();
|
||||||
let trace = &mut self.traces.arena[trace_idx].trace;
|
|
||||||
|
|
||||||
|
let trace = &mut self.traces.arena[trace_idx].trace;
|
||||||
|
// check if this is the root call
|
||||||
if trace_idx == 0 {
|
if trace_idx == 0 {
|
||||||
// this is the root call which should get the gas used of the transaction
|
// this is the root call which should get the gas used of the transaction
|
||||||
// refunds are applied after execution, which is when the root call ends
|
// refunds are applied after execution, which is when the root call ends
|
||||||
@@ -261,6 +262,15 @@ impl TracingInspector {
|
|||||||
// A new contract was created via CREATE
|
// A new contract was created via CREATE
|
||||||
trace.address = address;
|
trace.address = address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.config.record_state_diff {
|
||||||
|
// check if the `address` account of a call was created
|
||||||
|
if !trace.kind.is_any_create() && trace.success {
|
||||||
|
if let Some(acc) = data.journaled_state.state.get(&trace.address) {
|
||||||
|
trace.is_callee_account_created = Some(acc.is_created());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Starts tracking a step
|
/// Starts tracking a step
|
||||||
|
|||||||
@@ -126,6 +126,13 @@ pub(crate) struct CallTrace {
|
|||||||
/// In other words, this is the callee if the [CallKind::Call] or the address of the created
|
/// In other words, this is the callee if the [CallKind::Call] or the address of the created
|
||||||
/// contract if [CallKind::Create].
|
/// contract if [CallKind::Create].
|
||||||
pub(crate) address: Address,
|
pub(crate) address: Address,
|
||||||
|
/// If this is a Call, this tracks whether the callee address was created in this transaction.
|
||||||
|
///
|
||||||
|
/// This is only required for state diff related tracing, such as parity tracing with
|
||||||
|
/// `stateDiff`.
|
||||||
|
///
|
||||||
|
/// Note: this will always be None for [CallKind::Create] [CallKind::Create2] calls.
|
||||||
|
pub(crate) is_callee_account_created: Option<bool>,
|
||||||
/// Whether this is a call to a precompile
|
/// Whether this is a call to a precompile
|
||||||
///
|
///
|
||||||
/// Note: This is an Option because not all tracers make use of this
|
/// Note: This is an Option because not all tracers make use of this
|
||||||
@@ -198,6 +205,7 @@ impl Default for CallTrace {
|
|||||||
success: Default::default(),
|
success: Default::default(),
|
||||||
caller: Default::default(),
|
caller: Default::default(),
|
||||||
address: Default::default(),
|
address: Default::default(),
|
||||||
|
is_callee_account_created: None,
|
||||||
selfdestruct_refund_target: None,
|
selfdestruct_refund_target: None,
|
||||||
kind: Default::default(),
|
kind: Default::default(),
|
||||||
value: Default::default(),
|
value: Default::default(),
|
||||||
|
|||||||
Reference in New Issue
Block a user