From ad1f7886838bd27f9de55b8a054525cd51200fed Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 31 Jan 2024 16:14:35 +0200 Subject: [PATCH 1/3] build(deps): Bump peter-evans/create-pull-request from 5 to 6 (#5786) Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 5 to 6. - [Release notes](https://github.com/peter-evans/create-pull-request/releases) - [Commits](https://github.com/peter-evans/create-pull-request/compare/v5...v6) --- updated-dependencies: - dependency-name: peter-evans/create-pull-request 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> --- .github/workflows/spell-checker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/spell-checker.yml b/.github/workflows/spell-checker.yml index ffe01bf24f1..112b5ec3bb6 100644 --- a/.github/workflows/spell-checker.yml +++ b/.github/workflows/spell-checker.yml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v4 - uses: sobolevn/misspell-fixer-action@8842a5615f83fed75e8a87015e9300a54d049961 - - uses: peter-evans/create-pull-request@v5 + - uses: peter-evans/create-pull-request@v6 with: token: ${{ secrets.GITHUB_TOKEN }} commit-message: "chore: fixes by misspell-fixer" From e67435b92ce8b6108c41bd1952df3ade1a4765ca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:20:13 +0000 Subject: [PATCH 2/3] build(deps): Bump docker/metadata-action from 5.5.0 to 5.5.1 (#5787) Bumps [docker/metadata-action](https://github.com/docker/metadata-action) from 5.5.0 to 5.5.1. - [Release notes](https://github.com/docker/metadata-action/releases) - [Commits](https://github.com/docker/metadata-action/compare/dbef88086f6cef02e264edb7dbf63250c17cef6c...8e5442c4ef9f78752691e2d8f8d19755c6f78e81) --- updated-dependencies: - dependency-name: docker/metadata-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: DimitrisJim --- .github/workflows/docker.yml | 2 +- .github/workflows/e2e-test-workflow-call.yml | 4 ++-- .github/workflows/release.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 1054e7b7275..44c39e7bee1 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -23,7 +23,7 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@dbef88086f6cef02e264edb7dbf63250c17cef6c + uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 with: images: ${{ env.REGISTRY }}/cosmos/${{ env.IMAGE_NAME }} diff --git a/.github/workflows/e2e-test-workflow-call.yml b/.github/workflows/e2e-test-workflow-call.yml index 9f4336252a9..e10f97c631d 100644 --- a/.github/workflows/e2e-test-workflow-call.yml +++ b/.github/workflows/e2e-test-workflow-call.yml @@ -121,7 +121,7 @@ jobs: - name: Extract metadata (tags, labels) for Docker if: ${{ inputs.build-and-push-docker-image }} id: meta - uses: docker/metadata-action@dbef88086f6cef02e264edb7dbf63250c17cef6c + uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 with: images: ${{ env.REGISTRY }}/cosmos/${{ env.IMAGE_NAME }} @@ -168,7 +168,7 @@ jobs: - name: Extract metadata (tags, labels) for Docker if: ${{ inputs.build-and-push-docker-image-wasm }} id: meta - uses: docker/metadata-action@dbef88086f6cef02e264edb7dbf63250c17cef6c + uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 with: images: ${{ env.REGISTRY }}/cosmos/${{ env.IMAGE_NAME_WASM }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 31ff8baa98e..7ae3e155429 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,7 +47,7 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@dbef88086f6cef02e264edb7dbf63250c17cef6c + uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 with: images: ${{ env.REGISTRY }}/cosmos/${{ env.IMAGE_NAME }} From 661356e5ddfde55c9a29ee7194770b9861a8b123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?colin=20axn=C3=A9r?= <25233464+colin-axner@users.noreply.github.com> Date: Wed, 31 Jan 2024 15:36:04 +0100 Subject: [PATCH 3/3] refactor: remove unnecessary getters on counterparty connection type (#5783) --- docs/docs/05-migrations/13-v8-to-v9.md | 3 ++- .../controller/keeper/handshake.go | 2 +- .../27-interchain-accounts/types/metadata.go | 4 ++-- modules/core/03-connection/keeper/verify.go | 20 +++++++++---------- .../core/03-connection/types/connection.go | 16 --------------- modules/core/04-channel/keeper/handshake.go | 8 ++++---- modules/core/04-channel/keeper/timeout.go | 2 +- modules/core/04-channel/keeper/upgrade.go | 16 +++++++-------- 8 files changed, 28 insertions(+), 43 deletions(-) diff --git a/docs/docs/05-migrations/13-v8-to-v9.md b/docs/docs/05-migrations/13-v8-to-v9.md index facc3fa01ce..15b165875c7 100644 --- a/docs/docs/05-migrations/13-v8-to-v9.md +++ b/docs/docs/05-migrations/13-v8-to-v9.md @@ -31,7 +31,8 @@ The `exported.ConnectionI` and `exported.CounterpartyConnectionI` interfaces hav The functions `GetState()`, `GetOrdering()`, `GetCounterparty()`, `GetConnectionHops()`, `GetVersion()` of the `Channel` type have been removed. The functions `GetPortID()`, `GetChannelID()` of the `CounterpartyChannel` type have been removed. -The function `GetClientID()`, `GetState()`, `GetCounterparty()`, `GetVersions()`, and `GetDelayPeriod` of the `Connection` type have been removed. +The functions `GetClientID()`, `GetState()`, `GetCounterparty()`, `GetVersions()`, and `GetDelayPeriod` of the `Connection` type have been removed. +The functions `GetClientID()`, `GetConnectionID()`, and `GetPrefix()` of the `CounterpartyConnection` type have been removed. ### API deprecation notice diff --git a/modules/apps/27-interchain-accounts/controller/keeper/handshake.go b/modules/apps/27-interchain-accounts/controller/keeper/handshake.go index 12844a00023..aa54053221a 100644 --- a/modules/apps/27-interchain-accounts/controller/keeper/handshake.go +++ b/modules/apps/27-interchain-accounts/controller/keeper/handshake.go @@ -48,7 +48,7 @@ func (k Keeper) OnChanOpenInit( return "", err } - metadata = icatypes.NewDefaultMetadata(connectionHops[0], connection.Counterparty.GetConnectionID()) + metadata = icatypes.NewDefaultMetadata(connectionHops[0], connection.Counterparty.ConnectionId) } else { metadata, err = icatypes.MetadataFromVersion(version) if err != nil { diff --git a/modules/apps/27-interchain-accounts/types/metadata.go b/modules/apps/27-interchain-accounts/types/metadata.go index 61058b5e201..8cf3772bf94 100644 --- a/modules/apps/27-interchain-accounts/types/metadata.go +++ b/modules/apps/27-interchain-accounts/types/metadata.go @@ -94,7 +94,7 @@ func ValidateControllerMetadata(ctx sdk.Context, channelKeeper ChannelKeeper, co return err } - if err := validateConnectionParams(metadata, connectionHops[0], connection.Counterparty.GetConnectionID()); err != nil { + if err := validateConnectionParams(metadata, connectionHops[0], connection.Counterparty.ConnectionId); err != nil { return err } @@ -126,7 +126,7 @@ func ValidateHostMetadata(ctx sdk.Context, channelKeeper ChannelKeeper, connecti return err } - if err := validateConnectionParams(metadata, connection.Counterparty.GetConnectionID(), connectionHops[0]); err != nil { + if err := validateConnectionParams(metadata, connection.Counterparty.ConnectionId, connectionHops[0]); err != nil { return err } diff --git a/modules/core/03-connection/keeper/verify.go b/modules/core/03-connection/keeper/verify.go index d5e95acf851..84369f4b52d 100644 --- a/modules/core/03-connection/keeper/verify.go +++ b/modules/core/03-connection/keeper/verify.go @@ -36,7 +36,7 @@ func (k Keeper) VerifyClientState( } merklePath := commitmenttypes.NewMerklePath(host.FullClientStatePath(connection.Counterparty.ClientId)) - merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.GetPrefix(), merklePath) + merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.Prefix, merklePath) if err != nil { return err } @@ -78,7 +78,7 @@ func (k Keeper) VerifyClientConsensusState( } merklePath := commitmenttypes.NewMerklePath(host.FullConsensusStatePath(connection.Counterparty.ClientId, consensusHeight)) - merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.GetPrefix(), merklePath) + merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.Prefix, merklePath) if err != nil { return err } @@ -120,7 +120,7 @@ func (k Keeper) VerifyConnectionState( } merklePath := commitmenttypes.NewMerklePath(host.ConnectionPath(connectionID)) - merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.GetPrefix(), merklePath) + merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.Prefix, merklePath) if err != nil { return err } @@ -163,7 +163,7 @@ func (k Keeper) VerifyChannelState( } merklePath := commitmenttypes.NewMerklePath(host.ChannelPath(portID, channelID)) - merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.GetPrefix(), merklePath) + merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.Prefix, merklePath) if err != nil { return err } @@ -211,7 +211,7 @@ func (k Keeper) VerifyPacketCommitment( blockDelay := k.getBlockDelay(ctx, connection) merklePath := commitmenttypes.NewMerklePath(host.PacketCommitmentPath(portID, channelID, sequence)) - merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.GetPrefix(), merklePath) + merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.Prefix, merklePath) if err != nil { return err } @@ -254,7 +254,7 @@ func (k Keeper) VerifyPacketAcknowledgement( blockDelay := k.getBlockDelay(ctx, connection) merklePath := commitmenttypes.NewMerklePath(host.PacketAcknowledgementPath(portID, channelID, sequence)) - merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.GetPrefix(), merklePath) + merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.Prefix, merklePath) if err != nil { return err } @@ -297,7 +297,7 @@ func (k Keeper) VerifyPacketReceiptAbsence( blockDelay := k.getBlockDelay(ctx, connection) merklePath := commitmenttypes.NewMerklePath(host.PacketReceiptPath(portID, channelID, sequence)) - merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.GetPrefix(), merklePath) + merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.Prefix, merklePath) if err != nil { return err } @@ -339,7 +339,7 @@ func (k Keeper) VerifyNextSequenceRecv( blockDelay := k.getBlockDelay(ctx, connection) merklePath := commitmenttypes.NewMerklePath(host.NextSequenceRecvPath(portID, channelID)) - merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.GetPrefix(), merklePath) + merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.Prefix, merklePath) if err != nil { return err } @@ -376,7 +376,7 @@ func (k Keeper) VerifyChannelUpgradeError( } merklePath := commitmenttypes.NewMerklePath(host.ChannelUpgradeErrorPath(portID, channelID)) - merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.GetPrefix(), merklePath) + merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.Prefix, merklePath) if err != nil { return err } @@ -418,7 +418,7 @@ func (k Keeper) VerifyChannelUpgrade( } merklePath := commitmenttypes.NewMerklePath(host.ChannelUpgradePath(portID, channelID)) - merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.GetPrefix(), merklePath) + merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.Prefix, merklePath) if err != nil { return err } diff --git a/modules/core/03-connection/types/connection.go b/modules/core/03-connection/types/connection.go index 0e638b585da..2404bfa490f 100644 --- a/modules/core/03-connection/types/connection.go +++ b/modules/core/03-connection/types/connection.go @@ -6,7 +6,6 @@ import ( commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" host "github.com/cosmos/ibc-go/v8/modules/core/24-host" ibcerrors "github.com/cosmos/ibc-go/v8/modules/core/errors" - "github.com/cosmos/ibc-go/v8/modules/core/exported" ) // NewConnectionEnd creates a new ConnectionEnd instance. @@ -47,21 +46,6 @@ func NewCounterparty(clientID, connectionID string, prefix commitmenttypes.Merkl } } -// GetClientID implements the CounterpartyConnectionI interface -func (c Counterparty) GetClientID() string { - return c.ClientId -} - -// GetConnectionID implements the CounterpartyConnectionI interface -func (c Counterparty) GetConnectionID() string { - return c.ConnectionId -} - -// GetPrefix implements the CounterpartyConnectionI interface -func (c Counterparty) GetPrefix() exported.Prefix { - return &c.Prefix -} - // ValidateBasic performs a basic validation check of the identifiers and prefix func (c Counterparty) ValidateBasic() error { if c.ConnectionId != "" { diff --git a/modules/core/04-channel/keeper/handshake.go b/modules/core/04-channel/keeper/handshake.go index a3a58233852..fdfae21f944 100644 --- a/modules/core/04-channel/keeper/handshake.go +++ b/modules/core/04-channel/keeper/handshake.go @@ -152,7 +152,7 @@ func (k Keeper) ChanOpenTry( ) } - counterpartyHops := []string{connectionEnd.Counterparty.GetConnectionID()} + counterpartyHops := []string{connectionEnd.Counterparty.ConnectionId} // expectedCounterpaty is the counterparty of the counterparty's channel end // (i.e self) @@ -243,7 +243,7 @@ func (k Keeper) ChanOpenAck( return errorsmod.Wrapf(connectiontypes.ErrInvalidConnectionState, "connection state is not OPEN (got %s)", connectionEnd.State) } - counterpartyHops := []string{connectionEnd.Counterparty.GetConnectionID()} + counterpartyHops := []string{connectionEnd.Counterparty.ConnectionId} // counterparty of the counterparty channel end (i.e self) expectedCounterparty := types.NewCounterparty(portID, channelID) @@ -319,7 +319,7 @@ func (k Keeper) ChanOpenConfirm( return errorsmod.Wrapf(connectiontypes.ErrInvalidConnectionState, "connection state is not OPEN (got %s)", connectionEnd.State) } - counterpartyHops := []string{connectionEnd.Counterparty.GetConnectionID()} + counterpartyHops := []string{connectionEnd.Counterparty.ConnectionId} counterparty := types.NewCounterparty(portID, channelID) expectedChannel := types.NewChannel( @@ -445,7 +445,7 @@ func (k Keeper) ChanCloseConfirm( return errorsmod.Wrapf(connectiontypes.ErrInvalidConnectionState, "connection state is not OPEN (got %s)", connectionEnd.State) } - counterpartyHops := []string{connectionEnd.Counterparty.GetConnectionID()} + counterpartyHops := []string{connectionEnd.Counterparty.ConnectionId} counterparty := types.NewCounterparty(portID, channelID) expectedChannel := types.Channel{ diff --git a/modules/core/04-channel/keeper/timeout.go b/modules/core/04-channel/keeper/timeout.go index 77df0ea7f63..169822a1875 100644 --- a/modules/core/04-channel/keeper/timeout.go +++ b/modules/core/04-channel/keeper/timeout.go @@ -263,7 +263,7 @@ func (k Keeper) TimeoutOnClose( return errorsmod.Wrapf(types.ErrInvalidPacket, "packet commitment bytes are not equal: got (%v), expected (%v)", commitment, packetCommitment) } - counterpartyHops := []string{connectionEnd.Counterparty.GetConnectionID()} + counterpartyHops := []string{connectionEnd.Counterparty.ConnectionId} counterparty := types.NewCounterparty(packet.GetSourcePort(), packet.GetSourceChannel()) expectedChannel := types.Channel{ diff --git a/modules/core/04-channel/keeper/upgrade.go b/modules/core/04-channel/keeper/upgrade.go index df7c8c30226..238bb534afa 100644 --- a/modules/core/04-channel/keeper/upgrade.go +++ b/modules/core/04-channel/keeper/upgrade.go @@ -104,7 +104,7 @@ func (k Keeper) ChanUpgradeTry( // construct expected counterparty channel from information in state // only the counterpartyUpgradeSequence is provided by the relayer - counterpartyConnectionHops := []string{connection.Counterparty.GetConnectionID()} + counterpartyConnectionHops := []string{connection.Counterparty.ConnectionId} counterpartyChannel := types.Channel{ State: types.OPEN, Ordering: channel.Ordering, @@ -278,7 +278,7 @@ func (k Keeper) ChanUpgradeAck( return errorsmod.Wrapf(connectiontypes.ErrInvalidConnectionState, "connection state is not OPEN (got %s)", connection.State) } - counterpartyHops := []string{connection.Counterparty.GetConnectionID()} + counterpartyHops := []string{connection.Counterparty.ConnectionId} counterpartyChannel := types.Channel{ State: types.FLUSHING, Ordering: channel.Ordering, @@ -414,7 +414,7 @@ func (k Keeper) ChanUpgradeConfirm( return errorsmod.Wrapf(connectiontypes.ErrInvalidConnectionState, "connection state is not OPEN (got %s)", connection.State) } - counterpartyHops := []string{connection.Counterparty.GetConnectionID()} + counterpartyHops := []string{connection.Counterparty.ConnectionId} counterpartyChannel := types.Channel{ State: counterpartyChannelState, Ordering: channel.Ordering, @@ -537,7 +537,7 @@ func (k Keeper) ChanUpgradeOpen( counterpartyChannel = types.Channel{ State: types.OPEN, Ordering: upgrade.Fields.Ordering, - ConnectionHops: []string{upgradeConnection.Counterparty.GetConnectionID()}, + ConnectionHops: []string{upgradeConnection.Counterparty.ConnectionId}, Counterparty: types.NewCounterparty(portID, channelID), Version: upgrade.Fields.Version, UpgradeSequence: counterpartyUpgradeSequence, @@ -547,7 +547,7 @@ func (k Keeper) ChanUpgradeOpen( counterpartyChannel = types.Channel{ State: types.FLUSHCOMPLETE, Ordering: channel.Ordering, - ConnectionHops: []string{connection.Counterparty.GetConnectionID()}, + ConnectionHops: []string{connection.Counterparty.ConnectionId}, Counterparty: types.NewCounterparty(portID, channelID), Version: channel.Version, UpgradeSequence: channel.UpgradeSequence, @@ -769,7 +769,7 @@ func (k Keeper) ChanUpgradeTimeout( upgrade.Fields.ConnectionHops[0], ) } - counterpartyHops := []string{upgradeConnection.Counterparty.GetConnectionID()} + counterpartyHops := []string{upgradeConnection.Counterparty.ConnectionId} upgradeAlreadyComplete := upgrade.Fields.Version == counterpartyChannel.Version && upgrade.Fields.Ordering == counterpartyChannel.Ordering && upgrade.Fields.ConnectionHops[0] == counterpartyHops[0] if upgradeAlreadyComplete { @@ -895,9 +895,9 @@ func (k Keeper) checkForUpgradeCompatibility(ctx sdk.Context, upgradeFields, cou } // connectionHops can change in a channelUpgrade, however both sides must still be each other's counterparty. - if counterpartyUpgradeFields.ConnectionHops[0] != connection.Counterparty.GetConnectionID() { + if counterpartyUpgradeFields.ConnectionHops[0] != connection.Counterparty.ConnectionId { return errorsmod.Wrapf( - types.ErrIncompatibleCounterpartyUpgrade, "counterparty upgrade connection end is not a counterparty of self proposed connection end (%s != %s)", counterpartyUpgradeFields.ConnectionHops[0], connection.Counterparty.GetConnectionID()) + types.ErrIncompatibleCounterpartyUpgrade, "counterparty upgrade connection end is not a counterparty of self proposed connection end (%s != %s)", counterpartyUpgradeFields.ConnectionHops[0], connection.Counterparty.ConnectionId) } return nil