From 931e4529d964d01268cb5965877f3d81d32c921e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Ignacio=20Gonz=C3=A1lez?= Date: Mon, 12 Aug 2024 15:31:21 +0300 Subject: [PATCH] feat(zk_toolbox): Add zk_supervisor test l1 contracts command (#2613) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What ❔ Add zk_supervisor test l1 contracts command --- .../src/commands/test/l1_contracts.rs | 18 ++++++++++++++++++ .../zk_supervisor/src/commands/test/mod.rs | 8 ++++++-- .../crates/zk_supervisor/src/messages.rs | 2 ++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 zk_toolbox/crates/zk_supervisor/src/commands/test/l1_contracts.rs diff --git a/zk_toolbox/crates/zk_supervisor/src/commands/test/l1_contracts.rs b/zk_toolbox/crates/zk_supervisor/src/commands/test/l1_contracts.rs new file mode 100644 index 000000000000..0a1e1ec5203f --- /dev/null +++ b/zk_toolbox/crates/zk_supervisor/src/commands/test/l1_contracts.rs @@ -0,0 +1,18 @@ +use common::{cmd::Cmd, logger}; +use config::EcosystemConfig; +use xshell::{cmd, Shell}; + +use crate::messages::MSG_L1_CONTRACTS_TEST_SUCCESS; + +pub fn run(shell: &Shell) -> anyhow::Result<()> { + let ecosystem = EcosystemConfig::from_file(shell)?; + let _dir_guard = shell.push_dir(&ecosystem.link_to_code); + + Cmd::new(cmd!(shell, "yarn l1-contracts test")) + .with_force_run() + .run()?; + + logger::outro(MSG_L1_CONTRACTS_TEST_SUCCESS); + + Ok(()) +} diff --git a/zk_toolbox/crates/zk_supervisor/src/commands/test/mod.rs b/zk_toolbox/crates/zk_supervisor/src/commands/test/mod.rs index de374c91bb94..b22189078da4 100644 --- a/zk_toolbox/crates/zk_supervisor/src/commands/test/mod.rs +++ b/zk_toolbox/crates/zk_supervisor/src/commands/test/mod.rs @@ -3,12 +3,13 @@ use clap::Subcommand; use xshell::Shell; use crate::messages::{ - MSG_INTEGRATION_TESTS_ABOUT, MSG_PROVER_TEST_ABOUT, MSG_RECOVERY_TEST_ABOUT, - MSG_REVERT_TEST_ABOUT, MSG_UPGRADE_TEST_ABOUT, + MSG_INTEGRATION_TESTS_ABOUT, MSG_L1_CONTRACTS_ABOUT, MSG_PROVER_TEST_ABOUT, + MSG_RECOVERY_TEST_ABOUT, MSG_REVERT_TEST_ABOUT, MSG_UPGRADE_TEST_ABOUT, }; mod args; mod integration; +mod l1_contracts; mod prover; mod recovery; mod revert; @@ -24,6 +25,8 @@ pub enum TestCommands { Recovery(RecoveryArgs), #[clap(about = MSG_UPGRADE_TEST_ABOUT, alias = "u")] Upgrade, + #[clap(about = MSG_L1_CONTRACTS_ABOUT, alias = "l1")] + L1Contracts, #[clap(about = MSG_PROVER_TEST_ABOUT, alias = "p")] Prover, } @@ -34,6 +37,7 @@ pub fn run(shell: &Shell, args: TestCommands) -> anyhow::Result<()> { TestCommands::Revert(args) => revert::run(shell, args), TestCommands::Recovery(args) => recovery::run(shell, args), TestCommands::Upgrade => upgrade::run(shell), + TestCommands::L1Contracts => l1_contracts::run(shell), TestCommands::Prover => prover::run(shell), } } diff --git a/zk_toolbox/crates/zk_supervisor/src/messages.rs b/zk_toolbox/crates/zk_supervisor/src/messages.rs index 7bb056acb0db..bb58b0983e7d 100644 --- a/zk_toolbox/crates/zk_supervisor/src/messages.rs +++ b/zk_toolbox/crates/zk_supervisor/src/messages.rs @@ -77,6 +77,8 @@ pub(super) const MSG_UPGRADE_TEST_ABOUT: &str = "Run upgrade tests"; pub(super) const MSG_TESTS_EXTERNAL_NODE_HELP: &str = "Run tests for external node"; pub(super) const MSG_TESTS_RECOVERY_SNAPSHOT_HELP: &str = "Run recovery from a snapshot instead of genesis"; +pub(super) const MSG_L1_CONTRACTS_ABOUT: &str = "Run L1 contracts tests"; +pub(super) const MSG_L1_CONTRACTS_TEST_SUCCESS: &str = "L1 contracts tests ran successfully"; pub(super) const MSG_PROVER_TEST_ABOUT: &str = "Run prover tests"; pub(super) const MSG_PROVER_TEST_SUCCESS: &str = "Prover tests ran successfully";