Skip to content

Commit

Permalink
refactor!: remove unnecessary exported.ChannelI interface (cosmos#5703)
Browse files Browse the repository at this point in the history
* refactor: remove unnecessary channelI interface

* docs: add migration docs entry

* lint
  • Loading branch information
colin-axner committed Jan 24, 2024
1 parent 65306ac commit 203ea71
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 41 deletions.
4 changes: 3 additions & 1 deletion docs/docs/05-migrations/13-v8-to-v9.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ There are four sections based on the four potential user groups of this document

## IBC Apps

- No relevant changes were made in this release.
### API removals

The `exported.ChannelI` interface has been removed. Please use the concrete type.

## Relayers

Expand Down
8 changes: 0 additions & 8 deletions modules/core/02-client/migrations/v7/solomachine.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,6 @@ func (ClientState) VerifyConnectionState(
panic(errors.New("legacy solo machine is deprecated"))
}

// VerifyChannelState panics!
func (ClientState) VerifyChannelState(
storetypes.KVStore, codec.BinaryCodec, exported.Height, exported.Prefix,
[]byte, string, string, exported.ChannelI,
) error {
panic(errors.New("legacy solo machine is deprecated"))
}

// VerifyPacketCommitment panics!
func (ClientState) VerifyPacketCommitment(
sdk.Context, storetypes.KVStore, codec.BinaryCodec, exported.Height,
Expand Down
9 changes: 2 additions & 7 deletions modules/core/03-connection/keeper/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func (k Keeper) VerifyChannelState(
proof []byte,
portID,
channelID string,
channel exported.ChannelI,
channel channeltypes.Channel,
) error {
clientID := connection.GetClientID()
clientState, clientStore, err := k.getClientStateAndVerificationStore(ctx, clientID)
Expand All @@ -174,12 +174,7 @@ func (k Keeper) VerifyChannelState(
return err
}

channelEnd, ok := channel.(channeltypes.Channel)
if !ok {
return errorsmod.Wrapf(ibcerrors.ErrInvalidType, "invalid channel type %T", channel)
}

bz, err := k.cdc.Marshal(&channelEnd)
bz, err := k.cdc.Marshal(&channel)
if err != nil {
return err
}
Expand Down
5 changes: 1 addition & 4 deletions modules/core/04-channel/types/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ import (
"github.com/cosmos/ibc-go/v8/modules/core/exported"
)

var (
_ exported.ChannelI = (*Channel)(nil)
_ exported.CounterpartyChannelI = (*Counterparty)(nil)
)
var _ exported.CounterpartyChannelI = (*Counterparty)(nil)

// NewChannel creates a new Channel instance
func NewChannel(
Expand Down
5 changes: 0 additions & 5 deletions modules/core/04-channel/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ import (
// RegisterInterfaces register the ibc channel submodule interfaces to protobuf
// Any.
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
registry.RegisterInterface(
"ibc.core.channel.v1.ChannelI",
(*exported.ChannelI)(nil),
&Channel{},
)
registry.RegisterInterface(
"ibc.core.channel.v1.CounterpartyChannelI",
(*exported.CounterpartyChannelI)(nil),
Expand Down
5 changes: 0 additions & 5 deletions modules/core/04-channel/types/codec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ func TestCodecTypeRegistration(t *testing.T) {
typeURL string
expPass bool
}{
{
"success: Channel",
sdk.MsgTypeURL(&types.Channel{}),
true,
},
{
"success: Counterparty",
sdk.MsgTypeURL(&types.Counterparty{}),
Expand Down
2 changes: 1 addition & 1 deletion modules/core/04-channel/types/expected_keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type ConnectionKeeper interface {
proof []byte,
portID,
channelID string,
channel exported.ChannelI,
channel Channel,
) error
VerifyPacketCommitment(
ctx sdk.Context,
Expand Down
10 changes: 0 additions & 10 deletions modules/core/exported/channel.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
package exported

// ChannelI defines the standard interface for a channel end.
type ChannelI interface {
GetState() int32
GetOrdering() int32
GetCounterparty() CounterpartyChannelI
GetConnectionHops() []string
GetVersion() string
ValidateBasic() error
}

// CounterpartyChannelI defines the standard interface for a channel end's
// counterparty.
type CounterpartyChannelI interface {
Expand Down

0 comments on commit 203ea71

Please sign in to comment.