Skip to content

[Feature] Add helper iterator for Callframe #2775

@mattsse

Description

@mattsse

Component

rpc

Describe the feature you would like

Callframe is a nested/recursive structure

pub struct CallFrame {
/// The address of that initiated the call.
pub from: Address,
/// How much gas was left before the call.
#[serde(default)]
pub gas: U256,
/// How much gas was used by the call.
#[serde(default, rename = "gasUsed")]
pub gas_used: U256,
/// The address of the contract that was called.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub to: Option<Address>,
/// Calldata input.
pub input: Bytes,
/// Output of the call, if any.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub output: Option<Bytes>,
/// Error message, if any.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub error: Option<String>,
/// Why this call reverted, if it reverted.
#[serde(default, rename = "revertReason", skip_serializing_if = "Option::is_none")]
pub revert_reason: Option<String>,
/// Recorded child calls.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub calls: Vec<CallFrame>,

it would be nice to have an iterator type that iterates over all callframes but allows skipping child calls

TODO

  • add helper iterator that keeps track of the parent <> child relation ship and can skip child calls
  • this can also be solved with some stack based approach

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions