diff --git a/.github/ISSUE_TEMPLATE/release-tracker.md b/.github/ISSUE_TEMPLATE/release-tracker.md index e4ae04f37a5..8b9a070ba87 100644 --- a/.github/ISSUE_TEMPLATE/release-tracker.md +++ b/.github/ISSUE_TEMPLATE/release-tracker.md @@ -53,8 +53,8 @@ versions of ibc-go to guarantee that no regression is introduced --> - [ ] Update the table of supported release lines (and End of Life dates) in [`RELEASES.md`](https://github.com/cosmos/ibc-go/blob/main/RELEASES.md). - [ ] Update [version matrix](https://github.com/cosmos/ibc-go/blob/main/RELEASES.md#version-matrix) in `RELEASES.md`. - [ ] Update docs site: - - [ ] Add new release branch to [`docs/versions`](https://github.com/cosmos/ibc-go/blob/main/docs/versions) file. - - [ ] Add `label` and `key` to `versions` array in [`config.js`](https://github.com/cosmos/ibc-go/blob/main/docs/.vuepress/config.js#L33). + - [ ] Add new release branch to `docs/versions` file. + - [ ] Add `label` and `key` to `versions` array in `config.js`. - [ ] After changes to docs site are deployed, check [ibc.cosmos.network](https://ibc.cosmos.network) is updated. ____ diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index c517591a095..d3168f471e8 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -43,7 +43,7 @@ write a little note why. - [ ] Targeted PR against correct branch (see [CONTRIBUTING.md](https://github.com/cosmos/ibc-go/blob/master/CONTRIBUTING.md#pr-targeting)). - [ ] Linked to Github issue with discussion and accepted design OR link to spec that describes this work. -- [ ] Code follows the [module structure standards](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/building-modules/10-structure.md). +- [ ] Code follows the [module structure standards](https://github.com/cosmos/cosmos-sdk/blob/main/docs/build/building-modules/11-structure.md). - [ ] Wrote unit and integration [tests](https://github.com/cosmos/ibc-go/blob/master/CONTRIBUTING.md#testing). - [ ] Updated relevant documentation (`docs/`) or specification (`x//spec/`). - [ ] Added relevant `godoc` [comments](https://blog.golang.org/godoc-documenting-go-code). diff --git a/.github/workflows/golangci.yml b/.github/workflows/golangci.yml index ae9545c2df4..61785075683 100644 --- a/.github/workflows/golangci.yml +++ b/.github/workflows/golangci.yml @@ -22,5 +22,5 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v3.2.0 with: - version: latest + version: v1.51.2 args: --timeout 5m \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 06b11e26d46..5edc1f40272 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,4 +51,5 @@ jobs: context: . push: true tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + build-args: | + IBC_GO_VERSION="${{ github.ref_name }}" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dabb6af1178..70a8a93bbb1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -52,6 +52,13 @@ jobs: - name: Build run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false make build + docker-build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Docker Build + run: docker build . --no-cache --build-arg IBC_GO_VERSION=v6.1.0 + split-test-files: runs-on: ubuntu-latest steps: diff --git a/.golangci.yml b/.golangci.yml index 19c59963c96..b4810914d79 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -33,6 +33,12 @@ linters: issues: exclude-rules: + - text: "is unused for linter" + linters: + - nolintlint + - text: "SA1019:" + linters: + - staticcheck - text: "Use of weak random number generator" linters: - gosec diff --git a/CHANGELOG.md b/CHANGELOG.md index 233c0e0b1df..80ac8eaa5c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,33 @@ Ref: https://keepachangelog.com/en/1.0.0/ # Changelog +## [[Unreleased]] + +### Dependencies + +### API Breaking + +### State Machine Breaking + +### Improvements + +### Features + +### Bug Fixes + +## [v6.1.2](https://github.com/cosmos/ibc-go/releases/tag/v6.1.2) - 2023-10-20 + +### Bug Fixes + +* (apps/transfer) [\#3045](https://github.com/cosmos/ibc-go/pull/3045) allow value with slashes in URL template for `denom_traces` and `denom_hashes` queries. +* (apps/transfer) [\#4709](https://github.com/cosmos/ibc-go/pull/4709) Order query service RPCs to fix availability of denom traces endpoint when no args are provided. + +## [v6.1.1](https://github.com/cosmos/ibc-go/releases/tag/v6.1.1) - 2023-05-25 + +### Bug Fixes + +* [\#3346](https://github.com/cosmos/ibc-go/pull/3346) Properly handle ordered channels in `UnreceivedPackets` query. + ## [v6.1.0](https://github.com/cosmos/ibc-go/releases/tag/v6.1.0) - 2022-12-20 ### Dependencies diff --git a/Dockerfile b/Dockerfile index a193f54906e..83ce2c09e10 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,13 @@ -FROM golang:1.18 as builder +FROM golang:1.19 as builder + +ARG IBC_GO_VERSION ENV GOPATH="" ENV GOMODULE="on" +# ensure the ibc go version is being specified for this image. +RUN test -n "${IBC_GO_VERSION}" + COPY go.mod . COPY go.sum . @@ -14,9 +19,14 @@ ADD LICENSE LICENSE COPY Makefile . + RUN make build -FROM ubuntu:20.04 +FROM ubuntu:22.04 + +ARG IBC_GO_VERSION + +LABEL "org.cosmos.ibc-go" "${IBC_GO_VERSION}" COPY --from=builder /go/build/simd /bin/simd diff --git a/docs/apps/interchain-accounts/messages.md b/docs/apps/interchain-accounts/messages.md index 125a0203f8b..ecbad8ad187 100644 --- a/docs/apps/interchain-accounts/messages.md +++ b/docs/apps/interchain-accounts/messages.md @@ -68,6 +68,6 @@ The packet `Sequence` is returned in the message response. ## Atomicity -As the Interchain Accounts module supports the execution of multiple transactions using the Cosmos SDK `Msg` interface, it provides the same atomicity guarantees as Cosmos SDK-based applications, leveraging the [`CacheMultiStore`](https://docs.cosmos.network/main/core/store.html#cachemultistore) architecture provided by the [`Context`](https://docs.cosmos.network/main/core/context.html) type. +As the Interchain Accounts module supports the execution of multiple transactions using the Cosmos SDK `Msg` interface, it provides the same atomicity guarantees as Cosmos SDK-based applications, leveraging the [`CacheMultiStore`](https://docs.cosmos.network/main/learn/advanced/store#cachemultistore) architecture provided by the [`Context`](https://docs.cosmos.network/main/learn/advanced/context.html) type. This provides atomic execution of transactions when using Interchain Accounts, where state changes are only committed if all `Msg`s succeed. diff --git a/docs/apps/interchain-accounts/transactions.md b/docs/apps/interchain-accounts/transactions.md new file mode 100644 index 00000000000..9e23aceb7df --- /dev/null +++ b/docs/apps/interchain-accounts/transactions.md @@ -0,0 +1,21 @@ + + +# Transactions + +Learn about Interchain Accounts transaction execution {synopsis} + +## Executing a transaction + +As described in [Authentication Modules](./auth-modules.md#trysendtx) transactions are executed using the interchain accounts controller API and require a `Base Application` as outlined in [ICS30 IBC Middleware](https://github.com/cosmos/ibc/tree/master/spec/app/ics-030-middleware) to facilitate authentication. The method of authentication remains unspecified to provide flexibility for the authentication module developer. + +Transactions are executed via the ICS27 [`SendTx` API](./auth-modules.md#trysendtx). This must be invoked through an Interchain Accounts authentication module and follows the outlined path of execution below. Packet relaying semantics provided by the IBC core transport, authentication, and ordering (IBC/TAO) layer are omitted for brevity. + +![send-tx-flow](../../assets/send-interchain-tx.png "Transaction Execution") + +## Atomicity + +As the Interchain Accounts module supports the execution of multiple transactions using the Cosmos SDK `Msg` interface, it provides the same atomicity guarantees as Cosmos SDK-based applications, leveraging the [`CacheMultiStore`](https://docs.cosmos.network/main/learn/advanced/store#cachemultistore) architecture provided by the [`Context`](https://docs.cosmos.network/main/learn/advanced/context.html) type. + +This provides atomic execution of transactions when using Interchain Accounts, where state changes are only committed if all `Msg`s succeed. diff --git a/docs/apps/transfer/metrics.md b/docs/apps/transfer/metrics.md index 7d83b08eb13..89c0b96a8ca 100644 --- a/docs/apps/transfer/metrics.md +++ b/docs/apps/transfer/metrics.md @@ -4,7 +4,7 @@ order: 6 # Metrics -The IBC transfer application module exposes the following set of [metrics](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/core/09-telemetry.md). +The IBC transfer application module exposes the following set of [metrics](https://github.com/cosmos/cosmos-sdk/blob/main/docs/learn/advanced/09-telemetry.md). | Metric | Description | Unit | Type | |:--------------------------------|:------------------------------------------------------------------------------------------|:----------------|:--------| diff --git a/docs/ibc/apps.md b/docs/ibc/apps.md index 2993fc1603c..7ffa83e62d7 100644 --- a/docs/ibc/apps.md +++ b/docs/ibc/apps.md @@ -486,4 +486,4 @@ callbacks](https://github.com/cosmos/ibc-go/blob/main/modules/apps/transfer/ibc_ ## Next {hide} -Learn about [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/building-modules/01-intro.md) {hide} +Learn about [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/build/building-modules/00-intro.md) {hide} diff --git a/docs/ibc/apps/apps.md b/docs/ibc/apps/apps.md index 86a53e6f94b..7798c903b6c 100644 --- a/docs/ibc/apps/apps.md +++ b/docs/ibc/apps/apps.md @@ -48,4 +48,4 @@ callbacks](https://github.com/cosmos/ibc-go/blob/main/modules/apps/transfer/ibc_ ## Next {hide} -Learn about [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/building-modules/01-intro.md) {hide} +Learn about [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/build/building-modules/00-intro.md) {hide} diff --git a/docs/ibc/integration.md b/docs/ibc/integration.md index d985986f3fd..d0827f077c3 100644 --- a/docs/ibc/integration.md +++ b/docs/ibc/integration.md @@ -139,7 +139,7 @@ func NewApp(...args) *App { ### Module Managers -In order to use IBC, we need to add the new modules to the module `Manager` and to the `SimulationManager` in case your application supports [simulations](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/building-modules/13-simulator.md). +In order to use IBC, we need to add the new modules to the module `Manager` and to the `SimulationManager` in case your application supports [simulations](https://github.com/cosmos/cosmos-sdk/blob/main/docs/build/building-modules/14-simulator.md). ```go // app.go diff --git a/docs/ibc/overview.md b/docs/ibc/overview.md index 588580f0931..3ccc54ec8ee 100644 --- a/docs/ibc/overview.md +++ b/docs/ibc/overview.md @@ -136,7 +136,7 @@ Proofs are passed from core IBC to light-clients as bytes. It is up to light cli [ICS-24 Host State Machine Requirements](https://github.com/cosmos/ics/tree/master/spec/core/ics-024-host-requirements). - The proof format that all implementations must be able to produce and verify is defined in [ICS-23 Proofs](https://github.com/confio/ics23) implementation. -### [Capabilities](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/core/10-ocap.md) +### [Capabilities](https://github.com/cosmos/cosmos-sdk/blob/main/docs/learn/advanced/10-ocap.md) IBC is intended to work in execution environments where modules do not necessarily trust each other. Thus, IBC must authenticate module actions on ports and channels so that only modules with the diff --git a/docs/ibc/proto-docs.md b/docs/ibc/proto-docs.md index 052be9fff4e..6a548d4c3f9 100644 --- a/docs/ibc/proto-docs.md +++ b/docs/ibc/proto-docs.md @@ -2216,10 +2216,10 @@ Query provides defines the gRPC querier service. | Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | | ----------- | ------------ | ------------- | ------------| ------- | -------- | -| `DenomTrace` | [QueryDenomTraceRequest](#ibc.applications.transfer.v1.QueryDenomTraceRequest) | [QueryDenomTraceResponse](#ibc.applications.transfer.v1.QueryDenomTraceResponse) | DenomTrace queries a denomination trace information. | GET|/ibc/apps/transfer/v1/denom_traces/{hash}| | `DenomTraces` | [QueryDenomTracesRequest](#ibc.applications.transfer.v1.QueryDenomTracesRequest) | [QueryDenomTracesResponse](#ibc.applications.transfer.v1.QueryDenomTracesResponse) | DenomTraces queries all denomination traces. | GET|/ibc/apps/transfer/v1/denom_traces| +| `DenomTrace` | [QueryDenomTraceRequest](#ibc.applications.transfer.v1.QueryDenomTraceRequest) | [QueryDenomTraceResponse](#ibc.applications.transfer.v1.QueryDenomTraceResponse) | DenomTrace queries a denomination trace information. | GET|/ibc/apps/transfer/v1/denom_traces/{hash=**}| | `Params` | [QueryParamsRequest](#ibc.applications.transfer.v1.QueryParamsRequest) | [QueryParamsResponse](#ibc.applications.transfer.v1.QueryParamsResponse) | Params queries all parameters of the ibc-transfer module. | GET|/ibc/apps/transfer/v1/params| -| `DenomHash` | [QueryDenomHashRequest](#ibc.applications.transfer.v1.QueryDenomHashRequest) | [QueryDenomHashResponse](#ibc.applications.transfer.v1.QueryDenomHashResponse) | DenomHash queries a denomination hash information. | GET|/ibc/apps/transfer/v1/denom_hashes/{trace}| +| `DenomHash` | [QueryDenomHashRequest](#ibc.applications.transfer.v1.QueryDenomHashRequest) | [QueryDenomHashResponse](#ibc.applications.transfer.v1.QueryDenomHashResponse) | DenomHash queries a denomination hash information. | GET|/ibc/apps/transfer/v1/denom_hashes/{trace=**}| | `EscrowAddress` | [QueryEscrowAddressRequest](#ibc.applications.transfer.v1.QueryEscrowAddressRequest) | [QueryEscrowAddressResponse](#ibc.applications.transfer.v1.QueryEscrowAddressResponse) | EscrowAddress returns the escrow address for a particular port and channel id. | GET|/ibc/apps/transfer/v1/channels/{channel_id}/ports/{port_id}/escrow_address| diff --git a/docs/ibc/relayer.md b/docs/ibc/relayer.md index 8327ebfb8bf..8a8a9a1cd24 100644 --- a/docs/ibc/relayer.md +++ b/docs/ibc/relayer.md @@ -7,7 +7,7 @@ order: 6 ## Pre-requisites Readings - [IBC Overview](./overview.md) {prereq} -- [Events](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/core/08-events.md) {prereq} +- [Events](https://github.com/cosmos/cosmos-sdk/blob/main/docs/learn/advanced/08-events.md) {prereq} ## Events diff --git a/docs/ibc/upgrades/genesis-restart.md b/docs/ibc/upgrades/genesis-restart.md index 1b6ab4e45b2..4fe12a76833 100644 --- a/docs/ibc/upgrades/genesis-restart.md +++ b/docs/ibc/upgrades/genesis-restart.md @@ -18,9 +18,9 @@ Genesis restarts still require the usage of an IBC upgrade proposal in order to #### Step-by-Step Upgrade Process for SDK Chains -If the IBC-connected chain is conducting an upgrade that will break counterparty clients, it must ensure that the upgrade is first supported by IBC using the [IBC Client Breaking Upgrade List](https://github.com/cosmos/ibc-go/blob/main/docs/ibc/upgrades/quick-guide.md#ibc-client-breaking-upgrades) and then execute the upgrade process described below in order to prevent counterparty clients from breaking. +If the IBC-connected chain is conducting an upgrade that will break counterparty clients, it must ensure that the upgrade is first supported by IBC using the [IBC Client Breaking Upgrade List](./quick-guide.md#ibc-client-breaking-upgrades) and then execute the upgrade process described below in order to prevent counterparty clients from breaking. -1. Create a 02-client [`UpgradeProposal`](https://github.com/cosmos/ibc-go/blob/main/docs/ibc/proto-docs.md#upgradeproposal) with an `UpgradePlan` and a new IBC ClientState in the `UpgradedClientState` field. Note that the `UpgradePlan` must specify an upgrade height **only** (no upgrade time), and the `ClientState` should only include the fields common to all valid clients and zero out any client-customizable fields (such as TrustingPeriod). +1. Create a 02-client [`UpgradeProposal`](../proto-docs.md#upgradeproposal) with an `UpgradePlan` and a new IBC ClientState in the `UpgradedClientState` field. Note that the `UpgradePlan` must specify an upgrade height **only** (no upgrade time), and the `ClientState` should only include the fields common to all valid clients and zero out any client-customizable fields (such as TrustingPeriod). 2. Vote on and pass the `UpgradeProposal` 3. Halt the node after successful upgrade. 4. Export the genesis file. @@ -37,7 +37,7 @@ Once the chain reaches the upgrade height and halts, a relayer can upgrade the c #### Step-by-Step Upgrade Process for Relayers Upgrading Counterparty Clients -These steps are identical to the regular [IBC client breaking upgrade process](https://github.com/cosmos/ibc-go/blob/main/docs/ibc/upgrades/quick-guide.md#step-by-step-upgrade-process-for-relayers-upgrading-counterparty-clients). +These steps are identical to the regular [IBC client breaking upgrade process](./quick-guide.md#step-by-step-upgrade-process-for-relayers-upgrading-counterparty-clients). ### Non-IBC Client Breaking Upgrades diff --git a/docs/ibc/upgrades/quick-guide.md b/docs/ibc/upgrades/quick-guide.md index 2c82b3a9047..7e8838a393f 100644 --- a/docs/ibc/upgrades/quick-guide.md +++ b/docs/ibc/upgrades/quick-guide.md @@ -30,7 +30,7 @@ Note: Since upgrades are only implemented for Tendermint clients, this doc only If the IBC-connected chain is conducting an upgrade that will break counterparty clients, it must ensure that the upgrade is first supported by IBC using the list above and then execute the upgrade process described below in order to prevent counterparty clients from breaking. -1. Create a 02-client [`UpgradeProposal`](https://github.com/cosmos/ibc-go/blob/main/docs/ibc/proto-docs.md#upgradeproposal) with an `UpgradePlan` and a new IBC ClientState in the `UpgradedClientState` field. Note that the `UpgradePlan` must specify an upgrade height **only** (no upgrade time), and the `ClientState` should only include the fields common to all valid clients and zero out any client-customizable fields (such as TrustingPeriod). +1. Create a 02-client [`UpgradeProposal`](../proto-docs.md#upgradeproposal) with an `UpgradePlan` and a new IBC ClientState in the `UpgradedClientState` field. Note that the `UpgradePlan` must specify an upgrade height **only** (no upgrade time), and the `ClientState` should only include the fields common to all valid clients and zero out any client-customizable fields (such as TrustingPeriod). 2. Vote on and pass the `UpgradeProposal` Upon the `UpgradeProposal` passing, the upgrade module will commit the UpgradedClient under the key: `upgrade/UpgradedIBCState/{upgradeHeight}/upgradedClient`. On the block right before the upgrade height, the upgrade module will also commit an initial consensus state for the next chain under the key: `upgrade/UpgradedIBCState/{upgradeHeight}/upgradedConsState`. diff --git a/docs/middleware/ics29-fee/fee-distribution.md b/docs/middleware/ics29-fee/fee-distribution.md index 5200fdaaf53..f229b536654 100644 --- a/docs/middleware/ics29-fee/fee-distribution.md +++ b/docs/middleware/ics29-fee/fee-distribution.md @@ -50,7 +50,7 @@ type MsgRegisterCounterpartyPayee struct { > > - `PortId` is invalid (see [24-host naming requirements](https://github.com/cosmos/ibc/blob/master/spec/core/ics-024-host-requirements/README.md#paths-identifiers-separators). > - `ChannelId` is invalid (see [24-host naming requirements](https://github.com/cosmos/ibc/blob/master/spec/core/ics-024-host-requirements/README.md#paths-identifiers-separators)). -> - `Relayer` is an invalid address (see [Cosmos SDK Addresses](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/basics/03-accounts.md#addresses)). +> - `Relayer` is an invalid address (see [Cosmos SDK Addresses](https://github.com/cosmos/cosmos-sdk/blob/main/docs/learn/beginner/03-accounts.md#addresses)). > - `CounterpartyPayee` is empty. See below for an example CLI command: @@ -95,8 +95,8 @@ type MsgRegisterPayee struct { > > - `PortId` is invalid (see [24-host naming requirements](https://github.com/cosmos/ibc/blob/master/spec/core/ics-024-host-requirements/README.md#paths-identifiers-separators). > - `ChannelId` is invalid (see [24-host naming requirements](https://github.com/cosmos/ibc/blob/master/spec/core/ics-024-host-requirements/README.md#paths-identifiers-separators)). -> - `Relayer` is an invalid address (see [Cosmos SDK Addresses](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/basics/03-accounts.md#addresses)). -> - `Payee` is an invalid address (see [Cosmos SDK Addresses](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/basics/03-accounts.md#addresses)). +> - `Relayer` is an invalid address (see [Cosmos SDK Addresses](https://github.com/cosmos/cosmos-sdk/blob/main/docs/learn/beginner/03-accounts.md#addresses)). +> - `Payee` is an invalid address (see [Cosmos SDK Addresses](https://github.com/cosmos/cosmos-sdk/blob/main/docs/learn/beginner/03-accounts.md#addresses)). See below for an example CLI command: diff --git a/docs/migrations/sdk-to-v1.md b/docs/migrations/sdk-to-v1.md index d5c1993ea73..8cb8f0145fb 100644 --- a/docs/migrations/sdk-to-v1.md +++ b/docs/migrations/sdk-to-v1.md @@ -164,7 +164,7 @@ The solo machine has replaced the FrozenSequence uint64 field with a IsFrozen bo Application developers need to update their `OnRecvPacket` callback logic. -The `OnRecvPacket` callback has been modified to only return the acknowledgement. The acknowledgement returned must implement the `Acknowledgement` interface. The acknowledgement should indicate if it represents a successful processing of a packet by returning true on `Success()` and false in all other cases. A return value of false on `Success()` will result in all state changes which occurred in the callback being discarded. More information can be found in the [documentation](https://github.com/cosmos/ibc-go/blob/main/docs/ibc/apps.md#receiving-packets). +The `OnRecvPacket` callback has been modified to only return the acknowledgement. The acknowledgement returned must implement the `Acknowledgement` interface. The acknowledgement should indicate if it represents a successful processing of a packet by returning true on `Success()` and false in all other cases. A return value of false on `Success()` will result in all state changes which occurred in the callback being discarded. More information can be found in the [documentation](../ibc/apps/apps.md#receiving-packets). The `OnRecvPacket`, `OnAcknowledgementPacket`, and `OnTimeoutPacket` callbacks are now passed the `sdk.AccAddress` of the relayer who relayed the IBC packet. Applications may use or ignore this information. diff --git a/docs/migrations/v3-to-v4.md b/docs/migrations/v3-to-v4.md index e1f99de04f3..2859f712743 100644 --- a/docs/migrations/v3-to-v4.md +++ b/docs/migrations/v3-to-v4.md @@ -39,7 +39,7 @@ Take a look at the following diff for an [example setup](https://github.com/cosm ### Migration to fix support for base denoms with slashes -As part of [v1.5.0](https://github.com/cosmos/ibc-go/releases/tag/v1.5.0), [v2.3.0](https://github.com/cosmos/ibc-go/releases/tag/v2.3.0) and [v3.1.0](https://github.com/cosmos/ibc-go/releases/tag/v3.1.0) some [migration handler code sample was documented](https://github.com/cosmos/ibc-go/blob/main/docs/migrations/support-denoms-with-slashes.md#upgrade-proposal) that needs to run in order to correct the trace information of coins transferred using ICS20 whose base denom contains slashes. +As part of [v1.5.0](https://github.com/cosmos/ibc-go/releases/tag/v1.5.0), [v2.3.0](https://github.com/cosmos/ibc-go/releases/tag/v2.3.0) and [v3.1.0](https://github.com/cosmos/ibc-go/releases/tag/v3.1.0) some [migration handler code sample was documented](https://github.com/cosmos/ibc-go/blob/main/docs/docs/05-migrations/01-support-denoms-with-slashes.md#upgrade-proposal) that needs to run in order to correct the trace information of coins transferred using ICS20 whose base denom contains slashes. Based on feedback from the community we add now an improved solution to run the same migration that does not require copying a large piece of code over from the migration document, but instead requires only adding a one-line upgrade handler. diff --git a/go.mod b/go.mod index 53495fb3607..30e63474c5f 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,10 @@ go 1.18 module github.com/cosmos/ibc-go/v6 -retract v6.0.0 // depends on SDK version < v0.46.7 +retract ( + v6.1.0 // contains huckleberry vulnerability + [v6.0.0, v6.0.1] // depends on SDK version < v0.46.7 +) require ( cosmossdk.io/math v1.0.0-beta.3 diff --git a/modules/apps/transfer/types/query.pb.go b/modules/apps/transfer/types/query.pb.go index 6afa4adc821..6a37843a8e9 100644 --- a/modules/apps/transfer/types/query.pb.go +++ b/modules/apps/transfer/types/query.pb.go @@ -523,52 +523,52 @@ func init() { } var fileDescriptor_a638e2800a01538c = []byte{ - // 714 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0x4f, 0x4f, 0xd4, 0x40, - 0x14, 0xdf, 0xa2, 0xac, 0xd9, 0xb7, 0xc2, 0x61, 0x44, 0xc1, 0x06, 0x0b, 0x69, 0x50, 0x91, 0x3f, - 0x1d, 0x17, 0x10, 0x3c, 0x78, 0x11, 0xff, 0x62, 0x3c, 0xc0, 0xe2, 0x49, 0x0f, 0x64, 0xda, 0x8e, - 0xdd, 0x26, 0xbb, 0x9d, 0xd2, 0xe9, 0xae, 0x21, 0x64, 0x2f, 0x7e, 0x02, 0x13, 0xbe, 0x84, 0x21, - 0x7e, 0x08, 0x8f, 0x1c, 0x49, 0x4c, 0x8c, 0x27, 0x35, 0xe0, 0xd7, 0x30, 0x31, 0x9d, 0x99, 0xdd, - 0x6d, 0x65, 0xb3, 0xd0, 0xdb, 0x74, 0xe6, 0xfd, 0xde, 0xfb, 0xfd, 0x7e, 0xef, 0xbd, 0x14, 0x66, - 0x7d, 0xdb, 0xc1, 0x24, 0x0c, 0xeb, 0xbe, 0x43, 0x62, 0x9f, 0x05, 0x1c, 0xc7, 0x11, 0x09, 0xf8, - 0x7b, 0x1a, 0xe1, 0x56, 0x05, 0xef, 0x36, 0x69, 0xb4, 0x67, 0x85, 0x11, 0x8b, 0x19, 0x9a, 0xf4, - 0x6d, 0xc7, 0x4a, 0x47, 0x5a, 0x9d, 0x48, 0xab, 0x55, 0xd1, 0xc7, 0x3c, 0xe6, 0x31, 0x11, 0x88, - 0x93, 0x93, 0xc4, 0xe8, 0x73, 0x0e, 0xe3, 0x0d, 0xc6, 0xb1, 0x4d, 0x38, 0x95, 0xc9, 0x70, 0xab, - 0x62, 0xd3, 0x98, 0x54, 0x70, 0x48, 0x3c, 0x3f, 0x10, 0x89, 0x54, 0xec, 0xfc, 0x40, 0x26, 0xdd, - 0x5a, 0x32, 0x78, 0xd2, 0x63, 0xcc, 0xab, 0x53, 0x4c, 0x42, 0x1f, 0x93, 0x20, 0x60, 0xb1, 0xa2, - 0x24, 0x5e, 0xcd, 0x05, 0xb8, 0xb1, 0x95, 0x14, 0x7b, 0x4a, 0x03, 0xd6, 0x78, 0x13, 0x11, 0x87, - 0x56, 0xe9, 0x6e, 0x93, 0xf2, 0x18, 0x21, 0xb8, 0x5c, 0x23, 0xbc, 0x36, 0xa1, 0x4d, 0x6b, 0xb3, - 0xa5, 0xaa, 0x38, 0x9b, 0x2e, 0x8c, 0x9f, 0x89, 0xe6, 0x21, 0x0b, 0x38, 0x45, 0x1b, 0x50, 0x76, - 0x93, 0xdb, 0x9d, 0x38, 0xb9, 0x16, 0xa8, 0xf2, 0xd2, 0xac, 0x35, 0xc8, 0x09, 0x2b, 0x95, 0x06, - 0xdc, 0xee, 0xd9, 0x24, 0x67, 0xaa, 0xf0, 0x0e, 0xa9, 0xe7, 0x00, 0x3d, 0x37, 0x54, 0x91, 0x3b, - 0x96, 0xb4, 0xce, 0x4a, 0xac, 0xb3, 0x64, 0x1f, 0x94, 0x75, 0xd6, 0x26, 0xf1, 0x3a, 0x82, 0xaa, - 0x29, 0xa4, 0xf9, 0x55, 0x83, 0x89, 0xb3, 0x35, 0x94, 0x94, 0x77, 0x70, 0x35, 0x25, 0x85, 0x4f, - 0x68, 0xd3, 0x97, 0xf2, 0x68, 0x59, 0x1f, 0x3d, 0xfa, 0x39, 0x55, 0x38, 0xfc, 0x35, 0x55, 0x54, - 0x79, 0xcb, 0x3d, 0x6d, 0x1c, 0xbd, 0xc8, 0x28, 0x18, 0x12, 0x0a, 0xee, 0x9e, 0xab, 0x40, 0x32, - 0xcb, 0x48, 0x18, 0x03, 0x24, 0x14, 0x6c, 0x92, 0x88, 0x34, 0x3a, 0x06, 0x99, 0xdb, 0x70, 0x2d, - 0x73, 0xab, 0x24, 0x3d, 0x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 0x6d, 0xe8, 0xfe, 0x05, 0xca, 0x65, - 0x86, 0x5d, 0xaf, 0xe4, 0x40, 0x28, 0x6e, 0x33, 0x82, 0x9b, 0x81, 0x26, 0xfb, 0x73, 0x93, 0x03, - 0x8f, 0x0e, 0x35, 0x28, 0x75, 0xa7, 0x17, 0x2d, 0x5f, 0xd4, 0x87, 0xd4, 0x6a, 0xe8, 0x2b, 0xf9, - 0x40, 0x8a, 0xde, 0x92, 0xa0, 0xb7, 0x80, 0xe6, 0x06, 0x59, 0x97, 0x34, 0x39, 0x69, 0xb6, 0xb0, - 0xb0, 0x8d, 0xbe, 0x6b, 0x30, 0x92, 0x99, 0x73, 0xb4, 0x76, 0x81, 0xda, 0xfd, 0xd6, 0x4d, 0x7f, - 0x98, 0x1f, 0xa8, 0x88, 0x57, 0x05, 0xf1, 0xd7, 0xe8, 0x55, 0x7f, 0xe2, 0x6a, 0x33, 0x39, 0xde, - 0xef, 0x6d, 0x6d, 0x1b, 0x27, 0xbb, 0xcc, 0xf1, 0xbe, 0xda, 0xf0, 0x36, 0xce, 0x2e, 0xe5, 0xfa, - 0xd6, 0xd1, 0x89, 0xa1, 0x1d, 0x9f, 0x18, 0xda, 0xef, 0x13, 0x43, 0xfb, 0x74, 0x6a, 0x14, 0x8e, - 0x4f, 0x8d, 0xc2, 0x8f, 0x53, 0xa3, 0xf0, 0x76, 0xcd, 0xf3, 0xe3, 0x5a, 0xd3, 0xb6, 0x1c, 0xd6, - 0xc0, 0xea, 0xbf, 0xe9, 0xdb, 0xce, 0xa2, 0xc7, 0x70, 0x6b, 0x15, 0x37, 0x98, 0xdb, 0xac, 0x53, - 0xfe, 0x1f, 0x89, 0x78, 0x2f, 0xa4, 0xdc, 0x2e, 0x8a, 0xbf, 0xde, 0xf2, 0xbf, 0x00, 0x00, 0x00, - 0xff, 0xff, 0x92, 0xfa, 0xe1, 0x0c, 0xcc, 0x07, 0x00, 0x00, + // 717 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b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 0x35, 0x07, 0x42, 0xb2, 0x9c, 0x15, 0x2c, 0x35, 0x34, 0xd5, + 0x9b, 0x65, 0x3c, 0xf3, 0xe8, 0xb3, 0x02, 0xa5, 0xee, 0x00, 0xa3, 0xa5, 0x41, 0x0d, 0x49, 0x6d, + 0x87, 0xba, 0x9c, 0x0f, 0x24, 0xe9, 0xad, 0x08, 0x7a, 0x18, 0x2d, 0xf4, 0x33, 0x31, 0x32, 0x2f, + 0x32, 0x51, 0x98, 0x29, 0x5c, 0xfc, 0xae, 0xc0, 0x68, 0x66, 0xda, 0xd1, 0xda, 0x00, 0xe5, 0x7b, + 0x2d, 0x9d, 0x7a, 0x37, 0x3f, 0x50, 0x72, 0xaf, 0x09, 0xee, 0x2f, 0xd0, 0xf3, 0xde, 0xdc, 0xe5, + 0x7e, 0x72, 0xbc, 0x9f, 0xec, 0xee, 0x01, 0x8e, 0x36, 0x9a, 0xe3, 0x7d, 0xb9, 0xe7, 0x07, 0x38, + 0xbb, 0x9a, 0xeb, 0x5b, 0x47, 0x27, 0x9a, 0x72, 0x7c, 0xa2, 0x29, 0xbf, 0x4f, 0x34, 0xe5, 0xc3, + 0xa9, 0x56, 0x38, 0x3e, 0xd5, 0x0a, 0x3f, 0x4e, 0xb5, 0xc2, 0xab, 0x35, 0xc7, 0x0d, 0xeb, 0x2d, + 0xd3, 0xb0, 0x58, 0x13, 0xcb, 0xbf, 0xa7, 0x6b, 0x5a, 0x0b, 0x0e, 0xc3, 0xed, 0x55, 0xdc, 0x64, + 0x76, 0xab, 0x41, 0xf9, 0x3f, 0x24, 0xc2, 0x3d, 0x9f, 0x72, 0xb3, 0x28, 0xfe, 0x7d, 0x4b, 0x7f, + 0x03, 0x00, 0x00, 0xff, 0xff, 0x93, 0x47, 0x2b, 0x12, 0xd2, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -583,10 +583,10 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { - // DenomTrace queries a denomination trace information. - DenomTrace(ctx context.Context, in *QueryDenomTraceRequest, opts ...grpc.CallOption) (*QueryDenomTraceResponse, error) // DenomTraces queries all denomination traces. DenomTraces(ctx context.Context, in *QueryDenomTracesRequest, opts ...grpc.CallOption) (*QueryDenomTracesResponse, error) + // DenomTrace queries a denomination trace information. + DenomTrace(ctx context.Context, in *QueryDenomTraceRequest, opts ...grpc.CallOption) (*QueryDenomTraceResponse, error) // Params queries all parameters of the ibc-transfer module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // DenomHash queries a denomination hash information. @@ -603,18 +603,18 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) DenomTrace(ctx context.Context, in *QueryDenomTraceRequest, opts ...grpc.CallOption) (*QueryDenomTraceResponse, error) { - out := new(QueryDenomTraceResponse) - err := c.cc.Invoke(ctx, "/ibc.applications.transfer.v1.Query/DenomTrace", in, out, opts...) +func (c *queryClient) DenomTraces(ctx context.Context, in *QueryDenomTracesRequest, opts ...grpc.CallOption) (*QueryDenomTracesResponse, error) { + out := new(QueryDenomTracesResponse) + err := c.cc.Invoke(ctx, "/ibc.applications.transfer.v1.Query/DenomTraces", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) DenomTraces(ctx context.Context, in *QueryDenomTracesRequest, opts ...grpc.CallOption) (*QueryDenomTracesResponse, error) { - out := new(QueryDenomTracesResponse) - err := c.cc.Invoke(ctx, "/ibc.applications.transfer.v1.Query/DenomTraces", in, out, opts...) +func (c *queryClient) DenomTrace(ctx context.Context, in *QueryDenomTraceRequest, opts ...grpc.CallOption) (*QueryDenomTraceResponse, error) { + out := new(QueryDenomTraceResponse) + err := c.cc.Invoke(ctx, "/ibc.applications.transfer.v1.Query/DenomTrace", in, out, opts...) if err != nil { return nil, err } @@ -650,10 +650,10 @@ func (c *queryClient) EscrowAddress(ctx context.Context, in *QueryEscrowAddressR // QueryServer is the server API for Query service. type QueryServer interface { - // DenomTrace queries a denomination trace information. - DenomTrace(context.Context, *QueryDenomTraceRequest) (*QueryDenomTraceResponse, error) // DenomTraces queries all denomination traces. DenomTraces(context.Context, *QueryDenomTracesRequest) (*QueryDenomTracesResponse, error) + // DenomTrace queries a denomination trace information. + DenomTrace(context.Context, *QueryDenomTraceRequest) (*QueryDenomTraceResponse, error) // Params queries all parameters of the ibc-transfer module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // DenomHash queries a denomination hash information. @@ -666,12 +666,12 @@ type QueryServer interface { type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) DenomTrace(ctx context.Context, req *QueryDenomTraceRequest) (*QueryDenomTraceResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DenomTrace not implemented") -} func (*UnimplementedQueryServer) DenomTraces(ctx context.Context, req *QueryDenomTracesRequest) (*QueryDenomTracesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method DenomTraces not implemented") } +func (*UnimplementedQueryServer) DenomTrace(ctx context.Context, req *QueryDenomTraceRequest) (*QueryDenomTraceResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DenomTrace not implemented") +} func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } @@ -686,38 +686,38 @@ func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_DenomTrace_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDenomTraceRequest) +func _Query_DenomTraces_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDenomTracesRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).DenomTrace(ctx, in) + return srv.(QueryServer).DenomTraces(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ibc.applications.transfer.v1.Query/DenomTrace", + FullMethod: "/ibc.applications.transfer.v1.Query/DenomTraces", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).DenomTrace(ctx, req.(*QueryDenomTraceRequest)) + return srv.(QueryServer).DenomTraces(ctx, req.(*QueryDenomTracesRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_DenomTraces_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryDenomTracesRequest) +func _Query_DenomTrace_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryDenomTraceRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).DenomTraces(ctx, in) + return srv.(QueryServer).DenomTrace(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/ibc.applications.transfer.v1.Query/DenomTraces", + FullMethod: "/ibc.applications.transfer.v1.Query/DenomTrace", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).DenomTraces(ctx, req.(*QueryDenomTracesRequest)) + return srv.(QueryServer).DenomTrace(ctx, req.(*QueryDenomTraceRequest)) } return interceptor(ctx, in, info, handler) } @@ -780,14 +780,14 @@ var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "ibc.applications.transfer.v1.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "DenomTrace", - Handler: _Query_DenomTrace_Handler, - }, { MethodName: "DenomTraces", Handler: _Query_DenomTraces_Handler, }, + { + MethodName: "DenomTrace", + Handler: _Query_DenomTrace_Handler, + }, { MethodName: "Params", Handler: _Query_Params_Handler, diff --git a/modules/apps/transfer/types/query.pb.gw.go b/modules/apps/transfer/types/query.pb.gw.go index 71474a1b2fc..82a3073caa5 100644 --- a/modules/apps/transfer/types/query.pb.gw.go +++ b/modules/apps/transfer/types/query.pb.gw.go @@ -31,6 +31,42 @@ var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage +var ( + filter_Query_DenomTraces_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_DenomTraces_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDenomTracesRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DenomTraces_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.DenomTraces(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_DenomTraces_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryDenomTracesRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DenomTraces_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.DenomTraces(ctx, &protoReq) + return msg, metadata, err + +} + func request_Query_DenomTrace_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryDenomTraceRequest var metadata runtime.ServerMetadata @@ -85,42 +121,6 @@ func local_request_Query_DenomTrace_0(ctx context.Context, marshaler runtime.Mar } -var ( - filter_Query_DenomTraces_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_DenomTraces_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryDenomTracesRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DenomTraces_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.DenomTraces(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_DenomTraces_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryDenomTracesRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_DenomTraces_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.DenomTraces(ctx, &protoReq) - return msg, metadata, err - -} - func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryParamsRequest var metadata runtime.ServerMetadata @@ -275,7 +275,7 @@ func local_request_Query_EscrowAddress_0(ctx context.Context, marshaler runtime. // Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_DenomTrace_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_DenomTraces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -284,18 +284,18 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_DenomTrace_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_DenomTraces_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_DenomTrace_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_DenomTraces_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_DenomTraces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_DenomTrace_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -304,14 +304,14 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_DenomTraces_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_DenomTrace_0(rctx, inboundMarshaler, server, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_DenomTraces_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_DenomTrace_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -416,7 +416,7 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_DenomTrace_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_DenomTraces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -425,18 +425,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_DenomTrace_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_DenomTraces_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_DenomTrace_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_DenomTraces_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_DenomTraces_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_DenomTrace_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -445,14 +445,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_DenomTraces_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_DenomTrace_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_DenomTraces_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_DenomTrace_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -520,22 +520,22 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_DenomTrace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"ibc", "apps", "transfer", "v1", "denom_traces", "hash"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_DenomTraces_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"ibc", "apps", "transfer", "v1", "denom_traces"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_DenomTrace_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 3, 0, 4, 1, 5, 5}, []string{"ibc", "apps", "transfer", "v1", "denom_traces", "hash"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"ibc", "apps", "transfer", "v1", "params"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_DenomHash_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"ibc", "apps", "transfer", "v1", "denom_hashes", "trace"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_DenomHash_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 3, 0, 4, 1, 5, 5}, []string{"ibc", "apps", "transfer", "v1", "denom_hashes", "trace"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_EscrowAddress_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5, 2, 6, 1, 0, 4, 1, 5, 7, 2, 8}, []string{"ibc", "apps", "transfer", "v1", "channels", "channel_id", "ports", "port_id", "escrow_address"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( - forward_Query_DenomTrace_0 = runtime.ForwardResponseMessage - forward_Query_DenomTraces_0 = runtime.ForwardResponseMessage + forward_Query_DenomTrace_0 = runtime.ForwardResponseMessage + forward_Query_Params_0 = runtime.ForwardResponseMessage forward_Query_DenomHash_0 = runtime.ForwardResponseMessage diff --git a/modules/core/04-channel/keeper/grpc_query.go b/modules/core/04-channel/keeper/grpc_query.go index e6bc4ea2ecf..232b27f6f62 100644 --- a/modules/core/04-channel/keeper/grpc_query.go +++ b/modules/core/04-channel/keeper/grpc_query.go @@ -397,18 +397,55 @@ func (q Keeper) UnreceivedPackets(c context.Context, req *types.QueryUnreceivedP ctx := sdk.UnwrapSDKContext(c) - unreceivedSequences := []uint64{} + channel, found := q.GetChannel(sdk.UnwrapSDKContext(c), req.PortId, req.ChannelId) + if !found { + return nil, status.Error( + codes.NotFound, + sdkerrors.Wrapf(types.ErrChannelNotFound, "port-id: %s, channel-id %s", req.PortId, req.ChannelId).Error(), + ) + } - for i, seq := range req.PacketCommitmentSequences { - if seq == 0 { - return nil, status.Errorf(codes.InvalidArgument, "packet sequence %d cannot be 0", i) - } + var unreceivedSequences []uint64 + switch channel.Ordering { + case types.UNORDERED: + for i, seq := range req.PacketCommitmentSequences { + // filter for invalid sequences to ensure they are not included in the response value. + if seq == 0 { + return nil, status.Errorf(codes.InvalidArgument, "packet sequence %d cannot be 0", i) + } - // if packet receipt exists on the receiving chain, then packet has already been received - if _, found := q.GetPacketReceipt(ctx, req.PortId, req.ChannelId, seq); !found { - unreceivedSequences = append(unreceivedSequences, seq) + // if the packet receipt does not exist, then it is unreceived + if _, found := q.GetPacketReceipt(ctx, req.PortId, req.ChannelId, seq); !found { + unreceivedSequences = append(unreceivedSequences, seq) + } + } + case types.ORDERED: + nextSequenceRecv, found := q.GetNextSequenceRecv(ctx, req.PortId, req.ChannelId) + if !found { + return nil, status.Error( + codes.NotFound, + sdkerrors.Wrapf( + types.ErrSequenceReceiveNotFound, + "destination port: %s, destination channel: %s", req.PortId, req.ChannelId, + ).Error(), + ) } + for i, seq := range req.PacketCommitmentSequences { + // filter for invalid sequences to ensure they are not included in the response value. + if seq == 0 { + return nil, status.Errorf(codes.InvalidArgument, "packet sequence %d cannot be 0", i) + } + + // Any sequence greater than or equal to the next sequence to be received is not received. + if seq >= nextSequenceRecv { + unreceivedSequences = append(unreceivedSequences, seq) + } + } + default: + return nil, status.Error( + codes.InvalidArgument, + sdkerrors.Wrapf(types.ErrInvalidChannelOrdering, "channel order %s is not supported", channel.Ordering.String()).Error()) } selfHeight := clienttypes.GetSelfHeight(ctx) diff --git a/modules/core/04-channel/keeper/grpc_query_test.go b/modules/core/04-channel/keeper/grpc_query_test.go index 4772854a4da..19eca2e5bd7 100644 --- a/modules/core/04-channel/keeper/grpc_query_test.go +++ b/modules/core/04-channel/keeper/grpc_query_test.go @@ -1110,7 +1110,7 @@ func (suite *KeeperTestSuite) TestQueryPacketAcknowledgements() { func (suite *KeeperTestSuite) TestQueryUnreceivedPackets() { var ( req *types.QueryUnreceivedPacketsRequest - expSeq = []uint64{} + expSeq = []uint64(nil) ) testCases := []struct { @@ -1156,6 +1156,46 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedPackets() { }, false, }, + { + "invalid seq, ordered channel", + func() { + path := ibctesting.NewPath(suite.chainA, suite.chainB) + path.SetChannelOrdered() + suite.coordinator.Setup(path) + + req = &types.QueryUnreceivedPacketsRequest{ + PortId: path.EndpointA.ChannelConfig.PortID, + ChannelId: path.EndpointA.ChannelID, + PacketCommitmentSequences: []uint64{0}, + } + }, + false, + }, + { + "channel not found", + func() { + req = &types.QueryUnreceivedPacketsRequest{ + PortId: "invalid-port-id", + ChannelId: "invalid-channel-id", + } + }, + false, + }, + { + "basic success empty packet commitments", + func() { + path := ibctesting.NewPath(suite.chainA, suite.chainB) + suite.coordinator.Setup(path) + + expSeq = []uint64(nil) + req = &types.QueryUnreceivedPacketsRequest{ + PortId: path.EndpointA.ChannelConfig.PortID, + ChannelId: path.EndpointA.ChannelID, + PacketCommitmentSequences: []uint64{}, + } + }, + true, + }, { "basic success unreceived packet commitments", func() { @@ -1181,7 +1221,7 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedPackets() { suite.chainA.App.GetIBCKeeper().ChannelKeeper.SetPacketReceipt(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, 1) - expSeq = []uint64{} + expSeq = []uint64(nil) req = &types.QueryUnreceivedPacketsRequest{ PortId: path.EndpointA.ChannelConfig.PortID, ChannelId: path.EndpointA.ChannelID, @@ -1195,7 +1235,7 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedPackets() { func() { path := ibctesting.NewPath(suite.chainA, suite.chainB) suite.coordinator.Setup(path) - expSeq = []uint64{} // reset + expSeq = []uint64(nil) // reset packetCommitments := []uint64{} // set packet receipt for every other sequence @@ -1217,6 +1257,60 @@ func (suite *KeeperTestSuite) TestQueryUnreceivedPackets() { }, true, }, + { + "basic success empty packet commitments, ordered channel", + func() { + path := ibctesting.NewPath(suite.chainA, suite.chainB) + path.SetChannelOrdered() + suite.coordinator.Setup(path) + + expSeq = []uint64(nil) + req = &types.QueryUnreceivedPacketsRequest{ + PortId: path.EndpointA.ChannelConfig.PortID, + ChannelId: path.EndpointA.ChannelID, + PacketCommitmentSequences: []uint64{}, + } + }, + true, + }, + { + "basic success unreceived packet commitments, ordered channel", + func() { + path := ibctesting.NewPath(suite.chainA, suite.chainB) + path.SetChannelOrdered() + suite.coordinator.Setup(path) + + // Note: NextSequenceRecv is set to 1 on channel creation. + expSeq = []uint64{1} + req = &types.QueryUnreceivedPacketsRequest{ + PortId: path.EndpointA.ChannelConfig.PortID, + ChannelId: path.EndpointA.ChannelID, + PacketCommitmentSequences: []uint64{1}, + } + }, + true, + }, + { + "basic success multiple unreceived packet commitments, ordered channel", + func() { + path := ibctesting.NewPath(suite.chainA, suite.chainB) + path.SetChannelOrdered() + suite.coordinator.Setup(path) + + // Exercise scenario from issue #1532. NextSequenceRecv is 5, packet commitments provided are 2, 7, 9, 10. + // Packet sequence 2 is already received so only sequences 7, 9, 10 should be considered unreceived. + expSeq = []uint64{7, 9, 10} + packetCommitments := []uint64{2, 7, 9, 10} + suite.chainA.App.GetIBCKeeper().ChannelKeeper.SetNextSequenceRecv(suite.chainA.GetContext(), path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID, 5) + + req = &types.QueryUnreceivedPacketsRequest{ + PortId: path.EndpointA.ChannelConfig.PortID, + ChannelId: path.EndpointA.ChannelID, + PacketCommitmentSequences: packetCommitments, + } + }, + true, + }, } for _, tc := range testCases { diff --git a/modules/core/keeper/msg_server.go b/modules/core/keeper/msg_server.go index 77a0b2c55c4..230951ca75d 100644 --- a/modules/core/keeper/msg_server.go +++ b/modules/core/keeper/msg_server.go @@ -411,10 +411,6 @@ func (k Keeper) RecvPacket(goCtx context.Context, msg *channeltypes.MsgRecvPacke if ack == nil || ack.Success() { // write application state changes for asynchronous and successful acknowledgements writeFn() - } else { - // NOTE: The context returned by CacheContext() refers to a new EventManager, so it needs to explicitly set events to the original context. - // Events should still be emitted from failed acks and asynchronous acks - ctx.EventManager().EmitEvents(cacheCtx.EventManager().Events()) } // Set packet acknowledgement only if the acknowledgement is not nil. diff --git a/proto/ibc/applications/transfer/v1/query.proto b/proto/ibc/applications/transfer/v1/query.proto index cf8896fea25..470a7f4c5f3 100644 --- a/proto/ibc/applications/transfer/v1/query.proto +++ b/proto/ibc/applications/transfer/v1/query.proto @@ -11,16 +11,16 @@ option go_package = "github.com/cosmos/ibc-go/v6/modules/apps/transfer/types"; // Query provides defines the gRPC querier service. service Query { - // DenomTrace queries a denomination trace information. - rpc DenomTrace(QueryDenomTraceRequest) returns (QueryDenomTraceResponse) { - option (google.api.http).get = "/ibc/apps/transfer/v1/denom_traces/{hash}"; - } - // DenomTraces queries all denomination traces. rpc DenomTraces(QueryDenomTracesRequest) returns (QueryDenomTracesResponse) { option (google.api.http).get = "/ibc/apps/transfer/v1/denom_traces"; } + // DenomTrace queries a denomination trace information. + rpc DenomTrace(QueryDenomTraceRequest) returns (QueryDenomTraceResponse) { + option (google.api.http).get = "/ibc/apps/transfer/v1/denom_traces/{hash=**}"; + } + // Params queries all parameters of the ibc-transfer module. rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/ibc/apps/transfer/v1/params"; @@ -28,7 +28,7 @@ service Query { // DenomHash queries a denomination hash information. rpc DenomHash(QueryDenomHashRequest) returns (QueryDenomHashResponse) { - option (google.api.http).get = "/ibc/apps/transfer/v1/denom_hashes/{trace}"; + option (google.api.http).get = "/ibc/apps/transfer/v1/denom_hashes/{trace=**}"; } // EscrowAddress returns the escrow address for a particular port and channel id.