Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion crates/forge-runner/src/debugging/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ pub enum Component {
CallType,
/// The result of the call, transformed for display.
CallResult,
/// The function trace, will be only shown if the contract is not a fork.
FunctionTrace,
}
impl Component {
/// Returns minimal [`TraceVerbosity`] for the component.
Expand All @@ -30,7 +32,8 @@ impl Component {
Component::ContractAddress
| Component::CallerAddress
| Component::EntryPointType
| Component::CallType => TraceVerbosity::Detailed,
| Component::CallType
| Component::FunctionTrace => TraceVerbosity::Detailed,
}
}
}
Expand All @@ -45,6 +48,7 @@ impl From<&Component> for debugging::Component {
Component::CallerAddress => debugging::Component::CallerAddress,
Component::CallType => debugging::Component::CallType,
Component::CallResult => debugging::Component::CallResult,
Component::FunctionTrace => debugging::Component::FunctionTrace,
}
}
}
100 changes: 92 additions & 8 deletions crates/forge/tests/e2e/debugging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ fn test_output(trace_message_fn: fn(&str) -> String) -> String {
}
}

#[expect(clippy::too_many_lines)]
fn detailed_debugging_trace_message(test_name: &str) -> String {
formatdoc! {r"
[test name] trace_info_integrationtest::test_trace::test_debugging_trace_{test_name}
Expand All @@ -154,6 +155,40 @@ fn detailed_debugging_trace_message(test_name: &str) -> String {
│ ├─ [caller address] [..]
│ ├─ [call type] Call
│ ├─ [call result] success: array![RecursiveCall {{ contract_address: ContractAddress([..]), payload: array![RecursiveCall {{ contract_address: ContractAddress([..]), payload: array![] }}, RecursiveCall {{ contract_address: ContractAddress([..]), payload: array![] }}] }}, RecursiveCall {{ contract_address: ContractAddress([..]), payload: array![] }}]
│ ├─ [function call tree]
│ │ └─ [non inlined] trace_info::SimpleContract::__wrapper__RecursiveCallerImpl__execute_calls
│ │ ├─ [non inlined] core::array::ArraySerde::deserialize
│ │ │ └─ [non inlined] core::array::deserialize_array_helper
│ │ │ └─ [non inlined] trace_info::RecursiveCallSerde::deserialize
│ │ │ └─ [non inlined] core::array::ArraySerde::deserialize
│ │ │ └─ [non inlined] core::array::deserialize_array_helper
│ │ │ └─ [non inlined] trace_info::RecursiveCallSerde::deserialize
│ │ │ └─ [non inlined] core::array::ArraySerde::deserialize
│ │ │ └─ [non inlined] core::array::deserialize_array_helper
│ │ ├─ [non inlined] trace_info::SimpleContract::RecursiveCallerImpl::execute_calls[182-514]
│ │ │ ├─ [non inlined] core::array::ArrayTCloneImpl::clone
│ │ │ │ └─ [non inlined] core::array::ArrayTCloneImpl::clone[120-295]
│ │ │ │ └─ [non inlined] trace_info::RecursiveCallClone::clone
│ │ │ │ └─ [non inlined] core::array::ArrayTCloneImpl::clone
│ │ │ │ └─ [non inlined] core::array::ArrayTCloneImpl::clone[120-295]
│ │ │ ├─ [non inlined] core::array::ArraySerde::serialize
│ │ │ │ └─ [non inlined] core::array::serialize_array_helper
│ │ │ │ └─ [non inlined] trace_info::RecursiveCallSerde::serialize
│ │ │ │ └─ [non inlined] core::array::ArraySerde::serialize
│ │ │ │ └─ [non inlined] core::array::serialize_array_helper
│ │ │ └─ [non inlined] core::array::ArraySerde::deserialize
│ │ │ └─ [non inlined] core::array::deserialize_array_helper
│ │ │ └─ [non inlined] trace_info::RecursiveCallSerde::deserialize
│ │ │ └─ [non inlined] core::array::ArraySerde::deserialize
│ │ │ └─ [non inlined] core::array::deserialize_array_helper
│ │ └─ [non inlined] core::array::ArraySerde::serialize
│ │ └─ [non inlined] core::array::serialize_array_helper
│ │ └─ [non inlined] trace_info::RecursiveCallSerde::serialize
│ │ └─ [non inlined] core::array::ArraySerde::serialize
│ │ └─ [non inlined] core::array::serialize_array_helper
│ │ └─ [non inlined] trace_info::RecursiveCallSerde::serialize
│ │ └─ [non inlined] core::array::ArraySerde::serialize
│ │ └─ [non inlined] core::array::serialize_array_helper
│ ├─ [selector] execute_calls
│ │ ├─ [contract name] SimpleContract
│ │ ├─ [entry point type] External
Expand All @@ -162,38 +197,81 @@ fn detailed_debugging_trace_message(test_name: &str) -> String {
│ │ ├─ [caller address] [..]
│ │ ├─ [call type] Call
│ │ ├─ [call result] success: array![RecursiveCall {{ contract_address: ContractAddress([..]), payload: array![] }}, RecursiveCall {{ contract_address: ContractAddress([..]), payload: array![] }}]
│ │ ├─ [function call tree]
│ │ │ └─ [non inlined] trace_info::SimpleContract::__wrapper__RecursiveCallerImpl__execute_calls
│ │ │ ├─ [non inlined] core::array::ArraySerde::deserialize
│ │ │ │ └─ [non inlined] core::array::deserialize_array_helper
│ │ │ │ └─ [non inlined] trace_info::RecursiveCallSerde::deserialize
│ │ │ │ └─ [non inlined] core::array::ArraySerde::deserialize
│ │ │ │ └─ [non inlined] core::array::deserialize_array_helper
│ │ │ ├─ [non inlined] trace_info::SimpleContract::RecursiveCallerImpl::execute_calls[182-514]
│ │ │ │ ├─ [non inlined] core::array::ArrayTCloneImpl::clone
│ │ │ │ │ └─ [non inlined] core::array::ArrayTCloneImpl::clone[120-295]
│ │ │ │ ├─ [non inlined] core::array::ArraySerde::serialize
│ │ │ │ │ └─ [non inlined] core::array::serialize_array_helper
│ │ │ │ └─ [non inlined] core::array::ArraySerde::deserialize
│ │ │ │ └─ [non inlined] core::array::deserialize_array_helper
│ │ │ └─ [non inlined] core::array::ArraySerde::serialize
│ │ │ └─ [non inlined] core::array::serialize_array_helper
│ │ │ └─ [non inlined] trace_info::RecursiveCallSerde::serialize
│ │ │ └─ [non inlined] core::array::ArraySerde::serialize
│ │ │ └─ [non inlined] core::array::serialize_array_helper
│ │ ├─ [selector] execute_calls
│ │ │ ├─ [contract name] SimpleContract
│ │ │ ├─ [entry point type] External
│ │ │ ├─ [calldata] array![]
│ │ │ ├─ [contract address] [..]
│ │ │ ├─ [caller address] [..]
│ │ │ ├─ [call type] Call
│ │ │ └─ [call result] success: array![]
│ │ │ ├─ [call result] success: array![]
│ │ │ └─ [function call tree]
│ │ │ └─ [non inlined] trace_info::SimpleContract::__wrapper__RecursiveCallerImpl__execute_calls
│ │ │ ├─ [non inlined] core::array::ArraySerde::deserialize
│ │ │ │ └─ [non inlined] core::array::deserialize_array_helper
│ │ │ ├─ [non inlined] trace_info::SimpleContract::RecursiveCallerImpl::execute_calls[182-514]
│ │ │ └─ [non inlined] core::array::ArraySerde::serialize
│ │ │ └─ [non inlined] core::array::serialize_array_helper
│ │ └─ [selector] execute_calls
│ │ ├─ [contract name] SimpleContract
│ │ ├─ [entry point type] External
│ │ ├─ [calldata] array![]
│ │ ├─ [contract address] [..]
│ │ ├─ [caller address] [..]
│ │ ├─ [call type] Call
│ │ └─ [call result] success: array![]
│ │ ├─ [call result] success: array![]
│ │ └─ [function call tree]
│ │ └─ [non inlined] trace_info::SimpleContract::__wrapper__RecursiveCallerImpl__execute_calls
│ │ ├─ [non inlined] core::array::ArraySerde::deserialize
│ │ │ └─ [non inlined] core::array::deserialize_array_helper
│ │ ├─ [non inlined] trace_info::SimpleContract::RecursiveCallerImpl::execute_calls[182-514]
│ │ └─ [non inlined] core::array::ArraySerde::serialize
│ │ └─ [non inlined] core::array::serialize_array_helper
│ └─ [selector] execute_calls
│ ├─ [contract name] SimpleContract
│ ├─ [entry point type] External
│ ├─ [calldata] array![]
│ ├─ [contract address] [..]
│ ├─ [caller address] [..]
│ ├─ [call type] Call
│ └─ [call result] success: array![]
│ ├─ [call result] success: array![]
│ └─ [function call tree]
│ └─ [non inlined] trace_info::SimpleContract::__wrapper__RecursiveCallerImpl__execute_calls
│ ├─ [non inlined] core::array::ArraySerde::deserialize
│ │ └─ [non inlined] core::array::deserialize_array_helper
│ ├─ [non inlined] trace_info::SimpleContract::RecursiveCallerImpl::execute_calls[182-514]
│ └─ [non inlined] core::array::ArraySerde::serialize
│ └─ [non inlined] core::array::serialize_array_helper
└─ [selector] fail
├─ [contract name] SimpleContract
├─ [entry point type] External
├─ [calldata] array![0x1, 0x2, 0x3, 0x4, 0x5]
├─ [contract address] [..]
├─ [caller address] [..]
├─ [call type] Call
└─ [call result] panic: (0x1, 0x2, 0x3, 0x4, 0x5)
├─ [call result] panic: (0x1, 0x2, 0x3, 0x4, 0x5)
└─ [function call tree]
└─ [non inlined] trace_info::SimpleContract::__wrapper__FailingImpl__fail
└─ [non inlined] core::array::deserialize_array_helper
"}
}

Expand All @@ -208,6 +286,7 @@ fn detailed_debugging_trace_message_fork(test_name: &str) -> String {
│ ├─ [caller address] [..]
│ ├─ [call type] Call
│ ├─ [call result] success: array![RecursiveCall {{ contract_address: ContractAddress([..]), payload: array![RecursiveCall {{ contract_address: ContractAddress([..]), payload: array![] }}, RecursiveCall {{ contract_address: ContractAddress([..]), payload: array![] }}] }}, RecursiveCall {{ contract_address: ContractAddress([..]), payload: array![] }}]
│ ├─ [function trace error] function trace is not supported for forked contracts
│ ├─ [selector] execute_calls
│ │ ├─ [contract name] forked contract
│ │ ├─ [entry point type] External
Expand All @@ -216,38 +295,43 @@ fn detailed_debugging_trace_message_fork(test_name: &str) -> String {
│ │ ├─ [caller address] [..]
│ │ ├─ [call type] Call
│ │ ├─ [call result] success: array![RecursiveCall {{ contract_address: ContractAddress([..]), payload: array![] }}, RecursiveCall {{ contract_address: ContractAddress([..]), payload: array![] }}]
│ │ ├─ [function trace error] function trace is not supported for forked contracts
│ │ ├─ [selector] execute_calls
│ │ │ ├─ [contract name] forked contract
│ │ │ ├─ [entry point type] External
│ │ │ ├─ [calldata] array![]
│ │ │ ├─ [contract address] [..]
│ │ │ ├─ [caller address] [..]
│ │ │ ├─ [call type] Call
│ │ │ └─ [call result] success: array![]
│ │ │ ├─ [call result] success: array![]
│ │ │ └─ [function trace error] function trace is not supported for forked contracts
│ │ └─ [selector] execute_calls
│ │ ├─ [contract name] forked contract
│ │ ├─ [entry point type] External
│ │ ├─ [calldata] array![]
│ │ ├─ [contract address] [..]
│ │ ├─ [caller address] [..]
│ │ ├─ [call type] Call
│ │ └─ [call result] success: array![]
│ │ ├─ [call result] success: array![]
│ │ └─ [function trace error] function trace is not supported for forked contracts
│ └─ [selector] execute_calls
│ ├─ [contract name] forked contract
│ ├─ [entry point type] External
│ ├─ [calldata] array![]
│ ├─ [contract address] [..]
│ ├─ [caller address] [..]
│ ├─ [call type] Call
│ └─ [call result] success: array![]
│ ├─ [call result] success: array![]
│ └─ [function trace error] function trace is not supported for forked contracts
└─ [selector] fail
├─ [contract name] forked contract
├─ [entry point type] External
├─ [calldata] array![0x1, 0x2, 0x3, 0x4, 0x5]
├─ [contract address] [..]
├─ [caller address] [..]
├─ [call type] Call
└─ [call result] panic: (0x1, 0x2, 0x3, 0x4, 0x5)
├─ [call result] panic: (0x1, 0x2, 0x3, 0x4, 0x5)
└─ [function trace error] function trace is not supported for forked contracts
"}
}

Expand Down
Loading