-
Notifications
You must be signed in to change notification settings - Fork 28
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
Modified all test-data wasm contracts, added new functionality, messages, queries and added integration tests #525
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Reviewable status: 0 of 45 files reviewed, 2 unresolved discussions (waiting on @keyleu, @miladz68, @wojtek-coreum, and @ysv)
a discussion (no related file):
The CI is failed.
a discussion (no related file):
Why do we need packages/coreum-wasm-sdk
commited? What is inside?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Reviewable status: 0 of 48 files reviewed, 2 unresolved discussions (waiting on @dzmitryhil, @miladz68, @wojtek-coreum, and @ysv)
a discussion (no related file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
Why do we need
packages/coreum-wasm-sdk
commited? What is inside?
This will be removed after coreum-wasm-sdk v.0.1.2 is on crates.io. I made the PR now with it because so all of you can already check the code. Once I get your approval and the coreum-wasm-sdk is on crates.io I'll remove the package and update the dependencies to use that version.
a discussion (no related file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
The CI is failed.
Yes, I need to discuss this in the meeting because I think it's something related to docker/crust. When building the images it doesn't allow for Cargo.lock to be modified, and since the contract dependencies are updated, this file is automatically updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 48 files reviewed, 2 unresolved discussions (waiting on @keyleu, @miladz68, @wojtek-coreum, and @ysv)
a discussion (no related file):
Previously, keyleu (Keyne) wrote…
Yes, I need to discuss this in the meeting because I think it's something related to docker/crust. When building the images it doesn't allow for Cargo.lock to be modified, and since the contract dependencies are updated, this file is automatically updated.
Ok, let's discuss.
a discussion (no related file):
Previously, keyleu (Keyne) wrote…
This will be removed after coreum-wasm-sdk v.0.1.2 is on crates.io. I made the PR now with it because so all of you can already check the code. Once I get your approval and the coreum-wasm-sdk is on crates.io I'll remove the package and update the dependencies to use that version.
Clear. So the coreum-wasm-sdk v.0.1.2
should be merged first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 17 of 45 files at r1, 13 of 13 files at r2, all commit messages.
Reviewable status: 30 of 48 files reviewed, 15 unresolved discussions (waiting on @keyleu and @ysv)
integration-tests/modules/testdata/wasm/bank-send/src/lib.rs
line 3 at r2 (raw file):
pub mod contract; pub mod error; pub mod msg;
you need an empty line. notice the red marker
integration-tests/modules/testdata/wasm/bank-send/src/msg.rs
line 14 at r2 (raw file):
recipient: String, }, }
you need and empty line
integration-tests/modules/testdata/wasm/ft/README.md
line 1 at r2 (raw file):
# FT Contract
I think this README file is not needed !
integration-tests/modules/testdata/wasm/ft/packages/coreum-wasm-sdk/Cargo.toml
line 13 at r2 (raw file):
serde = { version = "1.0.164", default-features = false, features = ["derive"] } schemars = "0.8.12" cosmwasm-schema = "1.2.6"
empty line needed.
integration-tests/modules/testdata/wasm/ft/packages/coreum-wasm-sdk/.github/workflows/release.yml
line 1 at r2 (raw file):
name: release
this file should not exist.
integration-tests/modules/testdata/wasm/ft/packages/coreum-wasm-sdk/src/assetnft.rs
line 1 at r2 (raw file):
use cosmwasm_schema::QueryResponses;
I assume you have copied the sdk code here, but that seems to not be the right approach. the correct version of the sdk must be used after the other PR is merged.
integration-tests/modules/testdata/wasm/nft/README.md
line 1 at r2 (raw file):
# NFT Contract
I don't think we need a README for a test contract ?!
integration-tests/modules/testdata/wasm/nft/packages/coreum-wasm-sdk/Cargo.toml
line 13 at r2 (raw file):
serde = { version = "1.0.164", default-features = false, features = ["derive"] } schemars = "0.8.12" cosmwasm-schema = "1.2.6"
empty line needed.
integration-tests/modules/testdata/wasm/nft/packages/coreum-wasm-sdk/.github/workflows/release.yml
line 1 at r2 (raw file):
name: release
we should remove the copied package and just point to the new version after it is merged.
integration-tests/modules/testdata/wasm/simple-state/Cargo.toml
line 37 at r2 (raw file):
cosmwasm-schema = "1.2.6" cw-storage-plus = "1.0.1"
empty line needed.
integration-tests/modules/testdata/wasm/simple-state/src/lib.rs
line 4 at r2 (raw file):
pub mod error; pub mod msg; pub mod state;
empty line needed.
integration-tests/modules/testdata/wasm/simple-state/src/msg.rs
line 23 at r2 (raw file):
pub struct CountResponse { pub count: i32, }
empty line needed.
integration-tests/modules/testdata/wasm/simple-state/src/state.rs
line 3 at r2 (raw file):
use cw_storage_plus::Item; pub const COUNTER: Item<i32> = Item::new("counter");
empty line neded.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 30 of 48 files reviewed, 16 unresolved discussions (waiting on @dzmitryhil, @miladz68, and @ysv)
a discussion (no related file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
Clear. So the
coreum-wasm-sdk v.0.1.2
should be merged first.
Correct, this one should not be merged yet.
integration-tests/modules/testdata/wasm/bank-send/src/lib.rs
line 3 at r2 (raw file):
Previously, miladz68 (milad) wrote…
you need an empty line. notice the red marker
Done.
integration-tests/modules/testdata/wasm/bank-send/src/msg.rs
line 14 at r2 (raw file):
Previously, miladz68 (milad) wrote…
you need and empty line
Done.
integration-tests/modules/testdata/wasm/ft/README.md
line 1 at r2 (raw file):
# FT Contract
Really? I added all the information here because the coreum-wasm-sdk package links to this repository for new users looking for Smart contract examples.
integration-tests/modules/testdata/wasm/ft/packages/coreum-wasm-sdk/Cargo.toml
line 13 at r2 (raw file):
Previously, miladz68 (milad) wrote…
empty line needed.
Done.
integration-tests/modules/testdata/wasm/ft/packages/coreum-wasm-sdk/.github/workflows/release.yml
line 1 at r2 (raw file):
Previously, miladz68 (milad) wrote…
this file should not exist.
Removed.
integration-tests/modules/testdata/wasm/ft/packages/coreum-wasm-sdk/src/assetnft.rs
line 1 at r2 (raw file):
Previously, miladz68 (milad) wrote…
I assume you have copied the sdk code here, but that seems to not be the right approach. the correct version of the sdk must be used after the other PR is merged.
Yes, that's the plan. We don't merge this until I've removed the package and updated the version. I needed to do it this way for now because the other PR is not merged yet and the new version is not on crates.io
integration-tests/modules/testdata/wasm/nft/README.md
line 1 at r2 (raw file):
Previously, miladz68 (milad) wrote…
I don't think we need a README for a test contract ?!
Same as above.
integration-tests/modules/testdata/wasm/nft/packages/coreum-wasm-sdk/Cargo.toml
line 13 at r2 (raw file):
Previously, miladz68 (milad) wrote…
empty line needed.
Done.
integration-tests/modules/testdata/wasm/nft/packages/coreum-wasm-sdk/.github/workflows/release.yml
line 1 at r2 (raw file):
Previously, miladz68 (milad) wrote…
we should remove the copied package and just point to the new version after it is merged.
Done.
integration-tests/modules/testdata/wasm/simple-state/src/lib.rs
line 4 at r2 (raw file):
Previously, miladz68 (milad) wrote…
empty line needed.
Done.
integration-tests/modules/testdata/wasm/simple-state/src/msg.rs
line 23 at r2 (raw file):
Previously, miladz68 (milad) wrote…
empty line needed.
Done.
integration-tests/modules/testdata/wasm/simple-state/src/state.rs
line 3 at r2 (raw file):
Previously, miladz68 (milad) wrote…
empty line neded.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 26 of 48 files reviewed, 15 unresolved discussions (waiting on @dzmitryhil, @miladz68, and @ysv)
integration-tests/modules/testdata/wasm/ft/README.md
line 1 at r2 (raw file):
Previously, miladz68 (milad) wrote…
I think this README file is not needed !
Like agreed, we are keeping it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 24 of 45 files at r1, 13 of 13 files at r2, 11 of 11 files at r3, all commit messages.
Reviewable status: all files reviewed, 15 unresolved discussions (waiting on @miladz68 and @ysv)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 41 of 52 files reviewed, 15 unresolved discussions (waiting on @dzmitryhil, @miladz68, and @ysv)
a discussion (no related file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
Ok, let's discuss.
Ok this is fixed now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 10 of 11 files at r4, 1 of 1 files at r5, all commit messages.
Reviewable status: all files reviewed, 15 unresolved discussions (waiting on @keyleu, @miladz68, and @ysv)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 25 of 52 files reviewed, 15 unresolved discussions (waiting on @dzmitryhil, @miladz68, and @ysv)
a discussion (no related file):
Previously, keyleu (Keyne) wrote…
Correct, this one should not be merged yet.
Ok, now it's using the v0.1.2, so it can be reviewed
integration-tests/modules/testdata/wasm/simple-state/Cargo.toml
line 37 at r2 (raw file):
Previously, miladz68 (milad) wrote…
empty line needed.
done!
integration-tests/modules/testdata/wasm/ft/packages/coreum-wasm-sdk/src/assetnft.rs
line 1 at r2 (raw file):
Previously, keyleu (Keyne) wrote…
Yes, that's the plan. We don't merge this until I've removed the package and updated the version. I needed to do it this way for now because the other PR is not merged yet and the new version is not on crates.io
package is now removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 11 of 11 files at r3, 4 of 11 files at r4, 27 of 27 files at r6, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @dzmitryhil and @ysv)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @keyleu and @ysv)
integration-tests/modules/wasm_test.go
line 966 at r6 (raw file):
requireT.NoError(json.Unmarshal(queryOut, &wasmTokensRes)) requireT.Equal( expectedToken.Denom, wasmTokensRes.Tokens[0].Denom,
Why do you validate denom only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @dzmitryhil and @ysv)
integration-tests/modules/wasm_test.go
line 966 at r6 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
Why do you validate denom only?
The wasm sdk version 0.1.1 had a structure
pub struct Token {
pub denom: String,
pub issuer: String,
pub symbol: String,
pub subunit: String,
pub precision: u32,
pub description: Option,
pub features: Option<Vec>,
pub burn_rate: String,
pub send_commission_rate: String,
}
But the proto file includes a uint32 version = 6 at the end.
In the individual token test it does this before equaling:
wasmTokenRes.Token.Version = expectedToken.Version // test should work with any version
to make sure version is the same.
If you want I can change it to validate everything and hardcode the version in the same way, I thought checking the denom looks more understandable to see that we receive the same token (all the fields are the same anyways).
I can change it if you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @keyleu and @ysv)
integration-tests/modules/wasm_test.go
line 1565 at r6 (raw file):
requireT.NoError(json.Unmarshal(queryOut, &nftClassesQueryRes)) var found = classInArray(nftClass{
You can replace with
requireT.Contains(nftClass{
ID: expectedClass.Id,
Name: expectedClass.Name,
Symbol: expectedClass.Symbol,
Description: expectedClass.Description,
URI: expectedClass.URI,
URIHash: expectedClass.URIHash,
Data: dataString,
}, nftClassesQueryRes.Classes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @keyleu and @ysv)
integration-tests/modules/wasm_test.go
line 966 at r6 (raw file):
Previously, keyleu (Keyne) wrote…
The wasm sdk version 0.1.1 had a structure
pub struct Token {
pub denom: String,
pub issuer: String,
pub symbol: String,
pub subunit: String,
pub precision: u32,
pub description: Option,
pub features: Option<Vec>,
pub burn_rate: String,
pub send_commission_rate: String,
}But the proto file includes a uint32 version = 6 at the end.
In the individual token test it does this before equaling:
wasmTokenRes.Token.Version = expectedToken.Version // test should work with any version
to make sure version is the same.If you want I can change it to validate everything and hardcode the version in the same way, I thought checking the denom looks more understandable to see that we receive the same token (all the fields are the same anyways).
I can change it if you want.
IMO better to set the version validate the entire struct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @dzmitryhil and @ysv)
integration-tests/modules/wasm_test.go
line 966 at r6 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
IMO better to set the version validate the entire struct.
Ok I'll change it.
integration-tests/modules/wasm_test.go
line 1565 at r6 (raw file):
Previously, dzmitryhil (Dzmitry Hil) wrote…
You can replace with
requireT.Contains(nftClass{ ID: expectedClass.Id, Name: expectedClass.Name, Symbol: expectedClass.Symbol, Description: expectedClass.Description, URI: expectedClass.URI, URIHash: expectedClass.URIHash, Data: dataString, }, nftClassesQueryRes.Classes)
I had a problem with this because it returned it in different orders (only happened with nft module)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 51 of 52 files reviewed, 2 unresolved discussions (waiting on @dzmitryhil, @miladz68, and @ysv)
integration-tests/modules/wasm_test.go
line 1565 at r6 (raw file):
Previously, keyleu (Keyne) wrote…
I had a problem with this because it returned it in different orders (only happened with nft module)
There were 3 classes in the array, and sometimes it would be in position 0, sometimes 1 and sometimes 2. So I just checked it was in there to ensure tests didn't fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 51 of 52 files reviewed, 2 unresolved discussions (waiting on @dzmitryhil, @miladz68, and @ysv)
integration-tests/modules/wasm_test.go
line 1565 at r6 (raw file):
Previously, keyleu (Keyne) wrote…
There were 3 classes in the array, and sometimes it would be in position 0, sometimes 1 and sometimes 2. So I just checked it was in there to ensure tests didn't fail.
Oh nevermind, you meant Contains. My mistake. Ok, will change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 51 of 52 files reviewed, all discussions resolved (waiting on @miladz68 and @ysv)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r8, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @ysv)
This change is