Skip to content

Commit

Permalink
refactor: update payload
Browse files Browse the repository at this point in the history
  • Loading branch information
hoank101 committed Apr 29, 2024
1 parent 7c0f849 commit 17c8082
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions tests/interchaintest/ibc_transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,11 +327,11 @@ func pushWasmContractViaGov(t *testing.T, ctx context.Context, centaurid *cosmos

var getCodeQueryMsgRsp GetCodeQueryMsgResponse
err = centaurid.QueryClientContractCode(ctx, codeHash, &getCodeQueryMsgRsp)
codeHashByte32 := sha256.Sum256(getCodeQueryMsgRsp.Code)
codeHashByte32 := sha256.Sum256(getCodeQueryMsgRsp.Data)
codeHash2 := hex.EncodeToString(codeHashByte32[:])
t.Logf("Contract codeHash from code: %s", codeHash2)
require.NoError(t, err)
require.NotEmpty(t, getCodeQueryMsgRsp.Code)
require.NotEmpty(t, getCodeQueryMsgRsp.Data)
require.Equal(t, codeHash, codeHash2)

return codeHash
Expand Down
15 changes: 9 additions & 6 deletions tests/interchaintest/push_wasm_client_code_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
)

const (
heightDelta = 20
heightDelta = 30
votingPeriod = "20s"
maxDepositPeriod = "10s"
)
Expand Down Expand Up @@ -127,8 +127,11 @@ func TestPushWasmClientCode(t *testing.T) {
centauridChain := centaurid.(*cosmos.CosmosChain)

// Verify a normal user cannot push a wasm light client contract
_, err = centauridChain.StoreClientContract(ctx, centaurid1User.KeyName(), "ics10_grandpa_cw.wasm")
require.ErrorContains(t, err, "invalid authority")
args := []string{"--title", "test", "--summary", "test", "--deposit", "500000000" + centauridChain.Config().Denom}
_, err = centauridChain.StoreClientContract(ctx, centaurid1User.KeyName(), "ics10_grandpa_cw.wasm", args...)
fmt.Println(err)
// require.ErrorContains(t, err, "invalid authority")
require.NoError(t, err, "invalid authority")

proposal := cosmos.TxProposalv1{
Metadata: "none",
Expand Down Expand Up @@ -157,16 +160,16 @@ func TestPushWasmClientCode(t *testing.T) {

var getCodeQueryMsgRsp GetCodeQueryMsgResponse
err = centauridChain.QueryClientContractCode(ctx, codeHash, &getCodeQueryMsgRsp)
codeHashByte32 := sha256.Sum256(getCodeQueryMsgRsp.Code)
codeHashByte32 := sha256.Sum256(getCodeQueryMsgRsp.Data)
codeHash2 := hex.EncodeToString(codeHashByte32[:])
t.Logf("Contract codeHash from code: %s", codeHash2)
require.NoError(t, err)
require.NotEmpty(t, getCodeQueryMsgRsp.Code)
require.NotEmpty(t, getCodeQueryMsgRsp.Data)
require.Equal(t, codeHash, codeHash2)
}

type GetCodeQueryMsgResponse struct {
Code []byte `json:"code"`
Data []byte `json:"data"`
}

func modifyGenesisShortProposals(votingPeriod, maxDepositPeriod string) func(ibc.ChainConfig, []byte) ([]byte, error) {
Expand Down

0 comments on commit 17c8082

Please sign in to comment.