-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ibc-hooks transfer stack order and add tests
- Loading branch information
Showing
22 changed files
with
1,072 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,5 @@ bin | |
*/.DS_Store | ||
|
||
|
||
scripts/tests/ibc-hooks/counter/target | ||
data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Tests | ||
|
||
This folder contains the integration tests that should run successfully each time a new core release is created. | ||
|
||
At the moment, there are four tests defined that can be run with `make integration-test-all`. The breakdown of each test is as follows: | ||
|
||
- [init-test-framework](./start.sh): build the core and spin up two nodes with their own genesis event and some accounts preloaded with funds. | ||
- [test-relayer](./relayer/): connect the two blockchains with a relayer opening a channel between both of them. | ||
- [test-ica](./ica/delegate.sh): using the relayer, this test creates an interchain account and delegates funds using an interchain message. | ||
- [test-ibc-hooks](./ibc-hooks/increment.sh): deploys a slightly modified [counter contract](./ibc-hooks/counter/) to chain test-2 and submits two requests from chain test-1 to validate that the contract received the funds and executed the wasm code correctly. | ||
- remove-ica-data: removes the data and kills the process when the integration tests are completed. | ||
|
||
## Development process | ||
|
||
This set of tests must run out of the box in Linux-based systems installing [GoLang 1.20](https://go.dev/), [jq](https://stedolan.github.io/jq/), [screen](https://www.geeksforgeeks.org/screen-command-in-linux-with-examples/) and [rly](https://github.com/cosmos/relayer). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
[package] | ||
name = "counter" | ||
description = "Cosmwasm counter dapp, with permissions for testing Osmosis wasmhooks" | ||
version = "0.1.0" | ||
authors = ["osmosis contributors"] | ||
edition = "2021" | ||
|
||
exclude = [ | ||
# Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication. | ||
"contract.wasm", | ||
"hash.txt", | ||
] | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[lib] | ||
crate-type = ["cdylib", "rlib"] | ||
|
||
[features] | ||
# for more explicit tests, cargo test --features=backtraces | ||
backtraces = ["cosmwasm-std/backtraces"] | ||
# use library feature to disable all instantiate/execute/query exports | ||
library = [] | ||
|
||
[package.metadata.scripts] | ||
optimize = """docker run --rm -v "$(pwd)":/code \ | ||
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ | ||
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ | ||
cosmwasm/rust-optimizer:0.12.6 | ||
""" | ||
|
||
[dependencies] | ||
cosmwasm-schema = "1.1.3" | ||
cosmwasm-std = "1.1.3" | ||
cosmwasm-storage = "1.1.3" | ||
cw-storage-plus = "0.16.0" | ||
cw2 = "0.16.0" | ||
schemars = "0.8.10" | ||
serde = { version = "1.0.145", default-features = false, features = ["derive"] } | ||
thiserror = { version = "1.0.31" } | ||
|
||
[dev-dependencies] | ||
cw-multi-test = "0.16.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Counter contract from [Osmosis Labs](https://github.com/osmosis-labs/osmosis/commit/64393a14e18b2562d72a3892eec716197a3716c7) | ||
|
||
This contract is a modification of the standard cosmwasm `counter` contract. | ||
Namely, it tracks a counter, _by sender_. | ||
This is a better way to test wasmhooks. | ||
|
||
This contract tracks any funds sent to it by adding it to the state under the `sender` key. | ||
|
||
This way we can verify that, independently of the sender, the funds will end up under the | ||
`WasmHooksModuleAccount` address when the contract is executed via an IBC send that goes | ||
through the wasmhooks module. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
c0e7a3b40d9710f6f72322293ba5cd871714008d9accd9a91c0fb08272609054 counter.wasm |
1 change: 1 addition & 0 deletions
1
scripts/tests/ibc-hooks/counter/artifacts/checksums_intermediate.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bffb3256d4fd5668e497ae5671844ef3dcdf1a5f2594747b894dfc02e243ab0e ./target/wasm32-unknown-unknown/release/counter.wasm |
Binary file not shown.
Oops, something went wrong.