From e50aa21bb56ec39a7dd209a36f82ef81126c5fea Mon Sep 17 00:00:00 2001 From: Well Date: Mon, 25 Aug 2025 01:17:35 +0800 Subject: [PATCH] add --disable-labels for forge script and test --- crates/forge/src/cmd/test/mod.rs | 5 +++++ crates/script/src/execute.rs | 1 + crates/script/src/lib.rs | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/crates/forge/src/cmd/test/mod.rs b/crates/forge/src/cmd/test/mod.rs index 27ab00cf2b52c..d04d2f172a234 100644 --- a/crates/forge/src/cmd/test/mod.rs +++ b/crates/forge/src/cmd/test/mod.rs @@ -186,6 +186,10 @@ pub struct TestArgs { #[arg(long, help_heading = "Display options", requires = "summary")] pub detailed: bool, + /// Disables the labels in the traces. + #[arg(long, help_heading = "Display options")] + pub disable_labels: bool, + #[command(flatten)] filter: FilterArgs, @@ -527,6 +531,7 @@ impl TestArgs { // Build the trace decoder. let mut builder = CallTraceDecoderBuilder::new() .with_known_contracts(&known_contracts) + .with_label_disabled(self.disable_labels) .with_verbosity(verbosity); // Signatures are of no value for gas reports. if !self.gas_report { diff --git a/crates/script/src/execute.rs b/crates/script/src/execute.rs index 091f021941500..06a665b86823a 100644 --- a/crates/script/src/execute.rs +++ b/crates/script/src/execute.rs @@ -332,6 +332,7 @@ impl ExecutedState { .with_signature_identifier(SignaturesIdentifier::from_config( &self.script_config.config, )?) + .with_label_disabled(self.args.disable_labels) .build(); let mut identifier = TraceIdentifiers::new().with_local(known_contracts).with_etherscan( diff --git a/crates/script/src/lib.rs b/crates/script/src/lib.rs index 82fa3ff6eff55..efb6ee78e87c2 100644 --- a/crates/script/src/lib.rs +++ b/crates/script/src/lib.rs @@ -182,6 +182,10 @@ pub struct ScriptArgs { #[arg(long)] pub disable_code_size_limit: bool, + /// Disables the labels in the traces. + #[arg(long)] + pub disable_labels: bool, + /// The Etherscan (or equivalent) API key #[arg(long, env = "ETHERSCAN_API_KEY", value_name = "KEY")] pub etherscan_api_key: Option,