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

chore: fix wasm client tests #4613

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions modules/light-clients/08-wasm/keeper/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (suite *KeeperTestSuite) TestInitGenesis() {
{
"success",
func() {
codeHash := "c64f75091a6195b036f472cd8c9f19a56780b9eac3c3de7ced0ec2e29e985b64"
codeHash := "9b18dc4aa6a4dc6183f148bdcadbf7d3de2fdc7aac59394f1589b81e77de5e3c"
contractCode, err := os.ReadFile("../test_data/ics07_tendermint_cw.wasm.gz")
suite.Require().NoError(err)

Expand Down Expand Up @@ -70,7 +70,7 @@ func (suite *KeeperTestSuite) TestExportGenesis() {
suite.SetupTest()
ctx := suite.chainA.GetContext()

expCodeHash := "c64f75091a6195b036f472cd8c9f19a56780b9eac3c3de7ced0ec2e29e985b64"
expCodeHash := "9b18dc4aa6a4dc6183f148bdcadbf7d3de2fdc7aac59394f1589b81e77de5e3c"

signer := authtypes.NewModuleAddress(govtypes.ModuleName).String()
contractCode, err := os.ReadFile("../test_data/ics07_tendermint_cw.wasm.gz")
Expand Down
59 changes: 59 additions & 0 deletions modules/light-clients/08-wasm/test_data/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
How to regenerate grandpa test data

Note: this is a general outline of the process and the actions to take are dependent on the changes that were implemented. The changes could be from any of the following: ibc-go, hyperspace, parachain, polkadot, grandpa light client contract, heighliner, or interchaintest.

1. Make your code changes
2. Build local docker images for the e2e test with all modifications
1. ibc-go-simd
1. heighliner build -c ibc-go-simd -g local --local
2. hyperspace
1. Repo: ComposableFi/centauri
2. Commit: fce2d6303cc111c8b5f2aa47b2fba3dc61a79bf2
3. Build local Hyperspace docker from centauri repo:
4. amd64: "docker build -f scripts/hyperspace.Dockerfile -t hyperspace:local ."
5. arm64: "docker build -f scripts/hyperspace.aarch64.Dockerfile -t hyperspace:latest --platform=linux/arm64/v8 .
3. parachain
1. Repo: ComposableFi/centauri
2. Commit: fce2d6303cc111c8b5f2aa47b2fba3dc61a79bf2
3. Build local parachain docker from centauri repo:
4. ./scripts/build-parachain-node-docker.sh (you can change the script to compile for ARM arch if needed)
4. polkadot
1. Repo: paritytech/polkadot
2. Branch: release-v0.9.39
3. Commit: dc25abc712e42b9b51d87ad1168e453a42b5f0bc
4. Build local polkadot docker from polkadot repo
5. amd64: docker build -f scripts/ci/dockerfiles/polkadot/polkadot_builder.Dockerfile . -t polkadot-node:local
6. arm64: docker build --platform linux/arm64 -f scripts/ci/dockerfiles/polkadot/polkadot_builder.aarch64.Dockerfile . -t polkadot-node:local
3. If needed, build new ics10_grandpa_cw.wasm and place in examples/polkadot of interchaintest
1. RUSTFLAGS='-C link-arg=-s' cargo build -p ics10-grandpa-cw --target=wasm32-unknown-unknown --release --lib
4. Run hyperspace interchaintest
1. Use this commit from strangelove-ventures/interchaintest: f02d3adab099e360f81bfd25f3429f69209d6660
2. From the hyperspace_test.go file, make sure the version/tags of ibc-go-simd, hyperspace, parachain, and polkadot match what you used.
3. go test -v -timeout 20m -run ^TestHyperspace$ examples/hyperspace/hyperspace_test.go -count=1
5. Test should pass, if not, it needs to be fixed
6. The output will include the ibc-go-simd exported state with the height it was taken at. Pull the exported state into the wasm light client's genesis json (optionally, format it nicely). Warning, it is large.
7. Open a SQLite brower with ~/.interchaintest/databases/block.db, execute: "SELECT test_case_name, chain_id, block_height, msg_n, type, raw FROM v_cosmos_messages WHERE test_case_id=(SELECT MAX(id) from test_case);". You will pull various base64 encoded strings from these messages along with other data like heights the message/states are associated with.
8. Populate data.json and update test cases, for example:
1. TestVerifyMembershipGrandpa
1. successful ClientState verification
1. client_state_proof is pulled from MsgConnectionOpenAck message
2. if necessary, update baseline test's delayTimePeriod, delayBlockPeriod, proofHeight, LatestHeight of ClientState
2. successful Connection verification
1. connection_proof_try is pulled from MsgConnectionOpenAck message
2. if necessary, update test case's proof height and delay period
3. successful Channel verification
1. channel_proof_try is pulled from MsgChannelOpenAck message
2. if necessary, update proof height
4. successful PacketCommitment verification
1. packet_commitment_date and packet_commitment_proof is pulled from the first MsgRecvPacket message
2. if necessary, update proof height and sequence #
5. successful Acknowledgement verification
1. ack_data, ack_proof, and ack are
2. if necessary, update
2. TestInitializeGrandpa
1. client_state_data and consensus_state_data is pulled from MsgCreateClient message
3. TestStatusGrandpa
1. Delete consensus state 36 from genesis.json if it is there. Hopefully, no other tests require it either...
4. TestVerifyHeaderGrandpa
1. header is pulled from the MsgUpdateClient immediately after the exported state height
Then, run the grandpa-specific tests and debug from there!
Loading
Loading