From ae8ea8f391935ed252ec7e37e973d047967f0cff Mon Sep 17 00:00:00 2001 From: Jack Zampolin Date: Tue, 12 Nov 2019 10:46:17 -0800 Subject: [PATCH] Modify codec registration style to match previous working state --- x/ibc/02-client/types/codec.go | 8 +++++--- x/ibc/03-connection/types/codec.go | 8 +++++--- x/ibc/04-channel/types/codec.go | 6 +++--- x/ibc/23-commitment/codec.go | 8 +++++--- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/x/ibc/02-client/types/codec.go b/x/ibc/02-client/types/codec.go index 551403e6ad89..d595f583baa9 100644 --- a/x/ibc/02-client/types/codec.go +++ b/x/ibc/02-client/types/codec.go @@ -7,7 +7,7 @@ import ( ) // SubModuleCdc defines the IBC client codec. -var SubModuleCdc = codec.New() +var SubModuleCdc *codec.Codec // RegisterCodec registers the IBC client interfaces and types func RegisterCodec(cdc *codec.Codec) { @@ -22,8 +22,10 @@ func RegisterCodec(cdc *codec.Codec) { cdc.RegisterConcrete(tendermint.ConsensusState{}, "ibc/client/tendermint/ConsensusState", nil) cdc.RegisterConcrete(tendermint.Header{}, "ibc/client/tendermint/Header", nil) cdc.RegisterConcrete(tendermint.Evidence{}, "ibc/client/tendermint/Evidence", nil) + + SetSubModuleCodec(cdc) } -func init() { - RegisterCodec(SubModuleCdc) +func SetSubModuleCodec(cdc *codec.Codec) { + SubModuleCdc = cdc } diff --git a/x/ibc/03-connection/types/codec.go b/x/ibc/03-connection/types/codec.go index 23fb04e37a8f..4317d3c6d539 100644 --- a/x/ibc/03-connection/types/codec.go +++ b/x/ibc/03-connection/types/codec.go @@ -5,7 +5,7 @@ import ( ) // SubModuleCdc defines the IBC connection codec. -var SubModuleCdc = codec.New() +var SubModuleCdc *codec.Codec // RegisterCodec registers the IBC connection types func RegisterCodec(cdc *codec.Codec) { @@ -14,8 +14,10 @@ func RegisterCodec(cdc *codec.Codec) { cdc.RegisterConcrete(MsgConnectionOpenAck{}, "ibc/connection/MsgConnectionOpenAck", nil) cdc.RegisterConcrete(MsgConnectionOpenConfirm{}, "ibc/connection/MsgConnectionOpenConfirm", nil) cdc.RegisterConcrete(ConnectionEnd{}, "ibc/connection/ConnectionEnd", nil) + + SetSubModuleCodec(cdc) } -func init() { - RegisterCodec(SubModuleCdc) +func SetSubModuleCodec(cdc *codec.Codec) { + SubModuleCdc = cdc } diff --git a/x/ibc/04-channel/types/codec.go b/x/ibc/04-channel/types/codec.go index 0839edede775..06c268e3e307 100644 --- a/x/ibc/04-channel/types/codec.go +++ b/x/ibc/04-channel/types/codec.go @@ -6,7 +6,7 @@ import ( ) // SubModuleCdc defines the IBC channel codec. -var SubModuleCdc = codec.New() +var SubModuleCdc *codec.Codec // RegisterCodec registers all the necessary types and interfaces for the // IBC channel. @@ -23,6 +23,6 @@ func RegisterCodec(cdc *codec.Codec) { cdc.RegisterConcrete(MsgChannelCloseConfirm{}, "ibc/channel/MsgChannelCloseConfirm", nil) } -func init() { - RegisterCodec(SubModuleCdc) +func SetSubModuleCodec(cdc *codec.Codec) { + SubModuleCdc = cdc } diff --git a/x/ibc/23-commitment/codec.go b/x/ibc/23-commitment/codec.go index 6e977ac1e678..1fc535cfc0ca 100644 --- a/x/ibc/23-commitment/codec.go +++ b/x/ibc/23-commitment/codec.go @@ -4,7 +4,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" ) -var SubModuleCdc = codec.New() +var SubModuleCdc *codec.Codec // RegisterCodec registers types declared in this package func RegisterCodec(cdc *codec.Codec) { @@ -17,8 +17,10 @@ func RegisterCodec(cdc *codec.Codec) { cdc.RegisterConcrete(Prefix{}, "ibc/commitment/merkle/Prefix", nil) cdc.RegisterConcrete(Path{}, "ibc/commitment/merkle/Path", nil) cdc.RegisterConcrete(Proof{}, "ibc/commitment/merkle/Proof", nil) + + SetSubModuleCodec(cdc) } -func init() { - RegisterCodec(SubModuleCdc) +func SetSubModuleCodec(cdc *codec.Codec) { + SubModuleCdc = cdc }