Skip to content

Commit

Permalink
deps: bumped to new merkle path
Browse files Browse the repository at this point in the history
  • Loading branch information
srdtrk committed Jun 26, 2024
1 parent 4ea8512 commit c50d068
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 9 deletions.
2 changes: 1 addition & 1 deletion e2e/interchaintestv8/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ require (
sigs.k8s.io/yaml v1.4.0 // indirect
)

replace github.com/cosmos/ibc-go/v8 => github.com/cosmos/ibc-go/v8 v8.0.0-beta.1.0.20240614115135-d9ec0c8c512d
replace github.com/cosmos/ibc-go/v8 => github.com/cosmos/ibc-go/v8 v8.0.0-beta.1.0.20240626084404-83f90bbd2580

replace github.com/strangelove-ventures/interchaintest/v8 => github.com/DimitrisJim/interchaintest/v8 v8.0.0-20240419095404-2c9270423b9a

Expand Down
4 changes: 2 additions & 2 deletions e2e/interchaintestv8/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,8 @@ github.com/cosmos/iavl v1.1.2 h1:zL9FK7C4L/P4IF1Dm5fIwz0WXCnn7Bp1M2FxH0ayM7Y=
github.com/cosmos/iavl v1.1.2/go.mod h1:jLeUvm6bGT1YutCaL2fIar/8vGUE8cPZvh/gXEWDaDM=
github.com/cosmos/ibc-go/modules/capability v1.0.0 h1:r/l++byFtn7jHYa09zlAdSeevo8ci1mVZNO9+V0xsLE=
github.com/cosmos/ibc-go/modules/capability v1.0.0/go.mod h1:D81ZxzjZAe0ZO5ambnvn1qedsFQ8lOwtqicG6liLBco=
github.com/cosmos/ibc-go/v8 v8.0.0-beta.1.0.20240614115135-d9ec0c8c512d h1:V9rWzyEvaqutctkhgDe2YDL8i2m0wrDQQBqb/1DqRNY=
github.com/cosmos/ibc-go/v8 v8.0.0-beta.1.0.20240614115135-d9ec0c8c512d/go.mod h1:1r6hWEhBg9a8bmWA3wtOeWhf86+9JkmXznLOoU0pCrY=
github.com/cosmos/ibc-go/v8 v8.0.0-beta.1.0.20240626084404-83f90bbd2580 h1:CXYlFz54SeXghW2RbhVRz/3zOBtV4AXjomsQlLSLOFM=
github.com/cosmos/ibc-go/v8 v8.0.0-beta.1.0.20240626084404-83f90bbd2580/go.mod h1:1r6hWEhBg9a8bmWA3wtOeWhf86+9JkmXznLOoU0pCrY=
github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM=
github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0=
github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM=
Expand Down
7 changes: 7 additions & 0 deletions e2e/interchaintestv8/ibclite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,13 @@ func (s *IBCLiteTestSuite) TestWasmProofs() {

// TODO: Can't finish this test because ibc-go does not have a way to verify proofs in wasm path:
// https://github.com/cosmos/ibc-go/issues/6496
s.Require().True(s.Run("Verify wasm proof", func() {
e2esuite.GRPCQuery[clienttypes.QueryVerifyMembershipResponse](ctx, wasmd, &clienttypes.QueryVerifyMembershipRequest{
ClientId: ibctesting.FirstClientID,
Proof: proof,
Value: value,
})
}))
}

func (s *IBCLiteTestSuite) UpdateClientContract(ctx context.Context, tmContract *ics07tendermint.Contract, counterpartyChain *cosmos.CosmosChain) {
Expand Down
9 changes: 5 additions & 4 deletions e2e/interchaintestv8/ics07tendermint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types"
commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types"
commitmenttypesv2 "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types/v2"
host "github.com/cosmos/ibc-go/v8/modules/core/24-host"
ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported"
ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint"
Expand Down Expand Up @@ -172,14 +173,14 @@ func (s *ICS07TendermintTestSuite) TestVerifyMembership() {
proofHeight int64
proof []byte
value []byte
merklePath commitmenttypes.MerklePath
merklePath commitmenttypesv2.MerklePath
)
s.Require().True(s.Run("CreateClientStateProof", func() {
s.UpdateClientContract(ctx, s.ics07Tendermint, simd)

var err error
key := host.FullClientStateKey(ibctesting.FirstClientID)
merklePath = commitmenttypes.NewMerklePath(string(key))
merklePath = commitmenttypes.NewMerklePath(key)
merklePath, err = commitmenttypes.ApplyPrefix(commitmenttypes.NewMerklePrefix([]byte(ibcexported.StoreKey)), merklePath)
s.Require().NoError(err)

Expand All @@ -200,7 +201,7 @@ func (s *ICS07TendermintTestSuite) TestVerifyMembership() {
RevisionHeight: int(proofHeight),
},
Path: ics07tendermint.MerklePath{
KeyPath: merklePath.KeyPath,
KeyPath: types.ToLegacyMerklePath(&merklePath).KeyPath,
},
Proof: base64.StdEncoding.EncodeToString(proof),
Value: base64.StdEncoding.EncodeToString(value),
Expand All @@ -217,7 +218,7 @@ func (s *ICS07TendermintTestSuite) TestVerifyMembership() {
RevisionHeight: int(proofHeight),
},
Path: ics07tendermint.MerklePath{
KeyPath: merklePath.KeyPath,
KeyPath: types.ToLegacyMerklePath(&merklePath).KeyPath,
},
Proof: base64.StdEncoding.EncodeToString(proof),
Value: base64.StdEncoding.EncodeToString(incorrectValue),
Expand Down
14 changes: 12 additions & 2 deletions e2e/interchaintestv8/types/storekeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"

commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types"
commitmenttypesv2 "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types/v2"
)

/*
Expand All @@ -23,8 +24,8 @@ func GetBankBalanceKey(address sdk.AccAddress, denom string) ([]byte, error) {
return key, nil
}

func ConvertToMerklePath(prefix []byte, key []byte) (*commitmenttypes.MerklePath, error) {
merklePath := commitmenttypes.NewMerklePath(string(key))
func ConvertToMerklePath(prefix []byte, key []byte) (*commitmenttypesv2.MerklePath, error) {
merklePath := commitmenttypes.NewMerklePath(key)
merklePrefix := commitmenttypes.NewMerklePrefix(prefix)
path, err := commitmenttypes.ApplyPrefix(merklePrefix, merklePath)
if err != nil {
Expand All @@ -33,3 +34,12 @@ func ConvertToMerklePath(prefix []byte, key []byte) (*commitmenttypes.MerklePath

return &path, nil
}

func ToLegacyMerklePath(path *commitmenttypesv2.MerklePath) *commitmenttypes.MerklePath {
legacyPath := commitmenttypes.MerklePath{}
for _, key := range path.KeyPath {
legacyPath.KeyPath = append(legacyPath.KeyPath, string(key))
}

return &legacyPath
}

0 comments on commit c50d068

Please sign in to comment.