Skip to content

Commit

Permalink
Merge pull request #4 from persistenceOne/betterclever/test-tube-x
Browse files Browse the repository at this point in the history
Betterclever/test tube x
  • Loading branch information
betterclever authored Nov 28, 2023
2 parents c4b4498 + c1052f3 commit 0b507c6
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 33 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"

members = [
"packages/*",
Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# test-tube
# Test Tube X

![test](https://github.com/osmosis-labs/test-tube/actions/workflows/test.yml/badge.svg)
[`test-tube`](https://github.com/osmosis-labs/test-tube) is a generic library by Osmosis for building testing environments for [CosmWasm](https://cosmwasm.com/) smart contracts. It allows you to test your smart contract logic against the actual Cosmos SDK chain's logic, which is written in Go, using Rust. This eliminates the need to write Go code or learn Go in order to test your smart contracts against the Cosmos SDK.

`test-tube` is a generic library for building testing environments for [CosmWasm](https://cosmwasm.com/) smart contracts. It allows you to test your smart contract logic against the actual Cosmos SDK chain's logic, which is written in Go, using Rust. This eliminates the need to write Go code or learn Go in order to test your smart contracts against the Cosmos SDK.
`test-tube-x` is a fork of test-tube by Persistence made using newer versions of Cosmos SDK (v47). It can be used by anyone to create a testing environments by anyone using the following defaults:
- Cosmos SDK v47
- Persistence SDK v2
- Cosmwasm v1.4

`test-tube` is currently used to build [`osmosis-test-tube`](https://github.com/osmosis-labs/test-tube/tree/main/packages/osmosis-test-tube), but it can be used to build testing environments for any Cosmos SDK-based chain. To do this, you will need to build a shared library that exports the functions described [here](https://github.com/osmosis-labs/test-tube/blob/ddae11d003b5d900bdee2026034b9b1d4c33bdb3/packages/test-tube/src/bindings.rs#L211-L241). You can use the [Go code](https://github.com/osmosis-labs/test-tube/tree/main/packages/osmosis-test-tube/libosmosistesttube) and [build script](https://github.com/osmosis-labs/test-tube/blob/main/packages/osmosis-test-tube/build.rs) from `osmosis-test-tube` as a reference.

`test-tube-x` is currently used to build [`persistence-test-tube`](https://github.com/persistenceOne/test-tube/tree/main/packages/persistence-test-tube).

You can refer to Osmosis Test tube [docs](https://github.com/osmosis-labs/test-tube) to get more information on how to build upon test-tube or test-tube-x.

## Features

Expand All @@ -21,7 +27,7 @@ So if your contract just interact with common modules like Bank, Staking, and Di

## Contributing

We welcome contributions to `test-tube`! If you find a bug or have an idea for a new feature, please open an issue or submit a pull request.
We welcome contributions to `test-tube-x`! If you find a bug or have an idea for a new feature, please open an issue or submit a pull request.

## License

Expand Down
6 changes: 3 additions & 3 deletions packages/persistence-test-tube/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ edition = "2021"
license = "MIT OR Apache-2.0"
name = "persistence-test-tube"
repository = "https://github.com/persistenceOne/test-tube"
version = "0.2.1"
version = "1.0.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

exclude = ["persistenceCore", "test_artifacts"]
Expand All @@ -13,11 +13,11 @@ exclude = ["persistenceCore", "test_artifacts"]
base64 = "0.13.0"
cosmrs = {version = "0.15.0", features = ["cosmwasm"]}
cosmwasm-std = "1.4.0"
persistence-std = "0.1.6"
persistence-std = "1.0.0"
prost = "0.12.0"
serde = "1.0.144"
serde_json = "1.0.85"
test-tube-x = {version = "0.2.0", path = "../test-tube-x", features = ["module-wrappers"]}
test-tube-x = {version = "1.0.0", path = "../test-tube-x", features = ["module-wrappers"]}
thiserror = "1.0.34"

[build-dependencies]
Expand Down
2 changes: 0 additions & 2 deletions packages/persistence-test-tube/libpersistencetesttube/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ module github.com/persistenceOne/test-tube/persistence-test-tube

go 1.21

toolchain go1.21.0

// use persistence's forks with LSM implemented
replace (
github.com/CosmWasm/wasmd => github.com/persistenceOne/wasmd v0.40.2-lsm3
Expand Down
9 changes: 3 additions & 6 deletions packages/persistence-test-tube/src/runner/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,14 @@ impl<'a> Runner<'a> for PersistenceTestApp {

#[cfg(test)]
mod tests {
use prost::Message;
use std::option::Option::None;

use cosmrs::Any;
use cosmwasm_std::{attr, coins, Coin};
use cosmwasm_std::{coins, Coin};

use crate::runner::app::PersistenceTestApp;
use test_tube_x::account::{Account, FeeSetting};
use test_tube_x::account::Account;
use test_tube_x::module::Module;
use test_tube_x::{ExecuteResponse, Wasm, Bank};
use test_tube_x::{runner::*, RunnerError};
use test_tube_x::Wasm;

#[test]
fn test_init_accounts() {
Expand Down
13 changes: 1 addition & 12 deletions packages/persistence-test-tube/src/runner/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,7 @@ pub mod app;

#[cfg(test)]
mod tests {
use std::ffi::CString;

use crate::{Bank, Wasm};

use super::app::PersistenceTestApp;
use cosmwasm_std::{to_binary, BankMsg, Coin, CosmosMsg, Empty, Event, WasmMsg};
use cw1_whitelist::msg::{ExecuteMsg, InstantiateMsg};
use test_tube_x::account::Account;
use test_tube_x::runner::error::RunnerError::{ExecuteError, QueryError};
use test_tube_x::runner::result::RawResult;
use test_tube_x::runner::Runner;
use test_tube_x::{Module, RunnerExecuteResult};


#[derive(::prost::Message)]
struct AdhocRandomQueryRequest {
Expand Down
4 changes: 2 additions & 2 deletions packages/test-tube-x/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ edition = "2021"
license = "MIT OR Apache-2.0"
name = "test-tube-x"
repository = "https://github.com/persistenceCore/test-tube"
version = "0.2.0"
version = "1.0.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
base64 = "0.13.0"
cosmrs = {version = "0.15.0", features = ["cosmwasm", "rpc"]}
cosmwasm-std = {version = "1.4.0", features = ["stargate"]}
persistence-std = {version = "0.1.8", optional = true}
persistence-std = {version = "1.0.0", optional = true}
prost = "0.12.0"
serde = "1.0.144"
serde_json = "1.0.85"
Expand Down
12 changes: 9 additions & 3 deletions packages/test-tube-x/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# test-tube
# Test Tube X

[![test-tube on crates.io](https://img.shields.io/crates/v/test-tube.svg)](https://crates.io/crates/test-tube) [![Docs](https://docs.rs/test-tube/badge.svg)](https://docs.rs/test-tube)
[`test-tube`](https://github.com/osmosis-labs/test-tube) is a generic library by Osmosis for building testing environments for [CosmWasm](https://cosmwasm.com/) smart contracts. It allows you to test your smart contract logic against the actual Cosmos SDK chain's logic, which is written in Go, using Rust. This eliminates the need to write Go code or learn Go in order to test your smart contracts against the Cosmos SDK.

`test-tube` is a generic library for building testing environments for [CosmWasm](https://cosmwasm.com/) smart contracts. It allows you to test your smart contract logic against the actual Cosmos SDK chain's logic, which is written in Go, using Rust. This eliminates the need to write Go code or learn Go in order to test your smart contracts against the Cosmos SDK.
`test-tube-x` is a fork of test-tube by Persistence made using newer versions of Cosmos SDK (v47). It can be used by anyone to create a testing environments by anyone using the following defaults:
- Cosmos SDK v47
- Persistence SDK v2
- Cosmwasm v1.4


`test-tube-x` is currently used to build [`persistence-test-tube`](https://github.com/persistenceOne/test-tube/tree/main/packages/persistence-test-tube).

0 comments on commit 0b507c6

Please sign in to comment.