Skip to content

Commit

Permalink
Merge branch 'main' into jim/3915-use-json-for-transfer-packet-data
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitrisJim authored Jan 31, 2024
2 parents 1930eda + 661356e commit c700f6e
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-test-workflow-call.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down Expand Up @@ -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 }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/spell-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion docs/docs/05-migrations/13-v8-to-v9.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions modules/apps/27-interchain-accounts/types/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down
20 changes: 10 additions & 10 deletions modules/core/03-connection/keeper/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down
16 changes: 0 additions & 16 deletions modules/core/03-connection/types/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 != "" {
Expand Down
8 changes: 4 additions & 4 deletions modules/core/04-channel/keeper/handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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{
Expand Down
2 changes: 1 addition & 1 deletion modules/core/04-channel/keeper/timeout.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
16 changes: 8 additions & 8 deletions modules/core/04-channel/keeper/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c700f6e

Please sign in to comment.