From 163fe59a1a8fecfdec39492aefa8a180d68e14ae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marin=20Ver=C5=A1i=C4=87?= <marin.versic101@gmail.com>
Date: Wed, 6 Nov 2024 12:53:33 +0100
Subject: [PATCH] test: move integration tests from iroha client to root crate
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Marin Veršić <marin.versic101@gmail.com>
---
 .gitignore                                    |   1 -
 Cargo.lock                                    | 252 +++---------------
 Cargo.toml                                    |  57 +++-
 crates/iroha/Cargo.toml                       |  12 -
 crates/iroha/tests/status_response.rs         |  54 ----
 crates/iroha_test_network/src/lib.rs          |   2 +-
 scripts/build_wasm.sh                         |   2 +-
 scripts/tests/consistency.sh                  |  14 +-
 {crates/iroha/tests => tests}/asset.rs        |   0
 .../tests => tests}/asset_propagation.rs      |   0
 {crates/iroha/tests => tests}/events/data.rs  |   5 +-
 {crates/iroha/tests => tests}/events/mod.rs   |   0
 .../tests => tests}/events/notification.rs    |   0
 .../iroha/tests => tests}/events/pipeline.rs  |   0
 .../extra_functional/connected_peers.rs       |  10 +-
 .../extra_functional/genesis.rs               |   0
 .../tests => tests}/extra_functional/mod.rs   |   0
 .../multiple_blocks_created.rs                |   0
 .../extra_functional/normal.rs                |   0
 .../extra_functional/offline_peers.rs         |   0
 .../extra_functional/restart_peer.rs          |   0
 .../extra_functional/unregister_peer.rs       |   0
 {crates/iroha/tests => tests}/mod.rs          |   0
 {crates/iroha/tests => tests}/multisig.rs     |  18 +-
 {crates/iroha/tests => tests}/non_mintable.rs |   0
 {crates/iroha/tests => tests}/pagination.rs   |   0
 {crates/iroha/tests => tests}/permissions.rs  |   0
 .../iroha/tests => tests}/queries/account.rs  |   0
 .../iroha/tests => tests}/queries/asset.rs    |   0
 {crates/iroha/tests => tests}/queries/mod.rs  |   0
 .../tests => tests}/queries/query_errors.rs   |   0
 {crates/iroha/tests => tests}/queries/role.rs |   0
 .../tests => tests}/queries/smart_contract.rs |   0
 {crates/iroha/tests => tests}/roles.rs        |   0
 .../iroha/tests => tests}/set_parameter.rs    |   0
 {crates/iroha/tests => tests}/sorting.rs      |   0
 .../iroha/tests => tests}/transfer_asset.rs   |   0
 .../iroha/tests => tests}/transfer_domain.rs  |   0
 .../triggers/by_call_trigger.rs               |   0
 .../tests => tests}/triggers/data_trigger.rs  |   0
 .../tests => tests}/triggers/event_trigger.rs |   0
 {crates/iroha/tests => tests}/triggers/mod.rs |   0
 .../iroha/tests => tests}/triggers/orphans.rs |   0
 .../tests => tests}/triggers/time_trigger.rs  |   0
 .../triggers/trigger_rollback.rs              |   0
 {crates/iroha/tests => tests}/tx_chain_id.rs  |   0
 {crates/iroha/tests => tests}/tx_history.rs   |   0
 {crates/iroha/tests => tests}/tx_rollback.rs  |   0
 {crates/iroha/tests => tests}/upgrade.rs      |   0
 49 files changed, 99 insertions(+), 328 deletions(-)
 delete mode 100644 crates/iroha/tests/status_response.rs
 rename {crates/iroha/tests => tests}/asset.rs (100%)
 rename {crates/iroha/tests => tests}/asset_propagation.rs (100%)
 rename {crates/iroha/tests => tests}/events/data.rs (98%)
 rename {crates/iroha/tests => tests}/events/mod.rs (100%)
 rename {crates/iroha/tests => tests}/events/notification.rs (100%)
 rename {crates/iroha/tests => tests}/events/pipeline.rs (100%)
 rename {crates/iroha/tests => tests}/extra_functional/connected_peers.rs (93%)
 rename {crates/iroha/tests => tests}/extra_functional/genesis.rs (100%)
 rename {crates/iroha/tests => tests}/extra_functional/mod.rs (100%)
 rename {crates/iroha/tests => tests}/extra_functional/multiple_blocks_created.rs (100%)
 rename {crates/iroha/tests => tests}/extra_functional/normal.rs (100%)
 rename {crates/iroha/tests => tests}/extra_functional/offline_peers.rs (100%)
 rename {crates/iroha/tests => tests}/extra_functional/restart_peer.rs (100%)
 rename {crates/iroha/tests => tests}/extra_functional/unregister_peer.rs (100%)
 rename {crates/iroha/tests => tests}/mod.rs (100%)
 rename {crates/iroha/tests => tests}/multisig.rs (97%)
 rename {crates/iroha/tests => tests}/non_mintable.rs (100%)
 rename {crates/iroha/tests => tests}/pagination.rs (100%)
 rename {crates/iroha/tests => tests}/permissions.rs (100%)
 rename {crates/iroha/tests => tests}/queries/account.rs (100%)
 rename {crates/iroha/tests => tests}/queries/asset.rs (100%)
 rename {crates/iroha/tests => tests}/queries/mod.rs (100%)
 rename {crates/iroha/tests => tests}/queries/query_errors.rs (100%)
 rename {crates/iroha/tests => tests}/queries/role.rs (100%)
 rename {crates/iroha/tests => tests}/queries/smart_contract.rs (100%)
 rename {crates/iroha/tests => tests}/roles.rs (100%)
 rename {crates/iroha/tests => tests}/set_parameter.rs (100%)
 rename {crates/iroha/tests => tests}/sorting.rs (100%)
 rename {crates/iroha/tests => tests}/transfer_asset.rs (100%)
 rename {crates/iroha/tests => tests}/transfer_domain.rs (100%)
 rename {crates/iroha/tests => tests}/triggers/by_call_trigger.rs (100%)
 rename {crates/iroha/tests => tests}/triggers/data_trigger.rs (100%)
 rename {crates/iroha/tests => tests}/triggers/event_trigger.rs (100%)
 rename {crates/iroha/tests => tests}/triggers/mod.rs (100%)
 rename {crates/iroha/tests => tests}/triggers/orphans.rs (100%)
 rename {crates/iroha/tests => tests}/triggers/time_trigger.rs (100%)
 rename {crates/iroha/tests => tests}/triggers/trigger_rollback.rs (100%)
 rename {crates/iroha/tests => tests}/tx_chain_id.rs (100%)
 rename {crates/iroha/tests => tests}/tx_history.rs (100%)
 rename {crates/iroha/tests => tests}/tx_rollback.rs (100%)
 rename {crates/iroha/tests => tests}/upgrade.rs (100%)

diff --git a/.gitignore b/.gitignore
index 70d5f05109b..f908d42e3b6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -46,7 +46,6 @@ result
 *.deb
 \#*
 /cargo-timing*.html
-/test/
 /iroha-java/
 /lcov.info
 test_docker
diff --git a/Cargo.lock b/Cargo.lock
index f273833c325..e1a4b18036e 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -350,12 +350,6 @@ dependencies = [
  "syn 2.0.79",
 ]
 
-[[package]]
-name = "atomic-waker"
-version = "1.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
-
 [[package]]
 name = "attohttpc"
 version = "0.28.0"
@@ -365,7 +359,7 @@ dependencies = [
  "http 1.1.0",
  "log",
  "native-tls",
- "rustls 0.22.4",
+ "rustls",
  "rustls-native-certs",
  "url",
  "webpki-roots",
@@ -2447,25 +2441,6 @@ dependencies = [
  "tracing",
 ]
 
-[[package]]
-name = "h2"
-version = "0.4.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205"
-dependencies = [
- "atomic-waker",
- "bytes",
- "fnv",
- "futures-core",
- "futures-sink",
- "http 1.1.0",
- "indexmap 2.6.0",
- "slab",
- "tokio",
- "tokio-util",
- "tracing",
-]
-
 [[package]]
 name = "half"
 version = "2.4.1"
@@ -2671,7 +2646,7 @@ dependencies = [
  "futures-channel",
  "futures-core",
  "futures-util",
- "h2 0.3.26",
+ "h2",
  "http 0.2.12",
  "http-body 0.4.6",
  "httparse",
@@ -2694,7 +2669,6 @@ dependencies = [
  "bytes",
  "futures-channel",
  "futures-util",
- "h2 0.4.6",
  "http 1.1.0",
  "http-body 1.0.1",
  "httparse",
@@ -2703,24 +2677,6 @@ dependencies = [
  "pin-project-lite",
  "smallvec",
  "tokio",
- "want",
-]
-
-[[package]]
-name = "hyper-rustls"
-version = "0.27.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333"
-dependencies = [
- "futures-util",
- "http 1.1.0",
- "hyper 1.4.1",
- "hyper-util",
- "rustls 0.23.13",
- "rustls-pki-types",
- "tokio",
- "tokio-rustls 0.26.0",
- "tower-service",
 ]
 
 [[package]]
@@ -2735,22 +2691,6 @@ dependencies = [
  "tokio-io-timeout",
 ]
 
-[[package]]
-name = "hyper-tls"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
-dependencies = [
- "bytes",
- "http-body-util",
- "hyper 1.4.1",
- "hyper-util",
- "native-tls",
- "tokio",
- "tokio-native-tls",
- "tower-service",
-]
-
 [[package]]
 name = "hyper-util"
 version = "0.1.9"
@@ -2758,16 +2698,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b"
 dependencies = [
  "bytes",
- "futures-channel",
  "futures-util",
  "http 1.1.0",
  "http-body 1.0.1",
  "hyper 1.4.1",
  "pin-project-lite",
- "socket2",
  "tokio",
  "tower-service",
- "tracing",
 ]
 
 [[package]]
@@ -2894,48 +2831,33 @@ dependencies = [
  "cfg-if",
 ]
 
-[[package]]
-name = "ipnet"
-version = "2.10.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708"
-
 [[package]]
 name = "iroha"
 version = "2.0.0-rc.1.0"
 dependencies = [
- "assert_matches",
  "assertables",
  "attohttpc",
  "base64 0.22.1",
- "color-eyre",
  "derive_more",
  "displaydoc",
  "error-stack",
- "executor_custom_data_model",
  "eyre",
  "futures-util",
- "hex",
  "http 1.1.0",
  "iroha_config",
  "iroha_config_base",
  "iroha_crypto",
  "iroha_data_model",
- "iroha_executor_data_model",
- "iroha_genesis",
  "iroha_logger",
  "iroha_multisig_data_model",
  "iroha_primitives",
  "iroha_telemetry",
- "iroha_test_network",
  "iroha_test_samples",
  "iroha_torii_const",
  "iroha_version",
- "mint_rose_trigger_data_model",
  "nonzero_ext",
  "parity-scale-codec",
  "rand",
- "reqwest",
  "serde",
  "serde_json",
  "serde_with",
@@ -2944,7 +2866,6 @@ dependencies = [
  "tokio",
  "tokio-tungstenite 0.21.0",
  "toml",
- "trybuild",
  "tungstenite 0.21.0",
  "url",
 ]
@@ -3628,6 +3549,32 @@ dependencies = [
  "serde",
 ]
 
+[[package]]
+name = "iroha_tests"
+version = "2.0.0-rc.1.0"
+dependencies = [
+ "assert_matches",
+ "assertables",
+ "color-eyre",
+ "executor_custom_data_model",
+ "eyre",
+ "futures-util",
+ "hex",
+ "iroha",
+ "iroha_executor_data_model",
+ "iroha_multisig_data_model",
+ "iroha_primitives",
+ "iroha_test_network",
+ "iroha_test_samples",
+ "mint_rose_trigger_data_model",
+ "nonzero_ext",
+ "rand",
+ "serde_json",
+ "tempfile",
+ "tokio",
+ "trybuild",
+]
+
 [[package]]
 name = "iroha_torii"
 version = "2.0.0-rc.1.0"
@@ -5045,49 +4992,6 @@ version = "0.8.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
 
-[[package]]
-name = "reqwest"
-version = "0.12.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b"
-dependencies = [
- "base64 0.22.1",
- "bytes",
- "encoding_rs",
- "futures-core",
- "futures-util",
- "h2 0.4.6",
- "http 1.1.0",
- "http-body 1.0.1",
- "http-body-util",
- "hyper 1.4.1",
- "hyper-rustls",
- "hyper-tls",
- "hyper-util",
- "ipnet",
- "js-sys",
- "log",
- "mime",
- "native-tls",
- "once_cell",
- "percent-encoding",
- "pin-project-lite",
- "rustls-pemfile",
- "serde",
- "serde_json",
- "serde_urlencoded",
- "sync_wrapper 1.0.1",
- "system-configuration",
- "tokio",
- "tokio-native-tls",
- "tower-service",
- "url",
- "wasm-bindgen",
- "wasm-bindgen-futures",
- "web-sys",
- "windows-registry",
-]
-
 [[package]]
 name = "rfc6979"
 version = "0.4.0"
@@ -5178,19 +5082,6 @@ dependencies = [
  "zeroize",
 ]
 
-[[package]]
-name = "rustls"
-version = "0.23.13"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8"
-dependencies = [
- "once_cell",
- "rustls-pki-types",
- "rustls-webpki",
- "subtle",
- "zeroize",
-]
-
 [[package]]
 name = "rustls-native-certs"
 version = "0.7.3"
@@ -5829,30 +5720,6 @@ name = "sync_wrapper"
 version = "1.0.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394"
-dependencies = [
- "futures-core",
-]
-
-[[package]]
-name = "system-configuration"
-version = "0.6.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b"
-dependencies = [
- "bitflags 2.6.0",
- "core-foundation",
- "system-configuration-sys",
-]
-
-[[package]]
-name = "system-configuration-sys"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4"
-dependencies = [
- "core-foundation-sys",
- "libc",
-]
 
 [[package]]
 name = "tap"
@@ -6052,18 +5919,7 @@ version = "0.25.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f"
 dependencies = [
- "rustls 0.22.4",
- "rustls-pki-types",
- "tokio",
-]
-
-[[package]]
-name = "tokio-rustls"
-version = "0.26.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4"
-dependencies = [
- "rustls 0.23.13",
+ "rustls",
  "rustls-pki-types",
  "tokio",
 ]
@@ -6089,12 +5945,12 @@ dependencies = [
  "futures-util",
  "log",
  "native-tls",
- "rustls 0.22.4",
+ "rustls",
  "rustls-native-certs",
  "rustls-pki-types",
  "tokio",
  "tokio-native-tls",
- "tokio-rustls 0.25.0",
+ "tokio-rustls",
  "tungstenite 0.21.0",
  "webpki-roots",
 ]
@@ -6171,7 +6027,7 @@ dependencies = [
  "axum 0.6.20",
  "base64 0.21.7",
  "bytes",
- "h2 0.3.26",
+ "h2",
  "http 0.2.12",
  "http-body 0.4.6",
  "hyper 0.14.30",
@@ -6368,7 +6224,7 @@ dependencies = [
  "log",
  "native-tls",
  "rand",
- "rustls 0.22.4",
+ "rustls",
  "rustls-native-certs",
  "rustls-pki-types",
  "sha1",
@@ -6643,18 +6499,6 @@ dependencies = [
  "wasm-bindgen-shared",
 ]
 
-[[package]]
-name = "wasm-bindgen-futures"
-version = "0.4.43"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed"
-dependencies = [
- "cfg-if",
- "js-sys",
- "wasm-bindgen",
- "web-sys",
-]
-
 [[package]]
 name = "wasm-bindgen-macro"
 version = "0.2.93"
@@ -7139,36 +6983,6 @@ dependencies = [
  "windows-targets 0.52.6",
 ]
 
-[[package]]
-name = "windows-registry"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0"
-dependencies = [
- "windows-result",
- "windows-strings",
- "windows-targets 0.52.6",
-]
-
-[[package]]
-name = "windows-result"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e"
-dependencies = [
- "windows-targets 0.52.6",
-]
-
-[[package]]
-name = "windows-strings"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
-dependencies = [
- "windows-result",
- "windows-targets 0.52.6",
-]
-
 [[package]]
 name = "windows-sys"
 version = "0.48.0"
diff --git a/Cargo.toml b/Cargo.toml
index f0e087d5966..5c32d14631a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,3 +1,11 @@
+[workspace]
+resolver = "2"
+members = [
+    "crates/*",
+    "data_model/libs/*",
+    "data_model/samples/*"
+]
+
 [workspace.package]
 edition = "2021"
 version = "2.0.0-rc.1.0"
@@ -195,13 +203,48 @@ clippy.useless_let_if_seq = "warn"
 clippy.redundant_feature_names = "deny"
 clippy.wildcard_dependencies = "deny"
 
-[workspace]
-resolver = "2"
-members = [
-    "crates/*",
-    "data_model/libs/*",
-    "data_model/samples/*"
-]
+[package]
+name = "iroha_tests"
+
+edition.workspace = true
+version.workspace = true
+authors.workspace = true
+
+description.workspace = true
+repository.workspace = true
+homepage.workspace = true
+documentation.workspace = true
+
+license.workspace = true
+keywords.workspace = true
+categories.workspace = true
+
+[lints]
+workspace = true
+
+[dev-dependencies]
+iroha = { workspace = true }
+iroha_primitives = { workspace = true }
+iroha_test_samples = { workspace = true }
+iroha_test_network = { workspace = true }
+
+iroha_executor_data_model = { workspace = true }
+iroha_multisig_data_model = { version = "=2.0.0-rc.1.0", path = "data_model/libs/iroha_multisig_data_model" }
+executor_custom_data_model = { version = "=2.0.0-rc.1.0", path = "data_model/samples/executor_custom_data_model" }
+mint_rose_trigger_data_model = { version = "=2.0.0-rc.1.0", path = "data_model/samples/mint_rose_trigger_data_model" }
+
+tokio = { workspace = true, features = ["rt-multi-thread"] }
+nonzero_ext = { workspace = true }
+color-eyre = { workspace = true }
+tempfile = { workspace = true }
+hex = { workspace = true }
+assertables = { workspace = true }
+serde_json = { workspace = true }
+trybuild = { workspace = true }
+eyre = { workspace = true }
+rand = { workspace = true }
+assert_matches = "1.5.0"
+futures-util = "0.3.30"
 
 [profile.deploy]
 inherits = "release"
diff --git a/crates/iroha/Cargo.toml b/crates/iroha/Cargo.toml
index 6990b70d363..f6609f23177 100644
--- a/crates/iroha/Cargo.toml
+++ b/crates/iroha/Cargo.toml
@@ -82,19 +82,7 @@ toml = { workspace = true }
 nonzero_ext = { workspace = true }
 
 [dev-dependencies]
-iroha_genesis = { workspace = true }
 iroha_test_samples = { workspace = true }
-iroha_test_network = { workspace = true }
 
-mint_rose_trigger_data_model = { path = "../../data_model/samples/mint_rose_trigger_data_model" }
-executor_custom_data_model = { path = "../../data_model/samples/executor_custom_data_model" }
-iroha_executor_data_model = { workspace = true }
-
-tokio = { workspace = true, features = ["rt-multi-thread"] }
-reqwest = { version = "0.12.7", features = ["json"] }
-color-eyre = { workspace = true }
 tempfile = { workspace = true }
-hex = { workspace = true }
 assertables = { workspace = true }
-trybuild = { workspace = true }
-assert_matches = "1.5.0"
diff --git a/crates/iroha/tests/status_response.rs b/crates/iroha/tests/status_response.rs
deleted file mode 100644
index 41e4982cff3..00000000000
--- a/crates/iroha/tests/status_response.rs
+++ /dev/null
@@ -1,54 +0,0 @@
-use eyre::Result;
-use iroha::{client, data_model::prelude::*};
-use iroha_telemetry::metrics::Status;
-use iroha_test_network::*;
-use tokio::task::spawn_blocking;
-
-fn status_eq_excluding_uptime_and_queue(lhs: &Status, rhs: &Status) -> bool {
-    lhs.peers == rhs.peers
-        && lhs.blocks == rhs.blocks
-        && lhs.txs_accepted == rhs.txs_accepted
-        && lhs.txs_rejected == rhs.txs_rejected
-        && lhs.view_changes == rhs.view_changes
-}
-
-async fn check(client: &client::Client, blocks: u64) -> Result<()> {
-    let status_json = reqwest::get(client.torii_url.join("/status").unwrap())
-        .await?
-        .json()
-        .await?;
-
-    let status_scale = {
-        let client = client.clone();
-        spawn_blocking(move || client.get_status()).await??
-    };
-
-    assert!(status_eq_excluding_uptime_and_queue(
-        &status_json,
-        &status_scale
-    ));
-    assert_eq!(status_json.blocks, blocks);
-
-    Ok(())
-}
-
-#[tokio::test]
-async fn json_and_scale_statuses_equality() -> Result<()> {
-    let network = NetworkBuilder::new().start().await?;
-    let client = network.client();
-
-    check(&client, 1).await?;
-
-    {
-        let client = client.clone();
-        spawn_blocking(move || {
-            client.submit_blocking(Register::domain(Domain::new("looking_glass".parse()?)))
-        })
-    }
-    .await??;
-    network.ensure_blocks(2).await?;
-
-    check(&client, 2).await?;
-
-    Ok(())
-}
diff --git a/crates/iroha_test_network/src/lib.rs b/crates/iroha_test_network/src/lib.rs
index 187ca60eb0c..4c63b2c7b2c 100644
--- a/crates/iroha_test_network/src/lib.rs
+++ b/crates/iroha_test_network/src/lib.rs
@@ -783,7 +783,7 @@ impl NetworkPeer {
 
     /// Generated [`PeerId`]
     pub fn peer_id(&self) -> PeerId {
-        self.id.id.clone()
+        self.id.id().clone()
     }
 
     /// Check whether the peer is running
diff --git a/scripts/build_wasm.sh b/scripts/build_wasm.sh
index 8e28b719594..8b360e63311 100755
--- a/scripts/build_wasm.sh
+++ b/scripts/build_wasm.sh
@@ -26,7 +26,7 @@ build() {
     mkdir -p "$TARGET_DIR/$1"
     for name in ${NAMES[@]}; do
         out_file="$TARGET_DIR/$1/$name.wasm"
-        cargo run --bin iroha_wasm_builder -- build "$CARGO_DIR/$1/$name" --optimize --out-file "$out_file"
+        cargo run ---package iroha_wasm_builder -bin iroha_wasm_builder -- build "$CARGO_DIR/$1/$name" --optimize --out-file "$out_file"
     done
     echo "info: WASM $1 build complete"
     echo "artifacts written to $TARGET_DIR/$1/"
diff --git a/scripts/tests/consistency.sh b/scripts/tests/consistency.sh
index cbbdabd04a2..05c7f6a3820 100755
--- a/scripts/tests/consistency.sh
+++ b/scripts/tests/consistency.sh
@@ -3,14 +3,14 @@ set -e
 
 case $1 in
     "genesis")
-        cargo run --release --bin kagami -- genesis generate --executor executor.wasm --wasm-dir libs --genesis-public-key ed01204164BF554923ECE1FD412D241036D863A6AE430476C898248B8237D77534CFC4 | diff - defaults/genesis.json || {
-            echo 'Please re-generate the default genesis with `cargo run --release --bin kagami -- genesis --executor executor.wasm --wasm-dir libs --genesis-public-key ed01204164BF554923ECE1FD412D241036D863A6AE430476C898248B8237D77534CFC4 > ./defaults/genesis.json`'
+        cargo --package iroha_kagami run --release --bin kagami -- genesis generate --executor executor.wasm --wasm-dir libs --genesis-public-key ed01204164BF554923ECE1FD412D241036D863A6AE430476C898248B8237D77534CFC4 | diff - defaults/genesis.json || {
+            echo 'Please re-generate the default genesis with `cargo run --package iroha_kagami --bin kagami --release -- genesis --executor executor.wasm --wasm-dir libs --genesis-public-key ed01204164BF554923ECE1FD412D241036D863A6AE430476C898248B8237D77534CFC4 > ./defaults/genesis.json`'
             echo 'The assumption here is that the authority of the default genesis transaction is `iroha_test_samples::SAMPLE_GENESIS_ACCOUNT_ID`'
             exit 1
         };;
     "schema")
-        cargo run --release --bin kagami -- schema | diff - docs/source/references/schema.json || {
-            echo 'Please re-generate schema with `cargo run --release --bin kagami -- schema > docs/source/references/schema.json`'
+        cargo --package iroha_kagami run --bin kagami --release -- schema | diff - docs/source/references/schema.json || {
+            echo 'Please re-generate schema with `cargo --package iroha_kagami run --bin kagami --release -- schema > docs/source/references/schema.json`'
             exit 1
         };;
     "docker-compose")
@@ -25,15 +25,15 @@ case $1 in
         }
 
         command_base_for_single() {
-            echo "cargo run --release --bin iroha_swarm -- -p 1 -s Iroha -H -c ./defaults -i hyperledger/iroha:local -b ."
+            echo "cargo --package iroha_kagami run --bin iroha_swarm --release -- -p 1 -s Iroha -H -c ./defaults -i hyperledger/iroha:local -b ."
         }
 
         command_base_for_multiple_local() {
-            echo "cargo run --release --bin iroha_swarm -- -p 4 -s Iroha -H -c ./defaults -i hyperledger/iroha:local -b ."
+            echo "cargo --package iroha_kagami run --bin iroha_swarm --release -- -p 4 -s Iroha -H -c ./defaults -i hyperledger/iroha:local -b ."
         }
 
         command_base_for_default() {
-            echo "cargo run --release --bin iroha_swarm -- -p 4 -s Iroha -H -c ./defaults -i hyperledger/iroha:dev"
+            echo "cargo --package iroha_kagami run --bin iroha_swarm --release -- -p 4 -s Iroha -H -c ./defaults -i hyperledger/iroha:dev"
         }
 
 
diff --git a/crates/iroha/tests/asset.rs b/tests/asset.rs
similarity index 100%
rename from crates/iroha/tests/asset.rs
rename to tests/asset.rs
diff --git a/crates/iroha/tests/asset_propagation.rs b/tests/asset_propagation.rs
similarity index 100%
rename from crates/iroha/tests/asset_propagation.rs
rename to tests/asset_propagation.rs
diff --git a/crates/iroha/tests/events/data.rs b/tests/events/data.rs
similarity index 98%
rename from crates/iroha/tests/events/data.rs
rename to tests/events/data.rs
index debc2c85d95..e015a06deda 100644
--- a/crates/iroha/tests/events/data.rs
+++ b/tests/events/data.rs
@@ -3,13 +3,12 @@ use std::fmt::Write as _;
 use assert_matches::assert_matches;
 use eyre::Result;
 use futures_util::StreamExt;
-use iroha::data_model::{prelude::*, transaction::WasmSmartContract};
+use iroha::data_model::{isi::BuiltInInstruction, prelude::*, transaction::WasmSmartContract};
 use iroha_executor_data_model::permission::{
     account::CanModifyAccountMetadata, domain::CanModifyDomainMetadata,
 };
 use iroha_test_network::*;
 use iroha_test_samples::{ALICE_ID, BOB_ID};
-use parity_scale_codec::Encode as _;
 use tokio::task::spawn_blocking;
 
 /// Return string containing exported memory, dummy allocator, and
@@ -92,7 +91,7 @@ async fn wasm_execution_should_produce_events() -> Result<()> {
     #![allow(clippy::integer_division)]
     let isi_hex: Vec<String> = produce_instructions()
         .into_iter()
-        .map(|isi| isi.encode())
+        .map(|isi| isi.encode_as_instruction_box())
         .map(hex::encode)
         .collect();
 
diff --git a/crates/iroha/tests/events/mod.rs b/tests/events/mod.rs
similarity index 100%
rename from crates/iroha/tests/events/mod.rs
rename to tests/events/mod.rs
diff --git a/crates/iroha/tests/events/notification.rs b/tests/events/notification.rs
similarity index 100%
rename from crates/iroha/tests/events/notification.rs
rename to tests/events/notification.rs
diff --git a/crates/iroha/tests/events/pipeline.rs b/tests/events/pipeline.rs
similarity index 100%
rename from crates/iroha/tests/events/pipeline.rs
rename to tests/events/pipeline.rs
diff --git a/crates/iroha/tests/extra_functional/connected_peers.rs b/tests/extra_functional/connected_peers.rs
similarity index 93%
rename from crates/iroha/tests/extra_functional/connected_peers.rs
rename to tests/extra_functional/connected_peers.rs
index 915614c3fd4..a6725acfd39 100644
--- a/crates/iroha/tests/extra_functional/connected_peers.rs
+++ b/tests/extra_functional/connected_peers.rs
@@ -4,7 +4,6 @@ use assert_matches::assert_matches;
 use eyre::Result;
 use futures_util::{stream::FuturesUnordered, StreamExt};
 use iroha::data_model::isi::{Register, Unregister};
-use iroha_config_base::toml::WriteExt;
 use iroha_test_network::*;
 use rand::{prelude::IteratorRandom, seq::SliceRandom, thread_rng};
 use tokio::{task::spawn_blocking, time::timeout};
@@ -24,14 +23,7 @@ async fn register_new_peer() -> Result<()> {
     let network = NetworkBuilder::new().with_peers(4).start().await?;
 
     let peer = NetworkPeer::generate();
-    peer.start(
-        network
-            .config()
-            // only one random peer
-            .write(["sumeragi", "trusted_peers"], [network.peer().peer()]),
-        None,
-    )
-    .await;
+    peer.start(network.config(), None).await;
 
     let register = Register::peer(peer.peer_id());
     let client = network.client();
diff --git a/crates/iroha/tests/extra_functional/genesis.rs b/tests/extra_functional/genesis.rs
similarity index 100%
rename from crates/iroha/tests/extra_functional/genesis.rs
rename to tests/extra_functional/genesis.rs
diff --git a/crates/iroha/tests/extra_functional/mod.rs b/tests/extra_functional/mod.rs
similarity index 100%
rename from crates/iroha/tests/extra_functional/mod.rs
rename to tests/extra_functional/mod.rs
diff --git a/crates/iroha/tests/extra_functional/multiple_blocks_created.rs b/tests/extra_functional/multiple_blocks_created.rs
similarity index 100%
rename from crates/iroha/tests/extra_functional/multiple_blocks_created.rs
rename to tests/extra_functional/multiple_blocks_created.rs
diff --git a/crates/iroha/tests/extra_functional/normal.rs b/tests/extra_functional/normal.rs
similarity index 100%
rename from crates/iroha/tests/extra_functional/normal.rs
rename to tests/extra_functional/normal.rs
diff --git a/crates/iroha/tests/extra_functional/offline_peers.rs b/tests/extra_functional/offline_peers.rs
similarity index 100%
rename from crates/iroha/tests/extra_functional/offline_peers.rs
rename to tests/extra_functional/offline_peers.rs
diff --git a/crates/iroha/tests/extra_functional/restart_peer.rs b/tests/extra_functional/restart_peer.rs
similarity index 100%
rename from crates/iroha/tests/extra_functional/restart_peer.rs
rename to tests/extra_functional/restart_peer.rs
diff --git a/crates/iroha/tests/extra_functional/unregister_peer.rs b/tests/extra_functional/unregister_peer.rs
similarity index 100%
rename from crates/iroha/tests/extra_functional/unregister_peer.rs
rename to tests/extra_functional/unregister_peer.rs
diff --git a/crates/iroha/tests/mod.rs b/tests/mod.rs
similarity index 100%
rename from crates/iroha/tests/mod.rs
rename to tests/mod.rs
diff --git a/crates/iroha/tests/multisig.rs b/tests/multisig.rs
similarity index 97%
rename from crates/iroha/tests/multisig.rs
rename to tests/multisig.rs
index 84c6c453f9a..a3f615294f2 100644
--- a/crates/iroha/tests/multisig.rs
+++ b/tests/multisig.rs
@@ -7,9 +7,11 @@ use eyre::Result;
 use iroha::{
     client::Client,
     crypto::KeyPair,
-    data_model::{prelude::*, query::trigger::FindTriggers, Level},
+    data_model::{
+        events::execute_trigger::ExecuteTriggerEventFilter, prelude::*,
+        query::trigger::FindTriggers, Level,
+    },
 };
-use iroha_data_model::events::execute_trigger::ExecuteTriggerEventFilter;
 use iroha_multisig_data_model::{MultisigAccountArgs, MultisigTransactionArgs};
 use iroha_test_network::*;
 use iroha_test_samples::{
@@ -476,15 +478,3 @@ fn multisig_transactions_registry_of(multisig_account: &AccountId) -> TriggerId
     .parse()
     .unwrap()
 }
-
-#[allow(dead_code)]
-fn debug_mst_registry(msa: &AccountId, client: &Client) {
-    let mst_registry = client
-        .query(FindTriggers::new())
-        .filter_with(|trigger| trigger.id.eq(multisig_transactions_registry_of(msa)))
-        .execute_single()
-        .unwrap();
-    let mst_metadata = mst_registry.action().metadata();
-
-    iroha_logger::error!(%msa, ?mst_metadata);
-}
diff --git a/crates/iroha/tests/non_mintable.rs b/tests/non_mintable.rs
similarity index 100%
rename from crates/iroha/tests/non_mintable.rs
rename to tests/non_mintable.rs
diff --git a/crates/iroha/tests/pagination.rs b/tests/pagination.rs
similarity index 100%
rename from crates/iroha/tests/pagination.rs
rename to tests/pagination.rs
diff --git a/crates/iroha/tests/permissions.rs b/tests/permissions.rs
similarity index 100%
rename from crates/iroha/tests/permissions.rs
rename to tests/permissions.rs
diff --git a/crates/iroha/tests/queries/account.rs b/tests/queries/account.rs
similarity index 100%
rename from crates/iroha/tests/queries/account.rs
rename to tests/queries/account.rs
diff --git a/crates/iroha/tests/queries/asset.rs b/tests/queries/asset.rs
similarity index 100%
rename from crates/iroha/tests/queries/asset.rs
rename to tests/queries/asset.rs
diff --git a/crates/iroha/tests/queries/mod.rs b/tests/queries/mod.rs
similarity index 100%
rename from crates/iroha/tests/queries/mod.rs
rename to tests/queries/mod.rs
diff --git a/crates/iroha/tests/queries/query_errors.rs b/tests/queries/query_errors.rs
similarity index 100%
rename from crates/iroha/tests/queries/query_errors.rs
rename to tests/queries/query_errors.rs
diff --git a/crates/iroha/tests/queries/role.rs b/tests/queries/role.rs
similarity index 100%
rename from crates/iroha/tests/queries/role.rs
rename to tests/queries/role.rs
diff --git a/crates/iroha/tests/queries/smart_contract.rs b/tests/queries/smart_contract.rs
similarity index 100%
rename from crates/iroha/tests/queries/smart_contract.rs
rename to tests/queries/smart_contract.rs
diff --git a/crates/iroha/tests/roles.rs b/tests/roles.rs
similarity index 100%
rename from crates/iroha/tests/roles.rs
rename to tests/roles.rs
diff --git a/crates/iroha/tests/set_parameter.rs b/tests/set_parameter.rs
similarity index 100%
rename from crates/iroha/tests/set_parameter.rs
rename to tests/set_parameter.rs
diff --git a/crates/iroha/tests/sorting.rs b/tests/sorting.rs
similarity index 100%
rename from crates/iroha/tests/sorting.rs
rename to tests/sorting.rs
diff --git a/crates/iroha/tests/transfer_asset.rs b/tests/transfer_asset.rs
similarity index 100%
rename from crates/iroha/tests/transfer_asset.rs
rename to tests/transfer_asset.rs
diff --git a/crates/iroha/tests/transfer_domain.rs b/tests/transfer_domain.rs
similarity index 100%
rename from crates/iroha/tests/transfer_domain.rs
rename to tests/transfer_domain.rs
diff --git a/crates/iroha/tests/triggers/by_call_trigger.rs b/tests/triggers/by_call_trigger.rs
similarity index 100%
rename from crates/iroha/tests/triggers/by_call_trigger.rs
rename to tests/triggers/by_call_trigger.rs
diff --git a/crates/iroha/tests/triggers/data_trigger.rs b/tests/triggers/data_trigger.rs
similarity index 100%
rename from crates/iroha/tests/triggers/data_trigger.rs
rename to tests/triggers/data_trigger.rs
diff --git a/crates/iroha/tests/triggers/event_trigger.rs b/tests/triggers/event_trigger.rs
similarity index 100%
rename from crates/iroha/tests/triggers/event_trigger.rs
rename to tests/triggers/event_trigger.rs
diff --git a/crates/iroha/tests/triggers/mod.rs b/tests/triggers/mod.rs
similarity index 100%
rename from crates/iroha/tests/triggers/mod.rs
rename to tests/triggers/mod.rs
diff --git a/crates/iroha/tests/triggers/orphans.rs b/tests/triggers/orphans.rs
similarity index 100%
rename from crates/iroha/tests/triggers/orphans.rs
rename to tests/triggers/orphans.rs
diff --git a/crates/iroha/tests/triggers/time_trigger.rs b/tests/triggers/time_trigger.rs
similarity index 100%
rename from crates/iroha/tests/triggers/time_trigger.rs
rename to tests/triggers/time_trigger.rs
diff --git a/crates/iroha/tests/triggers/trigger_rollback.rs b/tests/triggers/trigger_rollback.rs
similarity index 100%
rename from crates/iroha/tests/triggers/trigger_rollback.rs
rename to tests/triggers/trigger_rollback.rs
diff --git a/crates/iroha/tests/tx_chain_id.rs b/tests/tx_chain_id.rs
similarity index 100%
rename from crates/iroha/tests/tx_chain_id.rs
rename to tests/tx_chain_id.rs
diff --git a/crates/iroha/tests/tx_history.rs b/tests/tx_history.rs
similarity index 100%
rename from crates/iroha/tests/tx_history.rs
rename to tests/tx_history.rs
diff --git a/crates/iroha/tests/tx_rollback.rs b/tests/tx_rollback.rs
similarity index 100%
rename from crates/iroha/tests/tx_rollback.rs
rename to tests/tx_rollback.rs
diff --git a/crates/iroha/tests/upgrade.rs b/tests/upgrade.rs
similarity index 100%
rename from crates/iroha/tests/upgrade.rs
rename to tests/upgrade.rs