From dc8d980ee312abdc24a0c92193cf433be23aa1df Mon Sep 17 00:00:00 2001 From: Marquis Shanahan <29431502+9547@users.noreply.github.com> Date: Mon, 6 Jan 2025 20:02:33 +0800 Subject: [PATCH] chore(forge): remove `forge debug` subcommand (#9606) forge: rm subcommand debug Co-authored-by: 9547 Co-authored-by: zerosnacks <95942363+zerosnacks@users.noreply.github.com> --- crates/forge/bin/cmd/debug.rs | 69 ----------------------------------- crates/forge/bin/cmd/mod.rs | 1 - crates/forge/bin/main.rs | 1 - crates/forge/bin/opts.rs | 8 +--- 4 files changed, 2 insertions(+), 77 deletions(-) delete mode 100644 crates/forge/bin/cmd/debug.rs diff --git a/crates/forge/bin/cmd/debug.rs b/crates/forge/bin/cmd/debug.rs deleted file mode 100644 index 5ccfc13d57d0..000000000000 --- a/crates/forge/bin/cmd/debug.rs +++ /dev/null @@ -1,69 +0,0 @@ -use clap::{Parser, ValueHint}; -use forge_script::ScriptArgs; -use forge_verify::retry::RETRY_VERIFY_ON_CREATE; -use foundry_cli::opts::CoreBuildArgs; -use foundry_common::evm::EvmArgs; -use std::path::PathBuf; - -// Loads project's figment and merges the build cli arguments into it -foundry_config::impl_figment_convert!(DebugArgs, opts, evm_args); - -/// CLI arguments for `forge debug`. -#[derive(Clone, Debug, Parser)] -pub struct DebugArgs { - /// The contract you want to run. Either the file path or contract name. - /// - /// If multiple contracts exist in the same file you must specify the target contract with - /// --target-contract. - #[arg(value_hint = ValueHint::FilePath)] - pub path: PathBuf, - - /// Arguments to pass to the script function. - pub args: Vec, - - /// The name of the contract you want to run. - #[arg(long, visible_alias = "tc", value_name = "CONTRACT_NAME")] - pub target_contract: Option, - - /// The signature of the function you want to call in the contract, or raw calldata. - #[arg(long, short, default_value = "run()", value_name = "SIGNATURE")] - pub sig: String, - - /// Open the script in the debugger. - #[arg(long)] - pub debug: bool, - - /// File path to dump execution details as JSON. - #[arg( - long, - requires = "debug", - value_hint = ValueHint::FilePath, - value_name = "PATH" - )] - pub dump: Option, - - #[command(flatten)] - pub opts: CoreBuildArgs, - - #[command(flatten)] - pub evm_args: EvmArgs, -} - -impl DebugArgs { - pub async fn run(self) -> eyre::Result<()> { - let script = ScriptArgs { - path: self.path.to_str().expect("Invalid path string.").to_string(), - args: self.args, - target_contract: self.target_contract, - sig: self.sig, - gas_estimate_multiplier: 130, - opts: self.opts, - evm_args: self.evm_args, - debug: true, - dump: self.dump, - retry: RETRY_VERIFY_ON_CREATE, - ..Default::default() - }; - script.run_script().await - } -} diff --git a/crates/forge/bin/cmd/mod.rs b/crates/forge/bin/cmd/mod.rs index 427b25fb0c50..d6a70c9da7a9 100644 --- a/crates/forge/bin/cmd/mod.rs +++ b/crates/forge/bin/cmd/mod.rs @@ -48,7 +48,6 @@ pub mod compiler; pub mod config; pub mod coverage; pub mod create; -pub mod debug; pub mod doc; pub mod eip712; pub mod flatten; diff --git a/crates/forge/bin/main.rs b/crates/forge/bin/main.rs index d60c1639a05a..60a55af7a82d 100644 --- a/crates/forge/bin/main.rs +++ b/crates/forge/bin/main.rs @@ -58,7 +58,6 @@ fn run() -> Result<()> { cmd.run().map(drop) } } - ForgeSubcommand::Debug(cmd) => utils::block_on(cmd.run()), ForgeSubcommand::VerifyContract(args) => utils::block_on(args.run()), ForgeSubcommand::VerifyCheck(args) => utils::block_on(args.run()), ForgeSubcommand::VerifyBytecode(cmd) => utils::block_on(cmd.run()), diff --git a/crates/forge/bin/opts.rs b/crates/forge/bin/opts.rs index 380cb61d403a..f32ec0222654 100644 --- a/crates/forge/bin/opts.rs +++ b/crates/forge/bin/opts.rs @@ -1,7 +1,7 @@ use crate::cmd::{ bind::BindArgs, bind_json, build::BuildArgs, cache::CacheArgs, clone::CloneArgs, - compiler::CompilerArgs, config, coverage, create::CreateArgs, debug::DebugArgs, doc::DocArgs, - eip712, flatten, fmt::FmtArgs, geiger, generate, init::InitArgs, inspect, install::InstallArgs, + compiler::CompilerArgs, config, coverage, create::CreateArgs, doc::DocArgs, eip712, flatten, + fmt::FmtArgs, geiger, generate, init::InitArgs, inspect, install::InstallArgs, remappings::RemappingArgs, remove::RemoveArgs, selectors::SelectorsSubcommands, snapshot, soldeer, test, tree, update, }; @@ -61,10 +61,6 @@ pub enum ForgeSubcommand { /// Clone a contract from Etherscan. Clone(CloneArgs), - /// Debugs a single smart contract as a script. - #[command(visible_alias = "d")] - Debug(DebugArgs), - /// Update one or multiple dependencies. /// /// If no arguments are provided, then all dependencies are updated.