From 5129f7a831fd60b7c6d5b6698c82c2ae557b2a4c Mon Sep 17 00:00:00 2001 From: Dariusz Depta Date: Wed, 7 Aug 2024 18:17:17 +0200 Subject: [PATCH 1/7] Added global links. --- src/pages/cw-multi-test.mdx | 21 ++++++++++------- src/pages/cw-multi-test/installation.mdx | 29 ++++++++++++++++-------- 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/src/pages/cw-multi-test.mdx b/src/pages/cw-multi-test.mdx index edde3f42..37d02a77 100644 --- a/src/pages/cw-multi-test.mdx +++ b/src/pages/cw-multi-test.mdx @@ -4,26 +4,27 @@ tags: ["multitest"] import { Callout } from "nextra/components"; +[file an issue]: https://github.com/CosmWasm/cw-multi-test/issues + # Introduction **`MultiTest`** is a suite of testing tools designed for facilitating multi-contract interactions within the CosmWasm ecosystem. Its primary focus is on providing developers with a robust framework -for testing complex contract interactions and several Cosmos modules operations. +for testing complex smart contract interactions and several Cosmos modules operations. - MultiTest is a **simulator** of the blockchain, allowing tested smart contracts to interact as if - they were operating on the real-life blockchain. + **`MultiTest`** is a **SIMULATOR** of the blockchain, allowing tested smart contracts to interact + as if they were operating on the real-life blockchain. The most valuable advantage of using **`MultiTest`** is that it allows you to test and debug smart contracts with access to Rust source code, eliminating the need to run a complete blockchain node to begin designing smart contract functionality. -The disadvantage is that **`MultiTest`** is a blockchain simulator, and it is possible that the -behavior of the real-life blockchain may slightly differ in edge cases from the simulated model. In -such cases, we strongly encourage you to -[file an issue](https://github.com/CosmWasm/cw-multi-test/issues) with a detailed description of the -use case to help us improve **`MultiTest`**. +The disadvantage is that **`MultiTest`** is a blockchain **SIMULATOR**, and it is possible that the +behavior of the real-life blockchain may slightly differ in some edge cases from the simulated +model. In such cases, we strongly encourage you to [file an issue] with a detailed description of +the use case to help us improve **`MultiTest`**. In the upcoming chapters, we will provide detailed instructions on installing and getting started with **`MultiTest`**, writing unit tests for smart contracts, testing complex interactions between @@ -31,3 +32,7 @@ smart contracts and testing smart contract interactions with Cosmos modules. By the end of these chapters, you will have a comprehensive understanding of using **`MultiTest`** for testing and debugging smart contracts in various scenarios. + + + To successfully follow the upcoming chapters, a basic knowledge of Rust and Cargo is required. + diff --git a/src/pages/cw-multi-test/installation.mdx b/src/pages/cw-multi-test/installation.mdx index 08bb2516..4735a788 100644 --- a/src/pages/cw-multi-test/installation.mdx +++ b/src/pages/cw-multi-test/installation.mdx @@ -4,13 +4,18 @@ tags: ["multitest", "installation"] import { Callout } from "nextra/components"; +[rustup installer]: https://rustup.rs +[Rust and Cargo]: https://www.rust-lang.org/tools/install +[Tarpaulin]: https://github.com/xd009642/tarpaulin +[Nextest]: https://nexte.st +[cw-multi-test]: https://crates.io/crates/cw-multi-test + # Installation -**`MultiTest`** ships as a Rust library named -[cw-multi-test](https://crates.io/crates/cw-multi-test). +**`MultiTest`** ships as a Rust library named [cw-multi-test]. -To use **`MultiTest`** for building and testing smart contracts, add it as a **development -dependency** to your project: +To use **`MultiTest`** for testing smart contracts, add it as a **development dependency** to your +project: ```toml filename="Cargo.toml" [dev-dependencies] @@ -18,18 +23,22 @@ cw-multi-test = "2" ``` - **`MultiTest`** is a _**testing**_ library and should always be added to your project as + **`MultiTest`** is a **TESTING** library and should always be added to your project as **DEVELOPMENT DEPENDENCY** in section **`[dev-dependencies]`** of the **Cargo.toml** file. ### Prerequisities -The only prerequisite to build and test smart contracts using **`MultiTest`** is having -[Rust and Cargo](https://www.rust-lang.org/tools/install) installed. +The only prerequisite to test smart contracts using **`MultiTest`** is having [Rust and Cargo] +installed. + + + We recommend installing Rust using the official [rustup installer]. This makes it easy to stay on + the most recent Rust version. + -Optionally, you may want to install [Tarpaulin](https://github.com/xd009642/tarpaulin) for measuring -code coverage and [Nextest](https://nexte.st) for running tests faster, with clean and beautiful -user interface. +Optionally, you may want to install [Tarpaulin] for measuring code coverage and [Nextest] for +running tests faster, with clean and beautiful user interface. Installing **Tarpaulin**: From f9e730a8175b97a4fc0ba660d957fb15399e00a9 Mon Sep 17 00:00:00 2001 From: Dariusz Depta Date: Thu, 8 Aug 2024 09:16:27 +0200 Subject: [PATCH 2/7] Fixed style. --- src/pages/cw-multi-test.mdx | 24 ++++++++++++------------ src/pages/cw-multi-test/installation.mdx | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/pages/cw-multi-test.mdx b/src/pages/cw-multi-test.mdx index 37d02a77..3c387aa4 100644 --- a/src/pages/cw-multi-test.mdx +++ b/src/pages/cw-multi-test.mdx @@ -8,30 +8,30 @@ import { Callout } from "nextra/components"; # Introduction -**`MultiTest`** is a suite of testing tools designed for facilitating multi-contract interactions +**`MultiTest`** is a suite of testing tools designed to facilitate multi-contract interactions within the CosmWasm ecosystem. Its primary focus is on providing developers with a robust framework -for testing complex smart contract interactions and several Cosmos modules operations. +for testing complex smart contract interactions and operations involving various Cosmos modules. - **`MultiTest`** is a **SIMULATOR** of the blockchain, allowing tested smart contracts to interact - as if they were operating on the real-life blockchain. + **`MultiTest`** is a blockchain SIMULATOR, allowing tested smart contracts to interact as if they + were operating on a real blockchain. -The most valuable advantage of using **`MultiTest`** is that it allows you to test and debug smart -contracts with access to Rust source code, eliminating the need to run a complete blockchain node to -begin designing smart contract functionality. +The most valuable advantage of using **`MultiTest`** is that it allows testing and debugging of +smart contracts with access to the Rust source code, eliminating the need to run a complete +blockchain node to begin designing the smart contract functionality. The disadvantage is that **`MultiTest`** is a blockchain **SIMULATOR**, and it is possible that the behavior of the real-life blockchain may slightly differ in some edge cases from the simulated model. In such cases, we strongly encourage you to [file an issue] with a detailed description of the use case to help us improve **`MultiTest`**. -In the upcoming chapters, we will provide detailed instructions on installing and getting started -with **`MultiTest`**, writing unit tests for smart contracts, testing complex interactions between -smart contracts and testing smart contract interactions with Cosmos modules. +In the upcoming chapters, we provide detailed instructions on installing and getting started with +**`MultiTest`**, writing unit tests for smart contracts, testing complex interactions between smart +contracts and testing smart contract interactions with Cosmos modules. -By the end of these chapters, you will have a comprehensive understanding of using **`MultiTest`** -for testing and debugging smart contracts in various scenarios. +By the end of these chapters, you will have a comprehensive understanding of how to use +**`MultiTest`** for testing and debugging smart contracts in various scenarios. To successfully follow the upcoming chapters, a basic knowledge of Rust and Cargo is required. diff --git a/src/pages/cw-multi-test/installation.mdx b/src/pages/cw-multi-test/installation.mdx index 4735a788..1ba4e711 100644 --- a/src/pages/cw-multi-test/installation.mdx +++ b/src/pages/cw-multi-test/installation.mdx @@ -14,7 +14,7 @@ import { Callout } from "nextra/components"; **`MultiTest`** ships as a Rust library named [cw-multi-test]. -To use **`MultiTest`** for testing smart contracts, add it as a **development dependency** to your +To use **`MultiTest`** for testing smart contracts, add it as a **DEVELOPMENT DEPENDENCY** to your project: ```toml filename="Cargo.toml" From 2c2efb59d4a33c6895076792fe48d1aaa57b4e57 Mon Sep 17 00:00:00 2001 From: Dariusz Depta Date: Thu, 8 Aug 2024 09:48:25 +0200 Subject: [PATCH 3/7] Style and content improvements. --- src/pages/cw-multi-test.mdx | 11 +++++----- src/pages/cw-multi-test/features.mdx | 30 ++++++++++++++-------------- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/src/pages/cw-multi-test.mdx b/src/pages/cw-multi-test.mdx index 3c387aa4..ce819c2b 100644 --- a/src/pages/cw-multi-test.mdx +++ b/src/pages/cw-multi-test.mdx @@ -13,18 +13,17 @@ within the CosmWasm ecosystem. Its primary focus is on providing developers with for testing complex smart contract interactions and operations involving various Cosmos modules. - **`MultiTest`** is a blockchain SIMULATOR, allowing tested smart contracts to interact as if they - were operating on a real blockchain. + **`MultiTest`** is a blockchain **SIMULATOR**, allowing tested smart contracts to interact as if + they were operating on a real blockchain. The most valuable advantage of using **`MultiTest`** is that it allows testing and debugging of smart contracts with access to the Rust source code, eliminating the need to run a complete blockchain node to begin designing the smart contract functionality. -The disadvantage is that **`MultiTest`** is a blockchain **SIMULATOR**, and it is possible that the -behavior of the real-life blockchain may slightly differ in some edge cases from the simulated -model. In such cases, we strongly encourage you to [file an issue] with a detailed description of -the use case to help us improve **`MultiTest`**. +While **`MultiTest`** is a blockchain **SIMULATOR**, it may happen, that the behavior of the real +blockchain might slightly differ in some edge cases. We strongly encourage you to [file an issue] +with a detailed description of such use case to help us improve the **`MultiTest`**. In the upcoming chapters, we provide detailed instructions on installing and getting started with **`MultiTest`**, writing unit tests for smart contracts, testing complex interactions between smart diff --git a/src/pages/cw-multi-test/features.mdx b/src/pages/cw-multi-test/features.mdx index ce8a4886..95b61f1a 100644 --- a/src/pages/cw-multi-test/features.mdx +++ b/src/pages/cw-multi-test/features.mdx @@ -4,23 +4,23 @@ tags: ["multitest", "features"] # Features -## Functionalities +| Feature | Default
implementation | Feature
flag | AppBuilder
constructor | Functionality | +| ------------ | :------------------------: | :--------------: | -------------------------- | -------------------------------------------------- | +| Block | **YES** | | `with_block` | Operations on blocks. | +| API | **YES** | | `with_api` | Access to CosmWasm API. | +| Storage | **YES** | | `with_storage` | Access to storage. | +| Bank | **YES** | | `with_bank` | Interactions with **Bank** module. | +| Staking | **YES** | `staking` | `with_staking` | Interactions with **Staking** module. | +| Distribution | **YES** | `staking` | `with_distribution` | Interactions with **Distribution** module. | +| Governance | **NO** | | `with_gov` | Interactions with **Governance** module. | +| Stargate | **NO** | `stargate` | `with_stargate` | Operations using `Stargate` and/or `Any` messages. | +| Wasm | **YES** | | `with_wasm` | Interactions with **Wasm** module. | +| Custom | **NO** | | `new_custom` | Operations using custom module. | +| IBC | **NO** | `stargate` | `with_ibc` | Inter-blockchain communication operations. | -| Functionality | Impl | Feature | AppBuilder | Testing purpose | -| ------------- | ------- | ---------- | ------------------- | ------------------------------------------- | -| Block | **YES** | | `with_block` | Operations on blocks. | -| API | **YES** | | `with_api` | Access to CosmWasm API. | -| Storage | **YES** | | `with_storage` | Access to storage. | -| Bank | **YES** | | `with_bank` | Interactions with **Bank** module. | -| Staking | **YES** | `staking` | `with_staking` | Interactions with **Staking** module. | -| Distribution | **YES** | `staking` | `with_distribution` | Interactions with **Distribution** module. | -| Governance | **NO** | | `with_gov` | Interactions with **Governance** module. | -| Stargate | **NO** | `stargate` | `with_stargate` | Operations with
Stargate/Any messages. | -| Wasm | **YES** | | `with_wasm` | Interactions with **Wasm** module. | -| Custom | **NO** | | `new_custom` | Operations on custom module. | -| IBC | **NO** | `stargate` | `with_ibc` | Inter-blockchain communication operations. | +## Feature flags summary -## Feature flags +The following table summarizes all the feature flags supported by **`MultiTest`**. | Feature flag | Description | | -------------- | ------------------------------------------------------------------------------------------------------------------------------------- | From 679795659b9311b3b56cee795f1875f8796a9b53 Mon Sep 17 00:00:00 2001 From: Dariusz Depta Date: Thu, 8 Aug 2024 10:34:37 +0200 Subject: [PATCH 4/7] Added content. --- src/pages/cw-multi-test/features.mdx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pages/cw-multi-test/features.mdx b/src/pages/cw-multi-test/features.mdx index 95b61f1a..334ec685 100644 --- a/src/pages/cw-multi-test/features.mdx +++ b/src/pages/cw-multi-test/features.mdx @@ -4,6 +4,13 @@ tags: ["multitest", "features"] # Features +All **`MultiTest`** features a listed in the following table. The **"Default implementation"** +column indicates whether the feature has a default implementation in **`MultiTest`** that simulates +the functionality of the real blockchain as closely as possible. In cases where **`MultiTest`** does +not have a default implementation for the feature, users may provide their own, using `AppBuilder`'s +function listed in **"AppBuilder constructor"** column. Names of **`MultiTest`** feature flags +required to enable specific functionality are provided in the column **"Feature flag"**. + | Feature | Default
implementation | Feature
flag | AppBuilder
constructor | Functionality | | ------------ | :------------------------: | :--------------: | -------------------------- | -------------------------------------------------- | | Block | **YES** | | `with_block` | Operations on blocks. | From d153a269da240cec0136055217eef7b26989c0f2 Mon Sep 17 00:00:00 2001 From: Dariusz Depta Date: Thu, 8 Aug 2024 10:38:12 +0200 Subject: [PATCH 5/7] Updates. --- src/pages/cw-multi-test/features.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/cw-multi-test/features.mdx b/src/pages/cw-multi-test/features.mdx index 334ec685..e266d723 100644 --- a/src/pages/cw-multi-test/features.mdx +++ b/src/pages/cw-multi-test/features.mdx @@ -25,7 +25,7 @@ required to enable specific functionality are provided in the column **"Feature | Custom | **NO** | | `new_custom` | Operations using custom module. | | IBC | **NO** | `stargate` | `with_ibc` | Inter-blockchain communication operations. | -## Feature flags summary +### Feature flags summary The following table summarizes all the feature flags supported by **`MultiTest`**. From 40d520dd996cfb2e9dd2d6c445f32b9aaaf25130 Mon Sep 17 00:00:00 2001 From: Dariusz Depta Date: Thu, 8 Aug 2024 10:41:32 +0200 Subject: [PATCH 6/7] Updates. --- src/pages/cw-multi-test/features.mdx | 2 +- src/pages/cw-multi-test/installation.mdx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/cw-multi-test/features.mdx b/src/pages/cw-multi-test/features.mdx index e266d723..334ec685 100644 --- a/src/pages/cw-multi-test/features.mdx +++ b/src/pages/cw-multi-test/features.mdx @@ -25,7 +25,7 @@ required to enable specific functionality are provided in the column **"Feature | Custom | **NO** | | `new_custom` | Operations using custom module. | | IBC | **NO** | `stargate` | `with_ibc` | Inter-blockchain communication operations. | -### Feature flags summary +## Feature flags summary The following table summarizes all the feature flags supported by **`MultiTest`**. diff --git a/src/pages/cw-multi-test/installation.mdx b/src/pages/cw-multi-test/installation.mdx index 1ba4e711..748a4dbf 100644 --- a/src/pages/cw-multi-test/installation.mdx +++ b/src/pages/cw-multi-test/installation.mdx @@ -27,7 +27,7 @@ cw-multi-test = "2" **DEVELOPMENT DEPENDENCY** in section **`[dev-dependencies]`** of the **Cargo.toml** file.
-### Prerequisities +## Prerequisities The only prerequisite to test smart contracts using **`MultiTest`** is having [Rust and Cargo] installed. From 6c2889cc95dcd32503cf092b0ebdf6a4c02bbab6 Mon Sep 17 00:00:00 2001 From: Dariusz Depta Date: Thu, 8 Aug 2024 15:47:15 +0200 Subject: [PATCH 7/7] Added testing speed comment. --- src/pages/cw-multi-test.mdx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/cw-multi-test.mdx b/src/pages/cw-multi-test.mdx index ce819c2b..4e98c786 100644 --- a/src/pages/cw-multi-test.mdx +++ b/src/pages/cw-multi-test.mdx @@ -19,7 +19,10 @@ for testing complex smart contract interactions and operations involving various The most valuable advantage of using **`MultiTest`** is that it allows testing and debugging of smart contracts with access to the Rust source code, eliminating the need to run a complete -blockchain node to begin designing the smart contract functionality. +blockchain node to begin designing the smart contract functionality. Additionally, **`MultiTest`** +enables the execution of tests significantly faster than on a real blockchain, as it bypasses the +overhead associated with network consensus and block production. This results in a more efficient +development cycle, allowing for quicker iterations and faster identification of issues. While **`MultiTest`** is a blockchain **SIMULATOR**, it may happen, that the behavior of the real blockchain might slightly differ in some edge cases. We strongly encourage you to [file an issue]