From 1626b4e94d69b5ae8213e9c557b0a05c86421502 Mon Sep 17 00:00:00 2001 From: Carlos Rodriguez Date: Thu, 28 Mar 2024 22:09:06 +0100 Subject: [PATCH 1/6] chore: mergify task for v7.4.x (#6057) --- .github/mergify.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/mergify.yml b/.github/mergify.yml index 9dc5f629663..2f2f92ef8d6 100644 --- a/.github/mergify.yml +++ b/.github/mergify.yml @@ -90,6 +90,14 @@ pull_request_rules: backport: branches: - release/v7.3.x + - name: backport patches to v7.4.x branch + conditions: + - base=main + - label=backport-to-v7.4.x + actions: + backport: + branches: + - release/v7.4.x - name: backport patches to v8.0.x branch conditions: - base=main From f049a23d8720d22b59ddfd9bb30ac95d836730af Mon Sep 17 00:00:00 2001 From: seayyyy <163325936+seay404@users.noreply.github.com> Date: Fri, 29 Mar 2024 20:00:36 +0800 Subject: [PATCH 2/6] doc:fix typo (#6071) --- .../version-v8.1.x/04-middleware/01-ics29-fee/03-msgs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/versioned_docs/version-v8.1.x/04-middleware/01-ics29-fee/03-msgs.md b/docs/versioned_docs/version-v8.1.x/04-middleware/01-ics29-fee/03-msgs.md index b6f503c0c3c..c9fe1df563b 100644 --- a/docs/versioned_docs/version-v8.1.x/04-middleware/01-ics29-fee/03-msgs.md +++ b/docs/versioned_docs/version-v8.1.x/04-middleware/01-ics29-fee/03-msgs.md @@ -35,7 +35,7 @@ type MsgPayPacketFee struct{ ``` The `Fee` message contained in this synchronous fee payment method configures different fees which will be paid out for `MsgRecvPacket`, `MsgAcknowledgement`, and `MsgTimeout`/`MsgTimeoutOnClose`. -The amount of fees escrowed in total is the denomwise maxiumum of `RecvFee + AckFee` and `TimeoutFee`. This is because we do not know whether the packet will be successfully received and acknowledged or whether it will timeout. +The amount of fees escrowed in total is the denomwise maximum of `RecvFee + AckFee` and `TimeoutFee`. This is because we do not know whether the packet will be successfully received and acknowledged or whether it will timeout. ```go type Fee struct { From c374041dd36205fe081f4d61443f1505ab665737 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 29 Mar 2024 14:16:47 +0200 Subject: [PATCH 3/6] build(deps): Bump tj-actions/changed-files from 43 to 44 (#6066) Bumps [tj-actions/changed-files](https://github.com/tj-actions/changed-files) from 43 to 44. - [Release notes](https://github.com/tj-actions/changed-files/releases) - [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md) - [Commits](https://github.com/tj-actions/changed-files/compare/v43...v44) --- updated-dependencies: - dependency-name: tj-actions/changed-files dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Carlos Rodriguez --- .github/workflows/markdown-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/markdown-lint.yml b/.github/workflows/markdown-lint.yml index 61ffc74d33b..a620e700055 100644 --- a/.github/workflows/markdown-lint.yml +++ b/.github/workflows/markdown-lint.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: tj-actions/changed-files@v43 + - uses: tj-actions/changed-files@v44 id: changed-files with: files: '**/*.md' From beaee162ffa56e34c51fbf3453f3ceec1991e8b5 Mon Sep 17 00:00:00 2001 From: carehabit <165479941+carehabit@users.noreply.github.com> Date: Mon, 1 Apr 2024 02:44:24 +0800 Subject: [PATCH 4/6] chore: remove repetitive words (#6072) --- .../03-light-clients/03-localhost/03-client-state.md | 2 +- e2e/testsuite/codec.go | 2 +- modules/apps/29-fee/ica_test.go | 2 +- modules/apps/transfer/client/cli/query.go | 2 +- modules/apps/transfer/keeper/relay.go | 2 +- modules/capability/capability_test.go | 2 +- modules/light-clients/06-solomachine/proof.go | 2 +- modules/light-clients/08-wasm/keeper/msg_server_test.go | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/versioned_docs/version-v7.3.x/03-light-clients/03-localhost/03-client-state.md b/docs/versioned_docs/version-v7.3.x/03-light-clients/03-localhost/03-client-state.md index 5f0a990412e..19e03b62aa9 100644 --- a/docs/versioned_docs/version-v7.3.x/03-light-clients/03-localhost/03-client-state.md +++ b/docs/versioned_docs/version-v7.3.x/03-light-clients/03-localhost/03-client-state.md @@ -47,7 +47,7 @@ func BeginBlocker(ctx sdk.Context, k keeper.Keeper) { } ``` -The above calls into the the 09-localhost `UpdateState` method of the `ClientState` . +The above calls into the 09-localhost `UpdateState` method of the `ClientState` . It retrieves the current block height from the application context and sets the `LatestHeight` of the 09-localhost client. ```go diff --git a/e2e/testsuite/codec.go b/e2e/testsuite/codec.go index ca08e41c491..42f790a78e6 100644 --- a/e2e/testsuite/codec.go +++ b/e2e/testsuite/codec.go @@ -109,7 +109,7 @@ func UnmarshalMsgResponses(txResp sdk.TxResponse, msgs ...codec.ProtoMarshaler) // MustProtoMarshalJSON provides an auxiliary function to return Proto3 JSON encoded // bytes of a message. This function should be used when marshalling a proto.Message // from the e2e tests. This function strips out unknown fields. This is useful for -// backwards compatibility tests where the the types imported by the e2e package have +// backwards compatibility tests where the types imported by the e2e package have // new fields that older versions do not recognize. func MustProtoMarshalJSON(msg proto.Message) []byte { anyResolver := codectypes.NewInterfaceRegistry() diff --git a/modules/apps/29-fee/ica_test.go b/modules/apps/29-fee/ica_test.go index a7f45fb4af6..b31ed816a21 100644 --- a/modules/apps/29-fee/ica_test.go +++ b/modules/apps/29-fee/ica_test.go @@ -65,7 +65,7 @@ func SetupPath(path *ibctesting.Path, owner string) error { return path.EndpointB.ChanOpenConfirm() } -// RegisterInterchainAccount invokes the the InterchainAccounts entrypoint, routes a new MsgChannelOpenInit to the appropriate handler, +// RegisterInterchainAccount invokes the InterchainAccounts entrypoint, routes a new MsgChannelOpenInit to the appropriate handler, // commits state changes and updates the testing endpoint accordingly func RegisterInterchainAccount(endpoint *ibctesting.Endpoint, owner string) error { portID, err := icatypes.NewControllerPortID(owner) diff --git a/modules/apps/transfer/client/cli/query.go b/modules/apps/transfer/client/cli/query.go index 82d05cda2f7..20faa97cdb3 100644 --- a/modules/apps/transfer/client/cli/query.go +++ b/modules/apps/transfer/client/cli/query.go @@ -12,7 +12,7 @@ import ( "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" ) -// GetCmdQueryDenomTrace defines the command to query a a denomination trace from a given trace hash or ibc denom. +// GetCmdQueryDenomTrace defines the command to query a denomination trace from a given trace hash or ibc denom. func GetCmdQueryDenomTrace() *cobra.Command { cmd := &cobra.Command{ Use: "denom-trace [hash/denom]", diff --git a/modules/apps/transfer/keeper/relay.go b/modules/apps/transfer/keeper/relay.go index 43ff4de572a..3bae0b9da03 100644 --- a/modules/apps/transfer/keeper/relay.go +++ b/modules/apps/transfer/keeper/relay.go @@ -307,7 +307,7 @@ func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, data t return nil } -// OnAcknowledgementPacket responds to the the success or failure of a packet +// OnAcknowledgementPacket responds to the success or failure of a packet // acknowledgement written on the receiving chain. If the acknowledgement // was a success then nothing occurs. If the acknowledgement failed, then // the sender is refunded their tokens using the refundPacketToken function. diff --git a/modules/capability/capability_test.go b/modules/capability/capability_test.go index 01c627db652..72fae13e3e8 100644 --- a/modules/capability/capability_test.go +++ b/modules/capability/capability_test.go @@ -81,7 +81,7 @@ func (suite *CapabilityTestSuite) TestInitializeMemStore() { newKeeper := keeper.NewKeeper(suite.cdc, suite.storeKey, suite.mockMemStoreKey) newModule := capability.NewAppModule(suite.cdc, *newKeeper, true) - // reassign the scoped keeper, this will inherit the the mock memstore key used above + // reassign the scoped keeper, this will inherit the mock memstore key used above scopedKeeper = newKeeper.ScopeToModule(banktypes.ModuleName) // seal the new keeper and ensure the in-memory store is not initialized diff --git a/modules/light-clients/06-solomachine/proof.go b/modules/light-clients/06-solomachine/proof.go index f156e353408..6b347e112a5 100644 --- a/modules/light-clients/06-solomachine/proof.go +++ b/modules/light-clients/06-solomachine/proof.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/types/tx/signing" ) -// VerifySignature verifies if the the provided public key generated the signature +// VerifySignature verifies if the provided public key generated the signature // over the given data. Single and Multi signature public keys are supported. // The signature data type must correspond to the public key type. An error is // returned if signature verification fails or an invalid SignatureData type is diff --git a/modules/light-clients/08-wasm/keeper/msg_server_test.go b/modules/light-clients/08-wasm/keeper/msg_server_test.go index b3b67b1996e..4df1a808cc5 100644 --- a/modules/light-clients/08-wasm/keeper/msg_server_test.go +++ b/modules/light-clients/08-wasm/keeper/msg_server_test.go @@ -63,7 +63,7 @@ func (suite *KeeperTestSuite) TestMsgStoreCode() { func() { msg = types.NewMsgStoreCode(signer, []byte{0, 1, 3, 4}) }, - errors.New("Wasm bytes do not not start with Wasm magic number"), + errors.New("Wasm bytes do not start with Wasm magic number"), }, { "fails with wasm code too large", From 3fbd2dfb5e42dc1cc2c8bb7bb0ff654f13874760 Mon Sep 17 00:00:00 2001 From: Nikolas De Giorgis Date: Mon, 1 Apr 2024 13:33:07 +0100 Subject: [PATCH 5/6] chore: add gRPC validation for 04-channel (#6064) * Add missing gRPC validation and tests. * Update modules/core/04-channel/keeper/grpc_query_test.go Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Run go fmt * Add test for invalid ID. * Go fmt * Update modules/core/04-channel/keeper/grpc_query_test.go Co-authored-by: Carlos Rodriguez * Update modules/core/04-channel/keeper/grpc_query_test.go Co-authored-by: Carlos Rodriguez --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Carlos Rodriguez Co-authored-by: DimitrisJim --- modules/core/04-channel/keeper/grpc_query.go | 37 ++++++++ .../core/04-channel/keeper/grpc_query_test.go | 84 +++++++++++++++---- 2 files changed, 103 insertions(+), 18 deletions(-) diff --git a/modules/core/04-channel/keeper/grpc_query.go b/modules/core/04-channel/keeper/grpc_query.go index 130edbc9614..d23d3ad3545 100644 --- a/modules/core/04-channel/keeper/grpc_query.go +++ b/modules/core/04-channel/keeper/grpc_query.go @@ -217,6 +217,13 @@ func (k Keeper) PacketCommitment(c context.Context, req *types.QueryPacketCommit ctx := sdk.UnwrapSDKContext(c) + if !k.HasChannel(ctx, req.PortId, req.ChannelId) { + return nil, status.Error( + codes.NotFound, + errorsmod.Wrapf(types.ErrChannelNotFound, "port ID (%s) channel ID (%s)", req.PortId, req.ChannelId).Error(), + ) + } + commitmentBz := k.GetPacketCommitment(ctx, req.PortId, req.ChannelId, req.Sequence) if len(commitmentBz) == 0 { return nil, status.Error(codes.NotFound, "packet commitment hash not found") @@ -238,6 +245,12 @@ func (k Keeper) PacketCommitments(c context.Context, req *types.QueryPacketCommi ctx := sdk.UnwrapSDKContext(c) + if !k.HasChannel(ctx, req.PortId, req.ChannelId) { + return nil, status.Error( + codes.NotFound, + errorsmod.Wrapf(types.ErrChannelNotFound, "port ID (%s) channel ID (%s)", req.PortId, req.ChannelId).Error(), + ) + } var commitments []*types.PacketState store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(host.PacketCommitmentPrefixPath(req.PortId, req.ChannelId))) @@ -281,6 +294,12 @@ func (k Keeper) PacketReceipt(c context.Context, req *types.QueryPacketReceiptRe ctx := sdk.UnwrapSDKContext(c) + if !k.HasChannel(ctx, req.PortId, req.ChannelId) { + return nil, status.Error( + codes.NotFound, + errorsmod.Wrapf(types.ErrChannelNotFound, "port ID (%s) channel ID (%s)", req.PortId, req.ChannelId).Error(), + ) + } _, recvd := k.GetPacketReceipt(ctx, req.PortId, req.ChannelId, req.Sequence) selfHeight := clienttypes.GetSelfHeight(ctx) @@ -303,6 +322,12 @@ func (k Keeper) PacketAcknowledgement(c context.Context, req *types.QueryPacketA ctx := sdk.UnwrapSDKContext(c) + if !k.HasChannel(ctx, req.PortId, req.ChannelId) { + return nil, status.Error( + codes.NotFound, + errorsmod.Wrapf(types.ErrChannelNotFound, "port ID (%s) channel ID (%s)", req.PortId, req.ChannelId).Error(), + ) + } acknowledgementBz, found := k.GetPacketAcknowledgement(ctx, req.PortId, req.ChannelId, req.Sequence) if !found || len(acknowledgementBz) == 0 { return nil, status.Error(codes.NotFound, "packet acknowledgement hash not found") @@ -324,6 +349,12 @@ func (k Keeper) PacketAcknowledgements(c context.Context, req *types.QueryPacket ctx := sdk.UnwrapSDKContext(c) + if !k.HasChannel(ctx, req.PortId, req.ChannelId) { + return nil, status.Error( + codes.NotFound, + errorsmod.Wrapf(types.ErrChannelNotFound, "port ID (%s) channel ID (%s)", req.PortId, req.ChannelId).Error(), + ) + } var acks []*types.PacketState store := prefix.NewStore(ctx.KVStore(k.storeKey), []byte(host.PacketAcknowledgementPrefixPath(req.PortId, req.ChannelId))) @@ -486,6 +517,12 @@ func (k Keeper) UnreceivedAcks(c context.Context, req *types.QueryUnreceivedAcks ctx := sdk.UnwrapSDKContext(c) + if !k.HasChannel(ctx, req.PortId, req.ChannelId) { + return nil, status.Error( + codes.NotFound, + errorsmod.Wrapf(types.ErrChannelNotFound, "port ID (%s) channel ID (%s)", req.PortId, req.ChannelId).Error(), + ) + } var unreceivedSequences []uint64 for i, seq := range req.PacketAckSequences { diff --git a/modules/core/04-channel/keeper/grpc_query_test.go b/modules/core/04-channel/keeper/grpc_query_test.go index 8dd89e1384e..0b9454141a1 100644 --- a/modules/core/04-channel/keeper/grpc_query_test.go +++ b/modules/core/04-channel/keeper/grpc_query_test.go @@ -663,6 +663,31 @@ func (suite *KeeperTestSuite) TestQueryPacketCommitment() { }, false, }, + { + "commitment not found", + func() { + path := ibctesting.NewPath(suite.chainA, suite.chainB) + path.Setup() + expCommitment = []byte("hash") + suite.chainA.App.GetIBCKeeper().ChannelKeeper.SetPacketCommitment(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, 1, expCommitment) + req = &types.QueryPacketCommitmentRequest{ + PortId: path.EndpointA.ChannelConfig.PortID, + ChannelId: path.EndpointA.ChannelID, + Sequence: 2, + } + }, + false, + }, + { + "invalid ID", + func() { + req = &types.QueryPacketCommitmentRequest{ + PortId: "", + ChannelId: "test-channel-id", + } + }, + false, + }, { "success", func() { @@ -732,21 +757,14 @@ func (suite *KeeperTestSuite) TestQueryPacketCommitments() { false, }, { - "success, empty res", + "channel not found", func() { - expCommitments = []*types.PacketState(nil) - req = &types.QueryPacketCommitmentsRequest{ PortId: "test-port-id", ChannelId: "test-channel-id", - Pagination: &query.PageRequest{ - Key: nil, - Limit: 2, - CountTotal: true, - }, } }, - true, + false, }, { "success", @@ -849,6 +867,17 @@ func (suite *KeeperTestSuite) TestQueryPacketReceipt() { }, false, }, + { + "channel not found", + func() { + req = &types.QueryPacketReceiptRequest{ + PortId: "test-port-id", + ChannelId: "test-channel-id", + Sequence: 1, + } + }, + false, + }, { "success: receipt not found", func() { @@ -956,6 +985,22 @@ func (suite *KeeperTestSuite) TestQueryPacketAcknowledgement() { }, false, }, + { + "ack not found", + func() { + path := ibctesting.NewPath(suite.chainA, suite.chainB) + path.Setup() + expAck = []byte("hash") + suite.chainA.App.GetIBCKeeper().ChannelKeeper.SetPacketAcknowledgement(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, 1, expAck) + + req = &types.QueryPacketAcknowledgementRequest{ + PortId: path.EndpointA.ChannelConfig.PortID, + ChannelId: path.EndpointA.ChannelID, + Sequence: 2, + } + }, + false, + }, { "channel not found", func() { @@ -1036,21 +1081,14 @@ func (suite *KeeperTestSuite) TestQueryPacketAcknowledgements() { false, }, { - "success, empty res", + "channel not found", func() { - expAcknowledgements = []*types.PacketState(nil) - req = &types.QueryPacketAcknowledgementsRequest{ PortId: "test-port-id", ChannelId: "test-channel-id", - Pagination: &query.PageRequest{ - Key: nil, - Limit: 2, - CountTotal: true, - }, } }, - true, + false, }, { "success, filtered res", @@ -1398,6 +1436,16 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedAcks() { }, false, }, + { + "channel not found", + func() { + req = &types.QueryUnreceivedAcksRequest{ + PortId: "test-port-id", + ChannelId: "test-channel-id", + } + }, + false, + }, { "invalid seq", func() { From d23a21f52d4ed39304f78396fc09e8bdd97c967c Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Tue, 2 Apr 2024 11:18:01 +0200 Subject: [PATCH 6/6] fix: failing test in 08-wasm expected err value (#6073) --- modules/light-clients/08-wasm/keeper/msg_server_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/light-clients/08-wasm/keeper/msg_server_test.go b/modules/light-clients/08-wasm/keeper/msg_server_test.go index 4df1a808cc5..b3b67b1996e 100644 --- a/modules/light-clients/08-wasm/keeper/msg_server_test.go +++ b/modules/light-clients/08-wasm/keeper/msg_server_test.go @@ -63,7 +63,7 @@ func (suite *KeeperTestSuite) TestMsgStoreCode() { func() { msg = types.NewMsgStoreCode(signer, []byte{0, 1, 3, 4}) }, - errors.New("Wasm bytes do not start with Wasm magic number"), + errors.New("Wasm bytes do not not start with Wasm magic number"), }, { "fails with wasm code too large",