Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure IBC Proto Registration #7210

Merged
merged 14 commits into from
Sep 1, 2020
Merged
Prev Previous commit
Next Next commit
ensure exported interfaces and their concrete implementations are reg…
…istered in ibc modules
  • Loading branch information
jackzampolin committed Aug 31, 2020
commit 565cf916f7bd17acad5f3c349b58dddcd3bcf92d
8 changes: 8 additions & 0 deletions x/ibc/02-client/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
"cosmos_sdk.ibc.v1.client.Header",
(*exported.Header)(nil),
)
registry.RegisterInterface(
"cosmos_sdk.ibc.v1.client.Height",
(*exported.Height)(nil),
)
registry.RegisterImplementations(
(*exported.Height)(nil),
&Height{},
)
}

var (
Expand Down
17 changes: 17 additions & 0 deletions x/ibc/03-connection/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,28 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/ibc/03-connection/exported"
)

// RegisterInterfaces register the ibc interfaces submodule implementations to protobuf
// Any.
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
registry.RegisterInterface(
"cosmos_sdk.ibc.v1.connection.ConnectionI",
(*exported.ConnectionI)(nil),
)
registry.RegisterInterface(
"cosmos_sdk.ibc.v1.connection.CounterpartyI",
(*exported.CounterpartyI)(nil),
)
registry.RegisterImplementations(
(*exported.ConnectionI)(nil),
&ConnectionEnd{},
)
registry.RegisterImplementations(
(*exported.CounterpartyI)(nil),
&Counterparty{},
)
registry.RegisterImplementations(
(*sdk.Msg)(nil),
&MsgConnectionOpenInit{},
Expand Down
25 changes: 25 additions & 0 deletions x/ibc/04-channel/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,36 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/ibc/04-channel/exported"
)

// RegisterInterfaces register the ibc channel submodule interfaces to protobuf
// Any.
func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
registry.RegisterInterface(
"cosmos_sdk.ibc.v1.channel.ChannelI",
(*exported.ChannelI)(nil),
)
registry.RegisterInterface(
"cosmos_sdk.ibc.v1.channel.CounterpartyI",
(*exported.CounterpartyI)(nil),
)
registry.RegisterInterface(
"cosmos_sdk.ibc.v1.channel.PacketI",
(*exported.PacketI)(nil),
)
registry.RegisterImplementations(
(*exported.ChannelI)(nil),
&Channel{},
)
registry.RegisterImplementations(
(*exported.CounterpartyI)(nil),
&Counterparty{},
)
registry.RegisterImplementations(
(*exported.PacketI)(nil),
&Packet{},
)
registry.RegisterImplementations(
(*sdk.Msg)(nil),
&MsgChannelOpenInit{},
Expand Down
12 changes: 12 additions & 0 deletions x/ibc/07-tendermint/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package types
import (
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
clientexported "github.com/cosmos/cosmos-sdk/x/ibc/02-client/exported"
)

Expand All @@ -21,6 +22,17 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) {
(*clientexported.Misbehaviour)(nil),
&Misbehaviour{},
)
registry.RegisterImplementations(
(*clientexported.Header)(nil),
&Header{},
)
registry.RegisterImplementations(
(*sdk.Msg)(nil),
&MsgCreateClient{},
&MsgSubmitClientMisbehaviour{},
&MsgUpdateClient{},
)

}

var (
Expand Down