Skip to content

File tree

8 files changed

+28
-43
lines changed

8 files changed

+28
-43
lines changed
 

‎docs/docs/05-migrations/13-v8-to-v9.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ The `exported.ConnectionI` and `exported.CounterpartyConnectionI` interfaces hav
3131

3232
The functions `GetState()`, `GetOrdering()`, `GetCounterparty()`, `GetConnectionHops()`, `GetVersion()` of the `Channel` type have been removed.
3333
The functions `GetPortID()`, `GetChannelID()` of the `CounterpartyChannel` type have been removed.
34-
The function `GetClientID()`, `GetState()`, `GetCounterparty()`, `GetVersions()`, and `GetDelayPeriod` of the `Connection` type have been removed.
34+
The functions `GetClientID()`, `GetState()`, `GetCounterparty()`, `GetVersions()`, and `GetDelayPeriod` of the `Connection` type have been removed.
35+
The functions `GetClientID()`, `GetConnectionID()`, and `GetPrefix()` of the `CounterpartyConnection` type have been removed.
3536

3637
### API deprecation notice
3738

‎modules/apps/27-interchain-accounts/controller/keeper/handshake.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ func (k Keeper) OnChanOpenInit(
4848
return "", err
4949
}
5050

51-
metadata = icatypes.NewDefaultMetadata(connectionHops[0], connection.Counterparty.GetConnectionID())
51+
metadata = icatypes.NewDefaultMetadata(connectionHops[0], connection.Counterparty.ConnectionId)
5252
} else {
5353
metadata, err = icatypes.MetadataFromVersion(version)
5454
if err != nil {

‎modules/apps/27-interchain-accounts/types/metadata.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func ValidateControllerMetadata(ctx sdk.Context, channelKeeper ChannelKeeper, co
9494
return err
9595
}
9696

97-
if err := validateConnectionParams(metadata, connectionHops[0], connection.Counterparty.GetConnectionID()); err != nil {
97+
if err := validateConnectionParams(metadata, connectionHops[0], connection.Counterparty.ConnectionId); err != nil {
9898
return err
9999
}
100100

@@ -126,7 +126,7 @@ func ValidateHostMetadata(ctx sdk.Context, channelKeeper ChannelKeeper, connecti
126126
return err
127127
}
128128

129-
if err := validateConnectionParams(metadata, connection.Counterparty.GetConnectionID(), connectionHops[0]); err != nil {
129+
if err := validateConnectionParams(metadata, connection.Counterparty.ConnectionId, connectionHops[0]); err != nil {
130130
return err
131131
}
132132

‎modules/core/03-connection/keeper/verify.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func (k Keeper) VerifyClientState(
3636
}
3737

3838
merklePath := commitmenttypes.NewMerklePath(host.FullClientStatePath(connection.Counterparty.ClientId))
39-
merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.GetPrefix(), merklePath)
39+
merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.Prefix, merklePath)
4040
if err != nil {
4141
return err
4242
}
@@ -78,7 +78,7 @@ func (k Keeper) VerifyClientConsensusState(
7878
}
7979

8080
merklePath := commitmenttypes.NewMerklePath(host.FullConsensusStatePath(connection.Counterparty.ClientId, consensusHeight))
81-
merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.GetPrefix(), merklePath)
81+
merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.Prefix, merklePath)
8282
if err != nil {
8383
return err
8484
}
@@ -120,7 +120,7 @@ func (k Keeper) VerifyConnectionState(
120120
}
121121

122122
merklePath := commitmenttypes.NewMerklePath(host.ConnectionPath(connectionID))
123-
merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.GetPrefix(), merklePath)
123+
merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.Prefix, merklePath)
124124
if err != nil {
125125
return err
126126
}
@@ -163,7 +163,7 @@ func (k Keeper) VerifyChannelState(
163163
}
164164

165165
merklePath := commitmenttypes.NewMerklePath(host.ChannelPath(portID, channelID))
166-
merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.GetPrefix(), merklePath)
166+
merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.Prefix, merklePath)
167167
if err != nil {
168168
return err
169169
}
@@ -211,7 +211,7 @@ func (k Keeper) VerifyPacketCommitment(
211211
blockDelay := k.getBlockDelay(ctx, connection)
212212

213213
merklePath := commitmenttypes.NewMerklePath(host.PacketCommitmentPath(portID, channelID, sequence))
214-
merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.GetPrefix(), merklePath)
214+
merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.Prefix, merklePath)
215215
if err != nil {
216216
return err
217217
}
@@ -254,7 +254,7 @@ func (k Keeper) VerifyPacketAcknowledgement(
254254
blockDelay := k.getBlockDelay(ctx, connection)
255255

256256
merklePath := commitmenttypes.NewMerklePath(host.PacketAcknowledgementPath(portID, channelID, sequence))
257-
merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.GetPrefix(), merklePath)
257+
merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.Prefix, merklePath)
258258
if err != nil {
259259
return err
260260
}
@@ -297,7 +297,7 @@ func (k Keeper) VerifyPacketReceiptAbsence(
297297
blockDelay := k.getBlockDelay(ctx, connection)
298298

299299
merklePath := commitmenttypes.NewMerklePath(host.PacketReceiptPath(portID, channelID, sequence))
300-
merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.GetPrefix(), merklePath)
300+
merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.Prefix, merklePath)
301301
if err != nil {
302302
return err
303303
}
@@ -339,7 +339,7 @@ func (k Keeper) VerifyNextSequenceRecv(
339339
blockDelay := k.getBlockDelay(ctx, connection)
340340

341341
merklePath := commitmenttypes.NewMerklePath(host.NextSequenceRecvPath(portID, channelID))
342-
merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.GetPrefix(), merklePath)
342+
merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.Prefix, merklePath)
343343
if err != nil {
344344
return err
345345
}
@@ -376,7 +376,7 @@ func (k Keeper) VerifyChannelUpgradeError(
376376
}
377377

378378
merklePath := commitmenttypes.NewMerklePath(host.ChannelUpgradeErrorPath(portID, channelID))
379-
merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.GetPrefix(), merklePath)
379+
merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.Prefix, merklePath)
380380
if err != nil {
381381
return err
382382
}
@@ -418,7 +418,7 @@ func (k Keeper) VerifyChannelUpgrade(
418418
}
419419

420420
merklePath := commitmenttypes.NewMerklePath(host.ChannelUpgradePath(portID, channelID))
421-
merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.GetPrefix(), merklePath)
421+
merklePath, err = commitmenttypes.ApplyPrefix(connection.Counterparty.Prefix, merklePath)
422422
if err != nil {
423423
return err
424424
}

‎modules/core/03-connection/types/connection.go

-16
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types"
77
host "github.com/cosmos/ibc-go/v8/modules/core/24-host"
88
ibcerrors "github.com/cosmos/ibc-go/v8/modules/core/errors"
9-
"github.com/cosmos/ibc-go/v8/modules/core/exported"
109
)
1110

1211
// NewConnectionEnd creates a new ConnectionEnd instance.
@@ -47,21 +46,6 @@ func NewCounterparty(clientID, connectionID string, prefix commitmenttypes.Merkl
4746
}
4847
}
4948

50-
// GetClientID implements the CounterpartyConnectionI interface
51-
func (c Counterparty) GetClientID() string {
52-
return c.ClientId
53-
}
54-
55-
// GetConnectionID implements the CounterpartyConnectionI interface
56-
func (c Counterparty) GetConnectionID() string {
57-
return c.ConnectionId
58-
}
59-
60-
// GetPrefix implements the CounterpartyConnectionI interface
61-
func (c Counterparty) GetPrefix() exported.Prefix {
62-
return &c.Prefix
63-
}
64-
6549
// ValidateBasic performs a basic validation check of the identifiers and prefix
6650
func (c Counterparty) ValidateBasic() error {
6751
if c.ConnectionId != "" {

‎modules/core/04-channel/keeper/handshake.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func (k Keeper) ChanOpenTry(
152152
)
153153
}
154154

155-
counterpartyHops := []string{connectionEnd.Counterparty.GetConnectionID()}
155+
counterpartyHops := []string{connectionEnd.Counterparty.ConnectionId}
156156

157157
// expectedCounterpaty is the counterparty of the counterparty's channel end
158158
// (i.e self)
@@ -243,7 +243,7 @@ func (k Keeper) ChanOpenAck(
243243
return errorsmod.Wrapf(connectiontypes.ErrInvalidConnectionState, "connection state is not OPEN (got %s)", connectionEnd.State)
244244
}
245245

246-
counterpartyHops := []string{connectionEnd.Counterparty.GetConnectionID()}
246+
counterpartyHops := []string{connectionEnd.Counterparty.ConnectionId}
247247

248248
// counterparty of the counterparty channel end (i.e self)
249249
expectedCounterparty := types.NewCounterparty(portID, channelID)
@@ -319,7 +319,7 @@ func (k Keeper) ChanOpenConfirm(
319319
return errorsmod.Wrapf(connectiontypes.ErrInvalidConnectionState, "connection state is not OPEN (got %s)", connectionEnd.State)
320320
}
321321

322-
counterpartyHops := []string{connectionEnd.Counterparty.GetConnectionID()}
322+
counterpartyHops := []string{connectionEnd.Counterparty.ConnectionId}
323323

324324
counterparty := types.NewCounterparty(portID, channelID)
325325
expectedChannel := types.NewChannel(
@@ -445,7 +445,7 @@ func (k Keeper) ChanCloseConfirm(
445445
return errorsmod.Wrapf(connectiontypes.ErrInvalidConnectionState, "connection state is not OPEN (got %s)", connectionEnd.State)
446446
}
447447

448-
counterpartyHops := []string{connectionEnd.Counterparty.GetConnectionID()}
448+
counterpartyHops := []string{connectionEnd.Counterparty.ConnectionId}
449449

450450
counterparty := types.NewCounterparty(portID, channelID)
451451
expectedChannel := types.Channel{

‎modules/core/04-channel/keeper/timeout.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ func (k Keeper) TimeoutOnClose(
263263
return errorsmod.Wrapf(types.ErrInvalidPacket, "packet commitment bytes are not equal: got (%v), expected (%v)", commitment, packetCommitment)
264264
}
265265

266-
counterpartyHops := []string{connectionEnd.Counterparty.GetConnectionID()}
266+
counterpartyHops := []string{connectionEnd.Counterparty.ConnectionId}
267267

268268
counterparty := types.NewCounterparty(packet.GetSourcePort(), packet.GetSourceChannel())
269269
expectedChannel := types.Channel{

‎modules/core/04-channel/keeper/upgrade.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func (k Keeper) ChanUpgradeTry(
104104

105105
// construct expected counterparty channel from information in state
106106
// only the counterpartyUpgradeSequence is provided by the relayer
107-
counterpartyConnectionHops := []string{connection.Counterparty.GetConnectionID()}
107+
counterpartyConnectionHops := []string{connection.Counterparty.ConnectionId}
108108
counterpartyChannel := types.Channel{
109109
State: types.OPEN,
110110
Ordering: channel.Ordering,
@@ -278,7 +278,7 @@ func (k Keeper) ChanUpgradeAck(
278278
return errorsmod.Wrapf(connectiontypes.ErrInvalidConnectionState, "connection state is not OPEN (got %s)", connection.State)
279279
}
280280

281-
counterpartyHops := []string{connection.Counterparty.GetConnectionID()}
281+
counterpartyHops := []string{connection.Counterparty.ConnectionId}
282282
counterpartyChannel := types.Channel{
283283
State: types.FLUSHING,
284284
Ordering: channel.Ordering,
@@ -414,7 +414,7 @@ func (k Keeper) ChanUpgradeConfirm(
414414
return errorsmod.Wrapf(connectiontypes.ErrInvalidConnectionState, "connection state is not OPEN (got %s)", connection.State)
415415
}
416416

417-
counterpartyHops := []string{connection.Counterparty.GetConnectionID()}
417+
counterpartyHops := []string{connection.Counterparty.ConnectionId}
418418
counterpartyChannel := types.Channel{
419419
State: counterpartyChannelState,
420420
Ordering: channel.Ordering,
@@ -537,7 +537,7 @@ func (k Keeper) ChanUpgradeOpen(
537537
counterpartyChannel = types.Channel{
538538
State: types.OPEN,
539539
Ordering: upgrade.Fields.Ordering,
540-
ConnectionHops: []string{upgradeConnection.Counterparty.GetConnectionID()},
540+
ConnectionHops: []string{upgradeConnection.Counterparty.ConnectionId},
541541
Counterparty: types.NewCounterparty(portID, channelID),
542542
Version: upgrade.Fields.Version,
543543
UpgradeSequence: counterpartyUpgradeSequence,
@@ -547,7 +547,7 @@ func (k Keeper) ChanUpgradeOpen(
547547
counterpartyChannel = types.Channel{
548548
State: types.FLUSHCOMPLETE,
549549
Ordering: channel.Ordering,
550-
ConnectionHops: []string{connection.Counterparty.GetConnectionID()},
550+
ConnectionHops: []string{connection.Counterparty.ConnectionId},
551551
Counterparty: types.NewCounterparty(portID, channelID),
552552
Version: channel.Version,
553553
UpgradeSequence: channel.UpgradeSequence,
@@ -769,7 +769,7 @@ func (k Keeper) ChanUpgradeTimeout(
769769
upgrade.Fields.ConnectionHops[0],
770770
)
771771
}
772-
counterpartyHops := []string{upgradeConnection.Counterparty.GetConnectionID()}
772+
counterpartyHops := []string{upgradeConnection.Counterparty.ConnectionId}
773773

774774
upgradeAlreadyComplete := upgrade.Fields.Version == counterpartyChannel.Version && upgrade.Fields.Ordering == counterpartyChannel.Ordering && upgrade.Fields.ConnectionHops[0] == counterpartyHops[0]
775775
if upgradeAlreadyComplete {
@@ -895,9 +895,9 @@ func (k Keeper) checkForUpgradeCompatibility(ctx sdk.Context, upgradeFields, cou
895895
}
896896

897897
// connectionHops can change in a channelUpgrade, however both sides must still be each other's counterparty.
898-
if counterpartyUpgradeFields.ConnectionHops[0] != connection.Counterparty.GetConnectionID() {
898+
if counterpartyUpgradeFields.ConnectionHops[0] != connection.Counterparty.ConnectionId {
899899
return errorsmod.Wrapf(
900-
types.ErrIncompatibleCounterpartyUpgrade, "counterparty upgrade connection end is not a counterparty of self proposed connection end (%s != %s)", counterpartyUpgradeFields.ConnectionHops[0], connection.Counterparty.GetConnectionID())
900+
types.ErrIncompatibleCounterpartyUpgrade, "counterparty upgrade connection end is not a counterparty of self proposed connection end (%s != %s)", counterpartyUpgradeFields.ConnectionHops[0], connection.Counterparty.ConnectionId)
901901
}
902902

903903
return nil

0 commit comments

Comments
 (0)
Please sign in to comment.