From ca60c9c286a4aae29951c73c09e60364c71a3d3d Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Wed, 4 Sep 2024 20:24:07 -0500 Subject: [PATCH] is deprecated exn (#96) --- main/src/constants.rs | 2 +- main/src/main.rs | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/main/src/constants.rs b/main/src/constants.rs index 628ef38..c34e7ed 100644 --- a/main/src/constants.rs +++ b/main/src/constants.rs @@ -45,4 +45,4 @@ pub const PROJECT_HASH_SECTION_NAME: &str = "project_hash"; pub const TOOLCHAIN_FILE_NAME: &str = "rust-toolchain.toml"; /// The default endpoint for connections to a Stylus-enabled Arbitrum node. -pub const DEFAULT_ENDPOINT: &str = "https://sepolia-rollup.arbitrum.io/rpc"; +pub const DEFAULT_ENDPOINT: &str = "http://localhost:8547"; diff --git a/main/src/main.rs b/main/src/main.rs index 44c0227..60baf75 100644 --- a/main/src/main.rs +++ b/main/src/main.rs @@ -415,9 +415,9 @@ fn main() -> Result<()> { _ => {} }; - // see if custom extension exists + // see if custom extension exists and is not a deprecated extension let custom = format!("cargo-stylus-{arg}"); - if sys::command_exists(&custom) { + if sys::command_exists(&custom) && !is_deprecated_extension(&arg) { let mut command = sys::new_command(&custom); command.arg(arg).args(args); @@ -440,6 +440,16 @@ fn main() -> Result<()> { runtime.block_on(main_impl(opts)) } +// Checks if a cargo stylus extension is an old, deprecated extension which is no longer +// supported. These extensions are now incorporated as part of the `cargo-stylus` command itself and +// will be the preferred method of running them. +fn is_deprecated_extension(subcommand: &str) -> bool { + match subcommand { + "cargo-stylus-check" | "cargo-stylus-cgen" | "cargo-stylus-replay" => true, + _ => false, + } +} + async fn main_impl(args: Opts) -> Result<()> { macro_rules! run { ($expr:expr, $($msg:expr),+) => {