Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade to Provenance v1.19.1 and Provwasm v2.4.0 #11

Merged
merged 22 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog for `provwasm-test-tube`

### [v0.2.0](https://github.com/provenance-io/provwasm-test-tube/tree/v0.2.0)

* update to Provenance v1.19.1 and Provwasm
v2.4.0 ([#10](https://github.com/provenance-io/provwasm-test-tube/issues/10))

## Releases

### [v0.1.0](https://github.com/provenance-io/provwasm-test-tube/tree/v0.1.0)
Expand Down
44 changes: 43 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,47 @@
resolver = "2"

members = [
"packages/*",
"packages/*",
]

[workspace.package]
version = "0.2.0"
repository = "https://github.com/provenance-io/provwasm-test-tube"
edition = "2021"
license = "Apache-2.0"

[workspace.dependencies]
### CosmWasm

cosmwasm-schema = { version = "2.0.6" }
cosmwasm-std = { version = "2.1.3", default-features = false, features = ["cosmwasm_2_1", "stargate", "std"] }
cw-storage-plus = { version = "2.0.0" }

### ProvWasm
provwasm-mocks = { git = "https://github.com/provenance-io/provwasm.git", branch = "main" }
provwasm-std = { git = "https://github.com/provenance-io/provwasm.git", branch = "main" }
test-tube-prov = { path = "packages/test-tube" }

base64 = "0.22.0"
chrono = { version = "0.4.37", default-features = false }
cosmrs = { version = "0.20.0", default-features = false, features = ["cosmwasm", "rpc"] }
prost = { version = "0.13.2", default-features = false, features = [
"prost-derive",
] }
rayon = "1.5.3"
serde = { version = "1.0.197", default-features = false, features = [
"derive",
] }
serde_json = { version = "1.0.115", features = ["std"] }
thiserror = { version = "1.0.58" }

[profile.release]
opt-level = 3
debug = false
rpath = false
lto = true
debug-assertions = false
codegen-units = 1
panic = 'abort'
incremental = false
overflow-checks = true
5 changes: 3 additions & 2 deletions RELEASE_CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
### [v0.1.0](https://github.com/provenance-io/provwasm-test-tube/tree/v0.1.0)
### [v0.2.0](https://github.com/provenance-io/provwasm-test-tube/tree/v0.2.0)

* initial release
* update to Provenance v1.19.1 and Provwasm
v2.4.0 ([#10](https://github.com/provenance-io/provwasm-test-tube/issues/10))
30 changes: 15 additions & 15 deletions packages/provwasm-test-tube/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "provwasm-test-tube"
version = "0.1.0-rc1"
version = { workspace = true }
repository = "https://github.com/provenance-io/provwasm-test-tube"
edition = "2021"
license = "Apache-2.0"
edition = { workspace = true }
license = { workspace = true }
authors = ["Ken Talley <[email protected]"]
description = "library for building smart contract integration testing environments for Provenance Blockchain in Rust"
keywords = ["provenance", "blockchain", "smart-contracts", "defi", "finance"]
Expand All @@ -13,20 +13,20 @@ categories = ["api-bindings", "cryptography::cryptocurrencies", "wasm"]
exclude = ["provenance", "test_artifacts"]

[dependencies]
base64 = "0.22.0"
cosmrs = { version = "0.14.0", features = ["cosmwasm"] }
cosmwasm-std = "1.5"
provwasm-std = { version = "2.2.0" }
prost = { version = "0.11.9", default-features = false, features = ["prost-derive"] }
serde = "1.0.197"
serde_json = "1.0.115"
test-tube-prov = { version = "0.1.0-rc1", path = "../test-tube" }
thiserror = "1.0.58"
base64 = { workspace = true }
cosmrs = { workspace = true }
cosmwasm-std = { workspace = true }
provwasm-std = { workspace = true }
prost = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
test-tube-prov = { workspace = true }
thiserror = { workspace = true }

[build-dependencies]
bindgen = "0.69.1"

[dev-dependencies]
cw1-whitelist = "1.1.1"
rayon = "1.5.3"
marker = { version = "2.2.0", git = "https://github.com/provenance-io/provwasm" }
cw1-whitelist = "2.0.0"
rayon = { workspace = true }
marker = { git = "https://github.com/provenance-io/provwasm", branch = "main" }
29 changes: 14 additions & 15 deletions packages/provwasm-test-tube/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ contract against real chain's logic instead of mocks.

| provwasm-test-tube | provwasm | provenance |
|--------------------|----------|------------|
| 0.2.0 | 2.4.0 | 1.19.1 |
| 0.1.0 | 2.2.0 | 1.18.0 |

## Getting Started
Expand All @@ -27,7 +28,7 @@ contract: [marker](https://github.com/provenance-io/provwasm/contracts/marker).
Here is how to setup the test:

```rust
use cosmwasm_std::Coin;
use cosmwasm_std::coin;
use provwasm_test_tube::{ProvwasmTestApp, RunnerError};

#[test]
Expand All @@ -36,7 +37,7 @@ fn test() -> Result<(), RunnerError> {
let app = ProvwasmTestApp::new();

// create new account with initial funds
let accs = app.init_accounts(&[Coin::new(1_000_000_000_000, "nhash")], 2)?;
let accs = app.init_accounts(&[coin(1_000_000_000_000, "nhash")], 2)?;

let admin = &accs[0];
let new_admin = &accs[1];
Expand All @@ -53,13 +54,13 @@ Note that `init_accounts` is a convenience function that creates multiple accoun
If you want to create just one account, you can use `init_account` instead.

```rust
use cosmwasm_std::Coin;
use cosmwasm_std::coin;
use provwasm_test_tube::{ProvwasmTestApp, RunnerError};

fn test() -> Result<(), RunnerError> {
let app = ProvwasmTestApp::new();

let account = app.init_account(&[Coin::new(1_000_000_000_000, "nhash")])?;
let account = app.init_account(&[coin(1_000_000_000_000, "nhash")])?;

Ok(())
}
Expand All @@ -74,13 +75,13 @@ Now if we want to test a provwasm contract, we need to
Then we can start interacting with our contract

```rust
use cosmwasm_std::Coin;
use cosmwasm_std::coin;
use provwasm_test_tube::wasm::Wasm;
use provwasm_test_tube::{Module, ProvwasmTestApp, RunnerError};

fn test() -> Result<(), RunnerError> {
let app = ProvwasmTestApp::default();
let accs = app.init_accounts(&[Coin::new(100_000_000_000_000, "nhash")], 1)?;
let accs = app.init_accounts(&[coin(100_000_000_000_000, "nhash")], 1)?;
let admin = &accs[0];

let wasm = Wasm::new(&app);
Expand All @@ -95,7 +96,7 @@ fn test() -> Result<(), RunnerError> {
Now let's execute the contract and verify that the contract's state is updated properly.

```rust
use cosmwasm_std::{Coin, Uint128};
use cosmwasm_std::{coin, Binary, Coin, Uint128};
use provwasm_test_tube::wasm::Wasm;
use provwasm_test_tube::{Account, Module, ProvwasmTestApp, RunnerError};

Expand All @@ -105,7 +106,7 @@ use marker::types::Marker;
#[test]
fn create_and_withdraw() -> Result<(), RunnerError> {
let app = ProvwasmTestApp::default();
let accs = app.init_accounts(&[Coin::new(100_000_000_000_000, "nhash")], 1)?;
let accs = app.init_accounts(&[coin(100_000_000_000_000, "nhash")], 1)?;
let admin = &accs[0];

let wasm = Wasm::new(&app);
Expand All @@ -122,7 +123,7 @@ fn create_and_withdraw() -> Result<(), RunnerError> {
name: "marker-test.sc.pb".to_string(),
},
Some(&admin.address()),
None,
Some("marker test"),
&[],
admin,
)?
Expand Down Expand Up @@ -205,20 +206,18 @@ Module wrappers provides convenient functions to interact with the appchain's mo
Let's try interact with the `Marker` module:

```rust
use std::convert::TryFrom;

use cosmwasm_std::{Coin, Uint128};
use cosmwasm_std::{coin, Coin, Uint128};
use provwasm_test_tube::{Account, Module, ProvwasmTestApp, RunnerError};

use provwasm_std::types::provenance::marker::v1::{
use provwasm_test_tube::provwasm_std::types::provenance::marker::v1::{
Access, AccessGrant, MarkerAccount, MarkerStatus, MarkerType, MsgAddMarkerRequest,
QueryMarkerRequest,
};

#[test]
fn create_and_withdraw() -> Result<(), RunnerError> {
fn custom_module() -> Result<(), RunnerError> {
let app = ProvwasmTestApp::default();
let accs = app.init_accounts(&[Coin::new(100_000_000_000_000, "nhash")], 1)?;
let accs = app.init_accounts(&[coin(100_000_000_000_000, "nhash")], 1)?;
let admin = &accs[0];

let marker_module = provwasm_test_tube::marker::Marker::new(&app);
Expand Down
Loading