From bc3b3935fe64038b23474161c150af22fb174fc0 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Wed, 29 May 2024 17:17:11 +0300 Subject: [PATCH 1/6] moved scenario-cli to meta crate --- Cargo.lock | 3 ++ framework/meta/Cargo.toml | 14 +++-- framework/meta/src/cli/cli_args_standalone.rs | 33 +++++++++--- framework/meta/src/cli/cli_standalone_main.rs | 14 +++-- framework/meta/src/cmd.rs | 1 + framework/meta/src/cmd/retrieve_address.rs | 14 +++++ framework/meta/src/main.rs | 5 +- framework/scenario/Cargo.toml | 4 -- framework/scenario/src/main.rs | 4 -- .../scenario/src/standalone/account_tool.rs | 2 +- framework/scenario/src/standalone/mod.rs | 4 +- .../scenario/src/standalone/scenario_cli.rs | 51 ------------------- 12 files changed, 68 insertions(+), 81 deletions(-) create mode 100644 framework/meta/src/cmd/retrieve_address.rs delete mode 100644 framework/scenario/src/main.rs delete mode 100644 framework/scenario/src/standalone/scenario_cli.rs diff --git a/Cargo.lock b/Cargo.lock index 8210b20eb5..c6c4694bce 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -1977,12 +1977,15 @@ dependencies = [ "copy_dir", "multiversx-sc", "multiversx-sc-meta-lib", + "multiversx-sc-scenario", + "multiversx-sdk", "pathdiff", "reqwest", "ruplacer", "semver", "serde", "serde_json", + "tokio", "toml", "zip", ] diff --git a/framework/meta/Cargo.toml b/framework/meta/Cargo.toml index 4f1aa79634..01eeea95fe 100644 --- a/framework/meta/Cargo.toml +++ b/framework/meta/Cargo.toml @@ -26,6 +26,7 @@ template-test-released = [] [dependencies] clap = { version = "4.4.7", features = ["derive"] } +tokio = { version = "1.24", features = ["full"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" toml = { version = "0.8.6", features = ["preserve_order"] } @@ -39,13 +40,20 @@ copy_dir = "0.1.2" pathdiff = "0.2.1" common-path = "1.0.0" +[dependencies.multiversx-sc-meta-lib] +version = "=0.50.3" +path = "../meta-lib" + [dependencies.multiversx-sc] version = "=0.50.3" path = "../base" features = ["alloc", "num-bigint"] - -[dependencies.multiversx-sc-meta-lib] +[dependencies.multiversx-sc-scenario] version = "=0.50.3" -path = "../meta-lib" +path = "../scenario" + +[dependencies.multiversx-sdk] +version = "=0.4.1" +path = "../../sdk/core" diff --git a/framework/meta/src/cli/cli_args_standalone.rs b/framework/meta/src/cli/cli_args_standalone.rs index de6d46fac4..e66c83deb4 100644 --- a/framework/meta/src/cli/cli_args_standalone.rs +++ b/framework/meta/src/cli/cli_args_standalone.rs @@ -29,6 +29,9 @@ pub struct StandaloneCliArgs { #[derive(Clone, PartialEq, Eq, Debug, Subcommand)] pub enum StandaloneCliAction { + #[command(name = "install", about = "Installs framework dependencies")] + Install(InstallArgs), + #[command( about = "General info about the contract an libraries residing in the targetted directory.." )] @@ -44,12 +47,6 @@ pub enum StandaloneCliAction { )] Upgrade(UpgradeArgs), - #[command( - name = "local-deps", - about = "Generates a report on the local depedencies of contract crates. Will explore indirect depdencies too." - )] - LocalDeps(LocalDepsArgs), - #[command(name = "new", about = "Creates a contract by a pre-existing template")] Template(TemplateArgs), @@ -68,8 +65,16 @@ pub enum StandaloneCliAction { #[command(name = "test-coverage", about = "Run test coverage and output report")] TestCoverage(TestCoverageArgs), - #[command(name = "install", about = "Installs framework dependencies")] - Install(InstallArgs), + #[command( + about = "Generates a scenario test initialized with real data fetched from the blockchain." + )] + Account(AccountArgs), + + #[command( + name = "local-deps", + about = "Generates a report on the local depedencies of contract crates. Will explore indirect depdencies too." + )] + LocalDeps(LocalDepsArgs), } #[derive(Default, Clone, PartialEq, Eq, Debug, Args)] @@ -326,3 +331,15 @@ pub struct InstallWasm32Args {} #[derive(Default, Clone, PartialEq, Eq, Debug, Args)] pub struct InstallWasmOptArgs {} + +#[derive(Default, Clone, PartialEq, Eq, Debug, Args)] +pub struct AccountArgs { + /// Provide the target API you want the real data to come from + #[arg(long = "api")] + #[clap(global = true)] + pub api: Option, + + /// Provide the address you want to retrieve data from + #[arg(long = "address", verbatim_doc_comment)] + pub address: String, +} diff --git a/framework/meta/src/cli/cli_standalone_main.rs b/framework/meta/src/cli/cli_standalone_main.rs index f9d8b3d6b8..6c8c6a67b0 100644 --- a/framework/meta/src/cli/cli_standalone_main.rs +++ b/framework/meta/src/cli/cli_standalone_main.rs @@ -1,4 +1,5 @@ use crate::cli::{StandaloneCliAction, StandaloneCliArgs}; +use crate::cmd::retrieve_address::retrieve_address; use clap::Parser; use crate::cmd::all::call_all_meta; @@ -12,17 +13,15 @@ use crate::cmd::test_coverage::test_coverage; use crate::cmd::upgrade::upgrade_sc; /// Entry point in the program when calling it as a standalone tool. -pub fn cli_main_standalone() { +pub async fn cli_main_standalone() { let cli_args = StandaloneCliArgs::parse(); match &cli_args.command { Some(StandaloneCliAction::Info(args)) => call_info(args), + Some(StandaloneCliAction::Install(args)) => install(args), Some(StandaloneCliAction::All(args)) => call_all_meta(args), Some(StandaloneCliAction::Upgrade(args)) => { upgrade_sc(args); }, - Some(StandaloneCliAction::LocalDeps(args)) => { - local_deps(args); - }, Some(StandaloneCliAction::Template(args)) => { create_contract(args); }, @@ -36,7 +35,12 @@ pub fn cli_main_standalone() { Some(StandaloneCliAction::TestCoverage(args)) => { test_coverage(args); }, - Some(StandaloneCliAction::Install(args)) => install(args), + Some(StandaloneCliAction::Account(args)) => { + retrieve_address(args).await; + }, + Some(StandaloneCliAction::LocalDeps(args)) => { + local_deps(args); + }, None => {}, } } diff --git a/framework/meta/src/cmd.rs b/framework/meta/src/cmd.rs index 698f10c924..a588f90162 100644 --- a/framework/meta/src/cmd.rs +++ b/framework/meta/src/cmd.rs @@ -3,6 +3,7 @@ pub mod info; pub mod install; pub mod local_deps; pub mod print_util; +pub mod retrieve_address; pub mod scen_test_gen; pub mod template; pub mod test; diff --git a/framework/meta/src/cmd/retrieve_address.rs b/framework/meta/src/cmd/retrieve_address.rs new file mode 100644 index 0000000000..bee3dd90b7 --- /dev/null +++ b/framework/meta/src/cmd/retrieve_address.rs @@ -0,0 +1,14 @@ +use multiversx_sc_scenario::{imports::Bech32Address, standalone::account_tool}; +use multiversx_sdk::blockchain::CommunicationProxy; + +use crate::cli::AccountArgs; + +pub async fn retrieve_address(args: &AccountArgs) { + let api_string = args.api.clone().expect("API needs to be specified"); + let api = CommunicationProxy::new(api_string); + account_tool::print_account_as_scenario_set_state( + &api, + &Bech32Address::from_bech32_string(args.address.to_string()), + ) + .await; +} diff --git a/framework/meta/src/main.rs b/framework/meta/src/main.rs index b3ecec7201..bf9813b1d0 100644 --- a/framework/meta/src/main.rs +++ b/framework/meta/src/main.rs @@ -1,3 +1,4 @@ -fn main() { - multiversx_sc_meta::cli::cli_main_standalone(); +#[tokio::main] +async fn main() { + multiversx_sc_meta::cli::cli_main_standalone().await; } diff --git a/framework/scenario/Cargo.toml b/framework/scenario/Cargo.toml index d6671523d0..b41d274621 100644 --- a/framework/scenario/Cargo.toml +++ b/framework/scenario/Cargo.toml @@ -33,10 +33,6 @@ clap = { version = "4.4.7", features = ["derive"] } tokio = { version = "1.24", features = ["full"] } unwrap-infallible = "0.1.5" -[[bin]] -name = "sc-scenario" -path = "src/main.rs" - [features] run-go-tests = [] diff --git a/framework/scenario/src/main.rs b/framework/scenario/src/main.rs deleted file mode 100644 index 7de76cd7cf..0000000000 --- a/framework/scenario/src/main.rs +++ /dev/null @@ -1,4 +0,0 @@ -#[tokio::main] -async fn main() { - multiversx_sc_scenario::standalone::cli_main().await; -} diff --git a/framework/scenario/src/standalone/account_tool.rs b/framework/scenario/src/standalone/account_tool.rs index b6db384b91..a729edd6a1 100644 --- a/framework/scenario/src/standalone/account_tool.rs +++ b/framework/scenario/src/standalone/account_tool.rs @@ -61,7 +61,7 @@ pub async fn retrieve_account_as_scenario_set_state( set_state_step.put_account(address, account_state) } -pub fn set_account( +fn set_account( account: multiversx_sdk::data::account::Account, account_storage: HashMap, account_esdt: HashMap, diff --git a/framework/scenario/src/standalone/mod.rs b/framework/scenario/src/standalone/mod.rs index 84ecea3916..d7b8f4e539 100644 --- a/framework/scenario/src/standalone/mod.rs +++ b/framework/scenario/src/standalone/mod.rs @@ -1,5 +1,3 @@ -mod account_tool; -mod scenario_cli; +pub mod account_tool; pub use account_tool::retrieve_account_as_scenario_set_state; -pub use scenario_cli::cli_main; diff --git a/framework/scenario/src/standalone/scenario_cli.rs b/framework/scenario/src/standalone/scenario_cli.rs deleted file mode 100644 index 624b316ef0..0000000000 --- a/framework/scenario/src/standalone/scenario_cli.rs +++ /dev/null @@ -1,51 +0,0 @@ -use clap::{Args, Parser, Subcommand}; -use multiversx_sdk::blockchain::CommunicationProxy; - -use crate::imports::Bech32Address; - -use super::account_tool; - -/// Parsed arguments of the meta crate CLI. -#[derive(Default, PartialEq, Eq, Debug, Parser)] -#[command(version, about)] -#[command(propagate_version = true)] -pub struct ScenarioCliArgs { - /// Provide the target API you want the real data to come from - #[arg(long = "api")] - #[clap(global = true)] - pub api: Option, - - #[command(subcommand)] - pub command: Option, -} - -#[derive(Clone, PartialEq, Eq, Debug, Subcommand)] -pub enum ScenarioCliAction { - #[command( - about = "Generates a scenario test initialized with real data fetched from the blockchain." - )] - Account(AccountArgs), -} - -#[derive(Default, Clone, PartialEq, Eq, Debug, Args)] -pub struct AccountArgs { - /// Provide the address you want to retrieve data from - #[arg(long = "address", verbatim_doc_comment)] - pub address: String, -} - -/// Entry point in the program when calling it as a standalone tool. -pub async fn cli_main() { - let cli_args = ScenarioCliArgs::parse(); - let api = CommunicationProxy::new(cli_args.api.expect("API needs tp be specified")); - match &cli_args.command { - Some(ScenarioCliAction::Account(args)) => { - account_tool::print_account_as_scenario_set_state( - &api, - &Bech32Address::from_bech32_string(args.address.to_string()), - ) - .await; - }, - None => {}, - } -} From a1bc377e3c9da4222fc6b78a8c11cb8d900bef17 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Wed, 29 May 2024 17:23:13 +0300 Subject: [PATCH 2/6] account tool - username fix --- framework/scenario/src/standalone/account_tool.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/scenario/src/standalone/account_tool.rs b/framework/scenario/src/standalone/account_tool.rs index a729edd6a1..845998effe 100644 --- a/framework/scenario/src/standalone/account_tool.rs +++ b/framework/scenario/src/standalone/account_tool.rs @@ -71,7 +71,7 @@ fn set_account( .nonce(account.nonce) .balance(account.balance.as_str()) .code(account.code); - account_state.username = Some(account.username.as_str().into()); + account_state.username = Some(format!("str:{}", account.username.as_str()).into()); account_state.storage = convert_storage(account_storage); for (_, esdt_balance) in account_esdt.iter() { From f83bbc09061cf52147fbb2069c14cfdf7adc0f3c Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Wed, 29 May 2024 17:37:15 +0300 Subject: [PATCH 3/6] account tool moved to multiversx-sc-snippets --- Cargo.lock | 2 ++ framework/meta/Cargo.toml | 4 ++++ framework/meta/src/cmd/retrieve_address.rs | 3 ++- framework/scenario/src/imports.rs | 1 - framework/scenario/src/lib.rs | 1 - framework/scenario/src/standalone/mod.rs | 3 --- framework/snippets/Cargo.toml | 4 ++++ .../src/standalone => snippets/src}/account_tool.rs | 9 ++++----- framework/snippets/src/interactor.rs | 4 ++-- framework/snippets/src/lib.rs | 1 + 10 files changed, 19 insertions(+), 13 deletions(-) delete mode 100644 framework/scenario/src/standalone/mod.rs rename framework/{scenario/src/standalone => snippets/src}/account_tool.rs (97%) diff --git a/Cargo.lock b/Cargo.lock index c6c4694bce..601696bd3b 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -1978,6 +1978,7 @@ dependencies = [ "multiversx-sc", "multiversx-sc-meta-lib", "multiversx-sc-scenario", + "multiversx-sc-snippets", "multiversx-sdk", "pathdiff", "reqwest", @@ -2052,6 +2053,7 @@ dependencies = [ "futures", "hex", "log", + "multiversx-chain-scenario-format", "multiversx-sc-scenario", "multiversx-sdk", "tokio", diff --git a/framework/meta/Cargo.toml b/framework/meta/Cargo.toml index 01eeea95fe..4afd663857 100644 --- a/framework/meta/Cargo.toml +++ b/framework/meta/Cargo.toml @@ -49,6 +49,10 @@ version = "=0.50.3" path = "../base" features = ["alloc", "num-bigint"] +[dependencies.multiversx-sc-snippets] +version = "=0.50.3" +path = "../snippets" + [dependencies.multiversx-sc-scenario] version = "=0.50.3" path = "../scenario" diff --git a/framework/meta/src/cmd/retrieve_address.rs b/framework/meta/src/cmd/retrieve_address.rs index bee3dd90b7..62e07297cf 100644 --- a/framework/meta/src/cmd/retrieve_address.rs +++ b/framework/meta/src/cmd/retrieve_address.rs @@ -1,4 +1,5 @@ -use multiversx_sc_scenario::{imports::Bech32Address, standalone::account_tool}; +use multiversx_sc_scenario::imports::Bech32Address; +use multiversx_sc_snippets::account_tool; use multiversx_sdk::blockchain::CommunicationProxy; use crate::cli::AccountArgs; diff --git a/framework/scenario/src/imports.rs b/framework/scenario/src/imports.rs index 9eac89fc70..0b8aa71266 100644 --- a/framework/scenario/src/imports.rs +++ b/framework/scenario/src/imports.rs @@ -20,7 +20,6 @@ pub use crate::{ ScenarioRunner, }, scenario_format::interpret_trait::{InterpretableFrom, InterpreterContext}, - standalone::retrieve_account_as_scenario_set_state, test_wallets, whitebox_legacy::*, ScenarioTxRun, diff --git a/framework/scenario/src/lib.rs b/framework/scenario/src/lib.rs index e79d159f1e..418c8e330c 100644 --- a/framework/scenario/src/lib.rs +++ b/framework/scenario/src/lib.rs @@ -8,7 +8,6 @@ mod facade; pub mod managed_test_util; pub mod scenario; pub mod scenario_macros; -pub mod standalone; pub mod test_wallets; mod vm_go_tool; diff --git a/framework/scenario/src/standalone/mod.rs b/framework/scenario/src/standalone/mod.rs deleted file mode 100644 index d7b8f4e539..0000000000 --- a/framework/scenario/src/standalone/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod account_tool; - -pub use account_tool::retrieve_account_as_scenario_set_state; diff --git a/framework/snippets/Cargo.toml b/framework/snippets/Cargo.toml index 49961c84de..495e98425e 100644 --- a/framework/snippets/Cargo.toml +++ b/framework/snippets/Cargo.toml @@ -25,6 +25,10 @@ futures = "0.3" version = "=0.50.3" path = "../scenario" +[dependencies.multiversx-chain-scenario-format] +version = "0.22.2" +path = "../../sdk/scenario-format" + [dependencies.multiversx-sdk] version = "=0.4.1" path = "../../sdk/core" diff --git a/framework/scenario/src/standalone/account_tool.rs b/framework/snippets/src/account_tool.rs similarity index 97% rename from framework/scenario/src/standalone/account_tool.rs rename to framework/snippets/src/account_tool.rs index 845998effe..b7e52ef7bb 100644 --- a/framework/scenario/src/standalone/account_tool.rs +++ b/framework/snippets/src/account_tool.rs @@ -1,9 +1,8 @@ -use crate::{ +use multiversx_chain_scenario_format::interpret_trait::IntoRaw; +use multiversx_sc_scenario::{ imports::Bech32Address, - scenario_model::{Account, BytesKey, BytesValue, Scenario, SetStateStep}, + scenario_model::{Account, BytesKey, BytesValue, Scenario, SetStateStep, Step}, }; - -use multiversx_chain_scenario_format::interpret_trait::IntoRaw; use multiversx_sdk::{ blockchain::CommunicationProxy, data::{address::Address, esdt::EsdtBalance}, @@ -24,7 +23,7 @@ fn build_scenario(set_state: SetStateStep) -> Scenario { name: None, comment: None, check_gas: None, - steps: vec![crate::scenario_model::Step::SetState(set_state)], + steps: vec![Step::SetState(set_state)], } } diff --git a/framework/snippets/src/interactor.rs b/framework/snippets/src/interactor.rs index 35d53a4a86..82c59752f6 100644 --- a/framework/snippets/src/interactor.rs +++ b/framework/snippets/src/interactor.rs @@ -1,5 +1,5 @@ use multiversx_sc_scenario::{ - imports::{retrieve_account_as_scenario_set_state, Bech32Address, ScenarioRunner}, + imports::{Bech32Address, ScenarioRunner}, mandos_system::{run_list::ScenarioRunnerList, run_trace::ScenarioTraceFile}, multiversx_sc::types::Address, scenario_model::AddressValue, @@ -15,7 +15,7 @@ use std::{ time::Duration, }; -use crate::Sender; +use crate::{account_tool::retrieve_account_as_scenario_set_state, Sender}; pub const INTERACTOR_SCENARIO_TRACE_PATH: &str = "interactor_trace.scen.json"; diff --git a/framework/snippets/src/lib.rs b/framework/snippets/src/lib.rs index b94a6517d9..d54bf2846f 100644 --- a/framework/snippets/src/lib.rs +++ b/framework/snippets/src/lib.rs @@ -1,3 +1,4 @@ +pub mod account_tool; mod interactor; mod interactor_dns; mod interactor_retrieve; From 2335ac5809131c5260571f71f69eefad76df2ac2 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Wed, 29 May 2024 17:45:22 +0300 Subject: [PATCH 4/6] cleanup, removed meta deps to scenario and sdk --- Cargo.lock | 2 -- framework/meta/Cargo.toml | 9 --------- framework/meta/src/cmd/retrieve_address.rs | 10 ++-------- framework/snippets/src/account_tool.rs | 12 +++++++++--- 4 files changed, 11 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 601696bd3b..a7bc64efd5 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -1977,9 +1977,7 @@ dependencies = [ "copy_dir", "multiversx-sc", "multiversx-sc-meta-lib", - "multiversx-sc-scenario", "multiversx-sc-snippets", - "multiversx-sdk", "pathdiff", "reqwest", "ruplacer", diff --git a/framework/meta/Cargo.toml b/framework/meta/Cargo.toml index 4afd663857..029bbfdb6e 100644 --- a/framework/meta/Cargo.toml +++ b/framework/meta/Cargo.toml @@ -52,12 +52,3 @@ features = ["alloc", "num-bigint"] [dependencies.multiversx-sc-snippets] version = "=0.50.3" path = "../snippets" - -[dependencies.multiversx-sc-scenario] -version = "=0.50.3" -path = "../scenario" - -[dependencies.multiversx-sdk] -version = "=0.4.1" -path = "../../sdk/core" - diff --git a/framework/meta/src/cmd/retrieve_address.rs b/framework/meta/src/cmd/retrieve_address.rs index 62e07297cf..f20b5b8e05 100644 --- a/framework/meta/src/cmd/retrieve_address.rs +++ b/framework/meta/src/cmd/retrieve_address.rs @@ -1,15 +1,9 @@ -use multiversx_sc_scenario::imports::Bech32Address; use multiversx_sc_snippets::account_tool; -use multiversx_sdk::blockchain::CommunicationProxy; use crate::cli::AccountArgs; +/// Interprets arguments and call the account tool from `multiversx_sc_snippets`. pub async fn retrieve_address(args: &AccountArgs) { let api_string = args.api.clone().expect("API needs to be specified"); - let api = CommunicationProxy::new(api_string); - account_tool::print_account_as_scenario_set_state( - &api, - &Bech32Address::from_bech32_string(args.address.to_string()), - ) - .await; + account_tool::print_account_as_scenario_set_state(api_string, args.address.to_string()).await; } diff --git a/framework/snippets/src/account_tool.rs b/framework/snippets/src/account_tool.rs index b7e52ef7bb..db1f14b4af 100644 --- a/framework/snippets/src/account_tool.rs +++ b/framework/snippets/src/account_tool.rs @@ -9,11 +9,17 @@ use multiversx_sdk::{ }; use std::collections::{BTreeMap, HashMap}; +/// Called directly from CLI, from `sc-meta`. +/// +/// Retrieves an account data via the API, +/// then formats it as a scenario set state step. pub async fn print_account_as_scenario_set_state( - api: &CommunicationProxy, - address: &Bech32Address, + api_string: String, + address_bech32_string: String, ) { - let set_state = retrieve_account_as_scenario_set_state(api, address).await; + let api = CommunicationProxy::new(api_string); + let address = Bech32Address::from_bech32_string(address_bech32_string); + let set_state = retrieve_account_as_scenario_set_state(&api, &address).await; let scenario = build_scenario(set_state); println!("{}", scenario.into_raw().to_json_string()); } From 51b404eeba108d4d9df2e074b269375258a09970 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Wed, 29 May 2024 17:50:30 +0300 Subject: [PATCH 5/6] moved test_wallets to snippets --- framework/scenario/src/imports.rs | 1 - framework/scenario/src/lib.rs | 1 - framework/snippets/src/imports.rs | 4 +++- framework/snippets/src/lib.rs | 1 + framework/{scenario => snippets}/src/test_wallets/alice.pem | 0 framework/{scenario => snippets}/src/test_wallets/bob.pem | 0 framework/{scenario => snippets}/src/test_wallets/carol.pem | 0 framework/{scenario => snippets}/src/test_wallets/dan.pem | 0 framework/{scenario => snippets}/src/test_wallets/eve.pem | 0 framework/{scenario => snippets}/src/test_wallets/frank.pem | 0 framework/{scenario => snippets}/src/test_wallets/grace.pem | 0 framework/{scenario => snippets}/src/test_wallets/heidi.pem | 0 framework/{scenario => snippets}/src/test_wallets/ivan.pem | 0 framework/{scenario => snippets}/src/test_wallets/judy.pem | 0 framework/{scenario => snippets}/src/test_wallets/mallory.pem | 0 framework/{scenario => snippets}/src/test_wallets/mike.pem | 0 framework/{scenario => snippets}/src/test_wallets/mod.rs | 0 17 files changed, 4 insertions(+), 3 deletions(-) rename framework/{scenario => snippets}/src/test_wallets/alice.pem (100%) rename framework/{scenario => snippets}/src/test_wallets/bob.pem (100%) rename framework/{scenario => snippets}/src/test_wallets/carol.pem (100%) rename framework/{scenario => snippets}/src/test_wallets/dan.pem (100%) rename framework/{scenario => snippets}/src/test_wallets/eve.pem (100%) rename framework/{scenario => snippets}/src/test_wallets/frank.pem (100%) rename framework/{scenario => snippets}/src/test_wallets/grace.pem (100%) rename framework/{scenario => snippets}/src/test_wallets/heidi.pem (100%) rename framework/{scenario => snippets}/src/test_wallets/ivan.pem (100%) rename framework/{scenario => snippets}/src/test_wallets/judy.pem (100%) rename framework/{scenario => snippets}/src/test_wallets/mallory.pem (100%) rename framework/{scenario => snippets}/src/test_wallets/mike.pem (100%) rename framework/{scenario => snippets}/src/test_wallets/mod.rs (100%) diff --git a/framework/scenario/src/imports.rs b/framework/scenario/src/imports.rs index 0b8aa71266..0da1a2d072 100644 --- a/framework/scenario/src/imports.rs +++ b/framework/scenario/src/imports.rs @@ -20,7 +20,6 @@ pub use crate::{ ScenarioRunner, }, scenario_format::interpret_trait::{InterpretableFrom, InterpreterContext}, - test_wallets, whitebox_legacy::*, ScenarioTxRun, }; diff --git a/framework/scenario/src/lib.rs b/framework/scenario/src/lib.rs index 418c8e330c..cfac7eaa50 100644 --- a/framework/scenario/src/lib.rs +++ b/framework/scenario/src/lib.rs @@ -8,7 +8,6 @@ mod facade; pub mod managed_test_util; pub mod scenario; pub mod scenario_macros; -pub mod test_wallets; mod vm_go_tool; pub mod whitebox_legacy; diff --git a/framework/snippets/src/imports.rs b/framework/snippets/src/imports.rs index b031e0769c..f2b0e6a5f9 100644 --- a/framework/snippets/src/imports.rs +++ b/framework/snippets/src/imports.rs @@ -1,6 +1,8 @@ pub use crate::multiversx_sc_scenario::imports::*; -pub use crate::{dns_address_for_name, Interactor, InteractorPrepareAsync, StepBuffer}; +pub use crate::{ + dns_address_for_name, test_wallets, Interactor, InteractorPrepareAsync, StepBuffer, +}; pub use env_logger; pub use tokio; diff --git a/framework/snippets/src/lib.rs b/framework/snippets/src/lib.rs index d54bf2846f..07c5789d8c 100644 --- a/framework/snippets/src/lib.rs +++ b/framework/snippets/src/lib.rs @@ -6,6 +6,7 @@ mod interactor_scenario; mod interactor_sender; mod interactor_tx; mod multi; +pub mod test_wallets; pub use env_logger; pub use hex; diff --git a/framework/scenario/src/test_wallets/alice.pem b/framework/snippets/src/test_wallets/alice.pem similarity index 100% rename from framework/scenario/src/test_wallets/alice.pem rename to framework/snippets/src/test_wallets/alice.pem diff --git a/framework/scenario/src/test_wallets/bob.pem b/framework/snippets/src/test_wallets/bob.pem similarity index 100% rename from framework/scenario/src/test_wallets/bob.pem rename to framework/snippets/src/test_wallets/bob.pem diff --git a/framework/scenario/src/test_wallets/carol.pem b/framework/snippets/src/test_wallets/carol.pem similarity index 100% rename from framework/scenario/src/test_wallets/carol.pem rename to framework/snippets/src/test_wallets/carol.pem diff --git a/framework/scenario/src/test_wallets/dan.pem b/framework/snippets/src/test_wallets/dan.pem similarity index 100% rename from framework/scenario/src/test_wallets/dan.pem rename to framework/snippets/src/test_wallets/dan.pem diff --git a/framework/scenario/src/test_wallets/eve.pem b/framework/snippets/src/test_wallets/eve.pem similarity index 100% rename from framework/scenario/src/test_wallets/eve.pem rename to framework/snippets/src/test_wallets/eve.pem diff --git a/framework/scenario/src/test_wallets/frank.pem b/framework/snippets/src/test_wallets/frank.pem similarity index 100% rename from framework/scenario/src/test_wallets/frank.pem rename to framework/snippets/src/test_wallets/frank.pem diff --git a/framework/scenario/src/test_wallets/grace.pem b/framework/snippets/src/test_wallets/grace.pem similarity index 100% rename from framework/scenario/src/test_wallets/grace.pem rename to framework/snippets/src/test_wallets/grace.pem diff --git a/framework/scenario/src/test_wallets/heidi.pem b/framework/snippets/src/test_wallets/heidi.pem similarity index 100% rename from framework/scenario/src/test_wallets/heidi.pem rename to framework/snippets/src/test_wallets/heidi.pem diff --git a/framework/scenario/src/test_wallets/ivan.pem b/framework/snippets/src/test_wallets/ivan.pem similarity index 100% rename from framework/scenario/src/test_wallets/ivan.pem rename to framework/snippets/src/test_wallets/ivan.pem diff --git a/framework/scenario/src/test_wallets/judy.pem b/framework/snippets/src/test_wallets/judy.pem similarity index 100% rename from framework/scenario/src/test_wallets/judy.pem rename to framework/snippets/src/test_wallets/judy.pem diff --git a/framework/scenario/src/test_wallets/mallory.pem b/framework/snippets/src/test_wallets/mallory.pem similarity index 100% rename from framework/scenario/src/test_wallets/mallory.pem rename to framework/snippets/src/test_wallets/mallory.pem diff --git a/framework/scenario/src/test_wallets/mike.pem b/framework/snippets/src/test_wallets/mike.pem similarity index 100% rename from framework/scenario/src/test_wallets/mike.pem rename to framework/snippets/src/test_wallets/mike.pem diff --git a/framework/scenario/src/test_wallets/mod.rs b/framework/snippets/src/test_wallets/mod.rs similarity index 100% rename from framework/scenario/src/test_wallets/mod.rs rename to framework/snippets/src/test_wallets/mod.rs From 915df0b847f266a1f677607425d5261f20b8b047 Mon Sep 17 00:00:00 2001 From: Andrei Marinica Date: Wed, 29 May 2024 17:50:44 +0300 Subject: [PATCH 6/6] moved test_wallets mod.rs --- .../{test_wallets/mod.rs => test_wallets.rs} | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) rename framework/snippets/src/{test_wallets/mod.rs => test_wallets.rs} (60%) diff --git a/framework/snippets/src/test_wallets/mod.rs b/framework/snippets/src/test_wallets.rs similarity index 60% rename from framework/snippets/src/test_wallets/mod.rs rename to framework/snippets/src/test_wallets.rs index 437f5c829f..341f93ef29 100644 --- a/framework/snippets/src/test_wallets/mod.rs +++ b/framework/snippets/src/test_wallets.rs @@ -6,60 +6,60 @@ fn test_wallet(pem_file_contents: &str) -> Wallet { /// Test wallet. Do not use on mainnet. pub fn alice() -> Wallet { - test_wallet(include_str!("alice.pem")) + test_wallet(include_str!("test_wallets/alice.pem")) } /// Test wallet. Do not use on mainnet. pub fn bob() -> Wallet { - test_wallet(include_str!("bob.pem")) + test_wallet(include_str!("test_wallets/bob.pem")) } /// Test wallet. Do not use on mainnet. pub fn carol() -> Wallet { - test_wallet(include_str!("carol.pem")) + test_wallet(include_str!("test_wallets/carol.pem")) } /// Test wallet. Do not use on mainnet. pub fn dan() -> Wallet { - test_wallet(include_str!("dan.pem")) + test_wallet(include_str!("test_wallets/dan.pem")) } /// Test wallet. Do not use on mainnet. pub fn eve() -> Wallet { - test_wallet(include_str!("eve.pem")) + test_wallet(include_str!("test_wallets/eve.pem")) } /// Test wallet. Do not use on mainnet. pub fn frank() -> Wallet { - test_wallet(include_str!("frank.pem")) + test_wallet(include_str!("test_wallets/frank.pem")) } /// Test wallet. Do not use on mainnet. pub fn grace() -> Wallet { - test_wallet(include_str!("grace.pem")) + test_wallet(include_str!("test_wallets/grace.pem")) } /// Test wallet. Do not use on mainnet. pub fn heidi() -> Wallet { - test_wallet(include_str!("heidi.pem")) + test_wallet(include_str!("test_wallets/heidi.pem")) } /// Test wallet. Do not use on mainnet. pub fn ivan() -> Wallet { - test_wallet(include_str!("ivan.pem")) + test_wallet(include_str!("test_wallets/ivan.pem")) } /// Test wallet. Do not use on mainnet. pub fn judy() -> Wallet { - test_wallet(include_str!("judy.pem")) + test_wallet(include_str!("test_wallets/judy.pem")) } /// Test wallet. Do not use on mainnet. pub fn mallory() -> Wallet { - test_wallet(include_str!("mallory.pem")) + test_wallet(include_str!("test_wallets/mallory.pem")) } /// Test wallet. Do not use on mainnet. pub fn mike() -> Wallet { - test_wallet(include_str!("mike.pem")) + test_wallet(include_str!("test_wallets/mike.pem")) }