From 30c937e0e2497b53d63c09f8b6e19fd434258767 Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Wed, 28 Sep 2022 18:39:24 +0200 Subject: [PATCH 1/3] Update some issue numbers --- crates/env/Cargo.toml | 2 +- crates/env/src/engine/e2e/client.rs | 2 +- crates/env/src/engine/e2e/mod.rs | 4 ++-- crates/env/src/engine/e2e/xts.rs | 3 +-- crates/ink/codegen/src/generator/ink_e2e_test.rs | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/crates/env/Cargo.toml b/crates/env/Cargo.toml index 68fb266c36d..e0d69f8d270 100644 --- a/crates/env/Cargo.toml +++ b/crates/env/Cargo.toml @@ -67,7 +67,7 @@ sp-core = "6.0.0" sp-keyring = "6.0.0" sp-runtime = "6.0.0" -# TODO(#xxx) `smart-bench_macro` needs to be forked. +# TODO(#1421) `smart-bench_macro` needs to be forked. smart-bench-macro = { git = "https://github.com/paritytech/smart-bench", branch = "cmichi-ink-e2e-test-mvp", package = "smart-bench-macro"} [features] diff --git a/crates/env/src/engine/e2e/client.rs b/crates/env/src/engine/e2e/client.rs index 2e50701c4fa..64994589d0a 100644 --- a/crates/env/src/engine/e2e/client.rs +++ b/crates/env/src/engine/e2e/client.rs @@ -509,7 +509,7 @@ where /// Returns true if the `substrate-contracts-node` log under /// `/tmp/contracts-node.log` contains `msg`. - /// TODO(#xxx) Matches on any log entry currently, even if done + /// TODO(#1423) Matches on any log entry currently, even if done /// by a different test. pub fn node_log_contains(&self, msg: &str) -> bool { let output = std::process::Command::new("grep") diff --git a/crates/env/src/engine/e2e/mod.rs b/crates/env/src/engine/e2e/mod.rs index 4f862cb8756..214ddc61ef1 100644 --- a/crates/env/src/engine/e2e/mod.rs +++ b/crates/env/src/engine/e2e/mod.rs @@ -23,7 +23,7 @@ pub use client::{ Error, }; pub use default_accounts::*; -// TODO(#xxx) `smart-bench_macro` needs to be forked. +// TODO(#1421) `smart-bench_macro` needs to be forked. use pallet_contracts_primitives::{ ContractExecResult, ContractInstantiateResult, @@ -80,7 +80,7 @@ pub type PolkadotConfig = subxt::config::WithExtrinsicParams< pub type Signer = PairSigner; /// Trait for contract constructors. -// TODO(#xxx) Merge this with `InkMessage` to be just `InkSelector`. Requires forking `smart-bench-macro`. +// TODO(#1421) Merge this with `InkMessage` to be just `InkSelector`. Requires forking `smart-bench-macro`. pub trait InkConstructor: scale::Encode { /// An ink! selector consists of four bytes. const SELECTOR: [u8; 4]; diff --git a/crates/env/src/engine/e2e/xts.rs b/crates/env/src/engine/e2e/xts.rs index 17e4b9e288b..d0e98248dfc 100644 --- a/crates/env/src/engine/e2e/xts.rs +++ b/crates/env/src/engine/e2e/xts.rs @@ -47,7 +47,7 @@ use subxt::{ /// The gas limit for contract instantiate and call dry runs. const DRY_RUN_GAS_LIMIT: u64 = 500_000_000_000; -// TODO(#xxx) Should be fetched automatically. +// TODO(#1422) Should be fetched automatically. #[subxt::subxt(runtime_metadata_path = "metadata/contracts-node.scale")] pub(super) mod api {} @@ -317,7 +317,6 @@ where err ); }) - // TODO(#xxx) It should be configurable to use `.wait_for_finalized_success` instead. .wait_for_in_block() .await .unwrap_or_else(|err| { diff --git a/crates/ink/codegen/src/generator/ink_e2e_test.rs b/crates/ink/codegen/src/generator/ink_e2e_test.rs index 897946d0fee..4c49c8b7442 100644 --- a/crates/ink/codegen/src/generator/ink_e2e_test.rs +++ b/crates/ink/codegen/src/generator/ink_e2e_test.rs @@ -161,7 +161,7 @@ impl GenerateCode for InkE2ETest<'_> { }); log_info("extracting metadata"); - // TODO(#xxx) `smart-bench_macro` needs to be forked. + // TODO(#1421) `smart-bench_macro` needs to be forked. ink::env::e2e::smart_bench_macro::contract!(#path); log_info("creating new client"); From 270ede9396837b1292d0053efb6b01f9f2dda589 Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Wed, 28 Sep 2022 18:43:20 +0200 Subject: [PATCH 2/3] Mark E2E deps as optional --- crates/env/Cargo.toml | 46 +++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/crates/env/Cargo.toml b/crates/env/Cargo.toml index e0d69f8d270..290decf5871 100644 --- a/crates/env/Cargo.toml +++ b/crates/env/Cargo.toml @@ -50,25 +50,25 @@ secp256k1 = { version = "0.24", features = ["recovery", "global-context"], optio rand = { version = "0.8", default-features = false, features = ["alloc"], optional = true } scale-info = { version = "2", default-features = false, features = ["derive"], optional = true } -contract-metadata = "2.0.0-alpha.2" -impl-serde = { version = "0.3.1", default-features = false } -jsonrpsee = { version = "0.14.0", features = ["ws-client"] } -pallet-contracts-primitives = "6.0.0" -serde = { version = "1.0.137", default-features = false, features = ["derive"] } -serde_json = "1.0.81" -tokio = { version = "1.18.2", features = ["rt-multi-thread"] } -log = "0.4" -env_logger = "0.8" -subxt = "0.24.0" +contract-metadata = { version = "2.0.0-alpha.2", optional = true } +impl-serde = { version = "0.3.1", default-features = false, optional = true } +jsonrpsee = { version = "0.14.0", features = ["ws-client"], optional = true } +pallet-contracts-primitives = { version = "6.0.0", optional = true } +serde = { version = "1.0.137", default-features = false, features = ["derive"], optional = true } +serde_json = { version = "1.0.81", optional = true } +tokio = { version = "1.18.2", features = ["rt-multi-thread"], optional = true } +log = { version = "0.4", optional = true } +env_logger = { version = "0.8", optional = true } +subxt = { version = "0.24.0", optional = true } # Substrate -sp-rpc = "6.0.0" -sp-core = "6.0.0" -sp-keyring = "6.0.0" -sp-runtime = "6.0.0" +sp-rpc = { version = "6.0.0", optional = true } +sp-core = { version = "6.0.0", optional = true } +sp-keyring = { version = "6.0.0", optional = true } +sp-runtime = { version = "6.0.0", optional = true } # TODO(#1421) `smart-bench_macro` needs to be forked. -smart-bench-macro = { git = "https://github.com/paritytech/smart-bench", branch = "cmichi-ink-e2e-test-mvp", package = "smart-bench-macro"} +smart-bench-macro = { git = "https://github.com/paritytech/smart-bench", branch = "cmichi-ink-e2e-test-mvp", package = "smart-bench-macro", optional = true} [features] default = ["std"] @@ -89,6 +89,22 @@ std = [ "sha2", "sha3", "blake2", + # E2E testing environment + "contract-metadata", + "impl-serde", + "jsonrpsee", + "pallet-contracts-primitives", + "serde", + "serde_json", + "tokio", + "log", + "env_logger", + "subxt", + "sp-rpc", + "sp-core", + "sp-keyring", + "sp-runtime", + "smart-bench-macro", ] # Enable contract debug messages via `debug_print!` and `debug_println!`. ink-debug = [] From f1082fa8d7800c745d8209dfa817c8abe15a1f70 Mon Sep 17 00:00:00 2001 From: Michael Mueller Date: Wed, 28 Sep 2022 18:52:33 +0200 Subject: [PATCH 3/3] Apply `cargo fmt` --- crates/env/src/engine/e2e/xts.rs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/crates/env/src/engine/e2e/xts.rs b/crates/env/src/engine/e2e/xts.rs index d0e98248dfc..e6d634c23ff 100644 --- a/crates/env/src/engine/e2e/xts.rs +++ b/crates/env/src/engine/e2e/xts.rs @@ -302,13 +302,15 @@ where ) .unvalidated(); - self - .client + self.client .tx() .sign_and_submit_then_watch_default(&call, signer) .await .map(|tx_progress| { - log_info(&format!("signed and submitted call with extrinsic hash {:?}", tx_progress.extrinsic_hash())); + log_info(&format!( + "signed and submitted call with extrinsic hash {:?}", + tx_progress.extrinsic_hash() + )); tx_progress }) .unwrap_or_else(|err| { @@ -320,18 +322,12 @@ where .wait_for_in_block() .await .unwrap_or_else(|err| { - panic!( - "error on call `wait_for_in_block`: {:?}", - err - ); + panic!("error on call `wait_for_in_block`: {:?}", err); }) .fetch_events() .await .unwrap_or_else(|err| { - panic!( - "error on call `fetch_events`: {:?}", - err - ); + panic!("error on call `fetch_events`: {:?}", err); }) } }