Skip to main content

foundry_config/
trace.rs

1//! Configuration for trace rendering.
2
3use alloy_primitives::map::AddressHashMap;
4use serde::{Deserialize, Serialize};
5
6/// Configuration for trace rendering.
7#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
8#[serde(default)]
9pub struct TracingConfig {
10    /// Verbosity to use for trace rendering.
11    pub verbosity: u8,
12    /// Address labels to use in traces.
13    #[serde(default, skip_serializing_if = "AddressHashMap::is_empty")]
14    pub labels: AddressHashMap<String>,
15    /// Whether to disable labels in traces.
16    pub disable_labels: bool,
17    /// Whether to hide addresses in trace parameters when labels are available.
18    pub compact_labels: bool,
19    /// Maximum depth of rendered traces.
20    #[serde(default, skip_serializing_if = "Option::is_none")]
21    pub trace_depth: Option<usize>,
22    /// Whether to identify internal functions in traces.
23    pub decode_internal: bool,
24    /// Cumulative Sourcify/Etherscan metadata lookup budget, in seconds.
25    /// Zero disables all external trace identification, including OpenChain.
26    pub external_identification_timeout: u64,
27}
28
29impl Default for TracingConfig {
30    fn default() -> Self {
31        Self {
32            verbosity: 0,
33            labels: Default::default(),
34            disable_labels: false,
35            compact_labels: false,
36            trace_depth: None,
37            decode_internal: false,
38            external_identification_timeout: 5,
39        }
40    }
41}