From 8efdf2443f8f547405d1fd6bb362d860ef59d700 Mon Sep 17 00:00:00 2001 From: John Letey Date: Thu, 11 May 2023 12:23:40 +0200 Subject: [PATCH 1/4] fix: support Ledger for `MsgCreateStaker` --- x/stakers/module.go | 2 +- x/stakers/types/codec.go | 17 +++++++++++++---- x/stakers/types/message_create_staker.go | 18 +++++++++++++++++- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/x/stakers/module.go b/x/stakers/module.go index 655bc218..31a89053 100644 --- a/x/stakers/module.go +++ b/x/stakers/module.go @@ -46,7 +46,7 @@ func (AppModuleBasic) Name() string { // RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) + types.RegisterLegacyAminoCodec(cdc) } // RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message diff --git a/x/stakers/types/codec.go b/x/stakers/types/codec.go index cc23de45..db4bdda2 100644 --- a/x/stakers/types/codec.go +++ b/x/stakers/types/codec.go @@ -2,13 +2,16 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + codecTypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptoCodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" ) -func RegisterCodec(_ *codec.LegacyAmino) {} +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgCreateStaker{}, "kyve/stakers/MsgCreateStaker", nil) +} -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { +func RegisterInterfaces(registry codecTypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgCreateStaker{}) registry.RegisterImplementations((*sdk.Msg)(nil), &MsgUpdateCommission{}) registry.RegisterImplementations((*sdk.Msg)(nil), &MsgUpdateMetadata{}) @@ -19,5 +22,11 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { var ( Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) + ModuleCdc = codec.NewProtoCodec(codecTypes.NewInterfaceRegistry()) ) + +func init() { + RegisterLegacyAminoCodec(Amino) + cryptoCodec.RegisterCrypto(Amino) + sdk.RegisterLegacyAminoCodec(Amino) +} diff --git a/x/stakers/types/message_create_staker.go b/x/stakers/types/message_create_staker.go index 7947ec07..abb3d8c4 100644 --- a/x/stakers/types/message_create_staker.go +++ b/x/stakers/types/message_create_staker.go @@ -5,9 +5,17 @@ import ( "github.com/KYVENetwork/chain/util" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) -var _ sdk.Msg = &MsgCreateStaker{} +var ( + _ legacytx.LegacyMsg = &MsgCreateStaker{} + _ sdk.Msg = &MsgCreateStaker{} +) + +func (msg *MsgCreateStaker) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg)) +} func (msg *MsgCreateStaker) GetSigners() []sdk.AccAddress { creator, err := sdk.AccAddressFromBech32(msg.Creator) @@ -18,6 +26,14 @@ func (msg *MsgCreateStaker) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{creator} } +func (msg *MsgCreateStaker) Route() string { + return RouterKey +} + +func (msg *MsgCreateStaker) Type() string { + return "kyve/stakers/MsgCreateStaker" +} + func (msg *MsgCreateStaker) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address: %s", err) From fd32e6a36a9ca85c78f3cc58b06a931005249518 Mon Sep 17 00:00:00 2001 From: John Letey Date: Thu, 11 May 2023 16:30:08 +0200 Subject: [PATCH 2/4] fix: finish Ledger support for `x/stakers` --- x/stakers/types/codec.go | 7 ++++- x/stakers/types/message_create_staker.go | 3 +- x/stakers/types/message_join_pool.go | 19 ++++++++++++- x/stakers/types/message_leave_pool.go | 27 ++++++++++-------- x/stakers/types/message_update_commission.go | 29 ++++++++++++++++---- x/stakers/types/message_update_metadata.go | 28 ++++++++++--------- 6 files changed, 80 insertions(+), 33 deletions(-) diff --git a/x/stakers/types/codec.go b/x/stakers/types/codec.go index db4bdda2..beaa92ae 100644 --- a/x/stakers/types/codec.go +++ b/x/stakers/types/codec.go @@ -9,6 +9,11 @@ import ( func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgCreateStaker{}, "kyve/stakers/MsgCreateStaker", nil) + cdc.RegisterConcrete(&MsgUpdateCommission{}, "kyve/stakers/MsgUpdateCommission", nil) + cdc.RegisterConcrete(&MsgUpdateMetadata{}, "kyve/stakers/MsgUpdateMetadata", nil) + cdc.RegisterConcrete(&MsgJoinPool{}, "kyve/stakers/MsgJoinPool", nil) + cdc.RegisterConcrete(&MsgLeavePool{}, "kyve/stakers/MsgLeavePool", nil) + cdc.RegisterConcrete(&MsgUpdateParams{}, "kyve/stakers/MsgUpdateParams", nil) } func RegisterInterfaces(registry codecTypes.InterfaceRegistry) { @@ -22,7 +27,7 @@ func RegisterInterfaces(registry codecTypes.InterfaceRegistry) { var ( Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(codecTypes.NewInterfaceRegistry()) + ModuleCdc = codec.NewAminoCodec(Amino) ) func init() { diff --git a/x/stakers/types/message_create_staker.go b/x/stakers/types/message_create_staker.go index abb3d8c4..1f585c74 100644 --- a/x/stakers/types/message_create_staker.go +++ b/x/stakers/types/message_create_staker.go @@ -14,7 +14,8 @@ var ( ) func (msg *MsgCreateStaker) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(msg)) + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) } func (msg *MsgCreateStaker) GetSigners() []sdk.AccAddress { diff --git a/x/stakers/types/message_join_pool.go b/x/stakers/types/message_join_pool.go index 20a857f9..193e8c8d 100644 --- a/x/stakers/types/message_join_pool.go +++ b/x/stakers/types/message_join_pool.go @@ -5,9 +5,18 @@ import ( "github.com/KYVENetwork/chain/util" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) -var _ sdk.Msg = &MsgJoinPool{} +var ( + _ legacytx.LegacyMsg = &MsgJoinPool{} + _ sdk.Msg = &MsgJoinPool{} +) + +func (msg *MsgJoinPool) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} func (msg *MsgJoinPool) GetSigners() []sdk.AccAddress { creator, err := sdk.AccAddressFromBech32(msg.Creator) @@ -18,6 +27,14 @@ func (msg *MsgJoinPool) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{creator} } +func (msg *MsgJoinPool) Route() string { + return RouterKey +} + +func (msg *MsgJoinPool) Type() string { + return "kyve/stakers/MsgJoinPool" +} + func (msg *MsgJoinPool) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address: %s", err) diff --git a/x/stakers/types/message_leave_pool.go b/x/stakers/types/message_leave_pool.go index a448ef64..c0a372a4 100644 --- a/x/stakers/types/message_leave_pool.go +++ b/x/stakers/types/message_leave_pool.go @@ -4,18 +4,17 @@ import ( "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) -const TypeMsgLeavePool = "leave_pool" - -var _ sdk.Msg = &MsgLeavePool{} - -func (msg *MsgLeavePool) Route() string { - return RouterKey -} +var ( + _ legacytx.LegacyMsg = &MsgLeavePool{} + _ sdk.Msg = &MsgLeavePool{} +) -func (msg *MsgLeavePool) Type() string { - return TypeMsgLeavePool +func (msg *MsgLeavePool) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) } func (msg *MsgLeavePool) GetSigners() []sdk.AccAddress { @@ -23,12 +22,16 @@ func (msg *MsgLeavePool) GetSigners() []sdk.AccAddress { if err != nil { panic(err) } + return []sdk.AccAddress{creator} } -func (msg *MsgLeavePool) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) +func (msg *MsgLeavePool) Route() string { + return RouterKey +} + +func (msg *MsgLeavePool) Type() string { + return "kyve/stakers/MsgLeavePool" } func (msg *MsgLeavePool) ValidateBasic() error { diff --git a/x/stakers/types/message_update_commission.go b/x/stakers/types/message_update_commission.go index e8fb1aed..c8c5f370 100644 --- a/x/stakers/types/message_update_commission.go +++ b/x/stakers/types/message_update_commission.go @@ -5,17 +5,36 @@ import ( "github.com/KYVENetwork/chain/util" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) -var _ sdk.Msg = &MsgUpdateCommission{} +var ( + _ legacytx.LegacyMsg = &MsgUpdateCommission{} + _ sdk.Msg = &MsgUpdateCommission{} +) + +func (msg *MsgUpdateCommission) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} -// GetSigners returns the expected signers for a MsgUpdateCommission message. func (msg *MsgUpdateCommission) GetSigners() []sdk.AccAddress { - validator, _ := sdk.AccAddressFromBech32(msg.Creator) - return []sdk.AccAddress{validator} + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + + return []sdk.AccAddress{creator} +} + +func (msg *MsgUpdateCommission) Route() string { + return RouterKey +} + +func (msg *MsgUpdateCommission) Type() string { + return "kyve/stakers/MsgUpdateCommission" } -// ValidateBasic does a sanity check on the provided data. func (msg *MsgUpdateCommission) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid validator address: %s", err) diff --git a/x/stakers/types/message_update_metadata.go b/x/stakers/types/message_update_metadata.go index c9291699..406345e5 100644 --- a/x/stakers/types/message_update_metadata.go +++ b/x/stakers/types/message_update_metadata.go @@ -4,21 +4,19 @@ import ( "encoding/hex" "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) -const TypeMsgUpdateMetadata = "update_metadata" - -var _ sdk.Msg = &MsgUpdateMetadata{} - -func (msg *MsgUpdateMetadata) Route() string { - return RouterKey -} +var ( + _ legacytx.LegacyMsg = &MsgUpdateMetadata{} + _ sdk.Msg = &MsgUpdateMetadata{} +) -func (msg *MsgUpdateMetadata) Type() string { - return TypeMsgUpdateMetadata +func (msg *MsgUpdateMetadata) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) } func (msg *MsgUpdateMetadata) GetSigners() []sdk.AccAddress { @@ -26,12 +24,16 @@ func (msg *MsgUpdateMetadata) GetSigners() []sdk.AccAddress { if err != nil { panic(err) } + return []sdk.AccAddress{creator} } -func (msg *MsgUpdateMetadata) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) +func (msg *MsgUpdateMetadata) Route() string { + return RouterKey +} + +func (msg *MsgUpdateMetadata) Type() string { + return "kyve/stakers/MsgUpdateMetadata" } func (msg *MsgUpdateMetadata) ValidateBasic() error { From a5103ab12a7706d290143403ee931bd97457e007 Mon Sep 17 00:00:00 2001 From: John Letey Date: Fri, 12 May 2023 10:32:24 +0200 Subject: [PATCH 3/4] fix: finish remaining modules --- x/bundles/module.go | 2 +- x/bundles/types/codec.go | 20 ++++++++--- .../types/message_claim_uploader_role.go | 27 ++++++++------- x/bundles/types/message_skip_uploader_role.go | 27 ++++++++------- .../types/message_submit_bundle_proposal.go | 27 ++++++++------- .../types/message_vote_bundle_proposal.go | 27 ++++++++------- x/delegation/module.go | 2 +- x/delegation/types/codec.go | 20 ++++++++--- x/delegation/types/message_delegate.go | 33 ++++++++++--------- x/delegation/types/message_redelegate.go | 31 +++++++++-------- x/delegation/types/message_undelegate.go | 33 ++++++++++--------- .../types/message_withdraw_rewards.go | 33 ++++++++++--------- x/pool/module.go | 2 +- x/pool/types/codec.go | 18 +++++++--- x/pool/types/message_defund_pool.go | 27 ++++++++------- x/pool/types/message_fund_pool.go | 19 ++++++++++- x/team/module.go | 2 +- x/team/types/codec.go | 21 +++++++++--- x/team/types/message_claim_account_rewards.go | 27 ++++++++------- .../types/message_claim_authority_rewards.go | 26 ++++++++------- x/team/types/message_claim_unlocked.go | 27 ++++++++------- x/team/types/message_clawback.go | 27 ++++++++------- .../message_create_team_vesting_account.go | 27 ++++++++------- 23 files changed, 305 insertions(+), 200 deletions(-) diff --git a/x/bundles/module.go b/x/bundles/module.go index 13b211ca..c27f0c28 100644 --- a/x/bundles/module.go +++ b/x/bundles/module.go @@ -46,7 +46,7 @@ func (AppModuleBasic) Name() string { // RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) + types.RegisterLegacyAminoCodec(cdc) } // RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message diff --git a/x/bundles/types/codec.go b/x/bundles/types/codec.go index c04e0578..0266612b 100644 --- a/x/bundles/types/codec.go +++ b/x/bundles/types/codec.go @@ -2,13 +2,19 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + codecTypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptoCodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" ) -func RegisterCodec(_ *codec.LegacyAmino) {} +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgSubmitBundleProposal{}, "kyve/bundles/MsgSubmitBundleProposal", nil) + cdc.RegisterConcrete(&MsgVoteBundleProposal{}, "kyve/bundles/MsgVoteBundleProposal", nil) + cdc.RegisterConcrete(&MsgClaimUploaderRole{}, "kyve/bundles/MsgClaimUploaderRole", nil) + cdc.RegisterConcrete(&MsgSkipUploaderRole{}, "kyve/bundles/MsgSkipUploaderRole", nil) +} -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { +func RegisterInterfaces(registry codecTypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgSubmitBundleProposal{}) registry.RegisterImplementations((*sdk.Msg)(nil), &MsgVoteBundleProposal{}) registry.RegisterImplementations((*sdk.Msg)(nil), &MsgClaimUploaderRole{}) @@ -18,5 +24,11 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { var ( Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) + ModuleCdc = codec.NewAminoCodec(Amino) ) + +func init() { + RegisterLegacyAminoCodec(Amino) + cryptoCodec.RegisterCrypto(Amino) + sdk.RegisterLegacyAminoCodec(Amino) +} diff --git a/x/bundles/types/message_claim_uploader_role.go b/x/bundles/types/message_claim_uploader_role.go index 48510aa4..6efd8d94 100644 --- a/x/bundles/types/message_claim_uploader_role.go +++ b/x/bundles/types/message_claim_uploader_role.go @@ -4,11 +4,13 @@ import ( "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) -const TypeMsgClaimUploaderRole = "claim_uploader_role" - -var _ sdk.Msg = &MsgClaimUploaderRole{} +var ( + _ legacytx.LegacyMsg = &MsgClaimUploaderRole{} + _ sdk.Msg = &MsgClaimUploaderRole{} +) func NewMsgClaimUploaderRole(creator string, staker string, poolId uint64) *MsgClaimUploaderRole { return &MsgClaimUploaderRole{ @@ -18,12 +20,9 @@ func NewMsgClaimUploaderRole(creator string, staker string, poolId uint64) *MsgC } } -func (msg *MsgClaimUploaderRole) Route() string { - return RouterKey -} - -func (msg *MsgClaimUploaderRole) Type() string { - return TypeMsgClaimUploaderRole +func (msg *MsgClaimUploaderRole) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) } func (msg *MsgClaimUploaderRole) GetSigners() []sdk.AccAddress { @@ -31,12 +30,16 @@ func (msg *MsgClaimUploaderRole) GetSigners() []sdk.AccAddress { if err != nil { panic(err) } + return []sdk.AccAddress{creator} } -func (msg *MsgClaimUploaderRole) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) +func (msg *MsgClaimUploaderRole) Route() string { + return RouterKey +} + +func (msg *MsgClaimUploaderRole) Type() string { + return "kyve/bundles/MsgClaimUploaderRole" } func (msg *MsgClaimUploaderRole) ValidateBasic() error { diff --git a/x/bundles/types/message_skip_uploader_role.go b/x/bundles/types/message_skip_uploader_role.go index 3aa3f58f..47d2811d 100644 --- a/x/bundles/types/message_skip_uploader_role.go +++ b/x/bundles/types/message_skip_uploader_role.go @@ -4,11 +4,13 @@ import ( "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) -const TypeMsgSkipUploaderRole = "skip_uploader_role" - -var _ sdk.Msg = &MsgSkipUploaderRole{} +var ( + _ legacytx.LegacyMsg = &MsgSkipUploaderRole{} + _ sdk.Msg = &MsgSkipUploaderRole{} +) func NewMsgSkipUploaderRole(creator string, staker string, poolId uint64, fromIndex uint64) *MsgSkipUploaderRole { return &MsgSkipUploaderRole{ @@ -19,12 +21,9 @@ func NewMsgSkipUploaderRole(creator string, staker string, poolId uint64, fromIn } } -func (msg *MsgSkipUploaderRole) Route() string { - return RouterKey -} - -func (msg *MsgSkipUploaderRole) Type() string { - return TypeMsgSkipUploaderRole +func (msg *MsgSkipUploaderRole) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) } func (msg *MsgSkipUploaderRole) GetSigners() []sdk.AccAddress { @@ -32,12 +31,16 @@ func (msg *MsgSkipUploaderRole) GetSigners() []sdk.AccAddress { if err != nil { panic(err) } + return []sdk.AccAddress{creator} } -func (msg *MsgSkipUploaderRole) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) +func (msg *MsgSkipUploaderRole) Route() string { + return RouterKey +} + +func (msg *MsgSkipUploaderRole) Type() string { + return "kyve/bundles/MsgSkipUploaderRole" } func (msg *MsgSkipUploaderRole) ValidateBasic() error { diff --git a/x/bundles/types/message_submit_bundle_proposal.go b/x/bundles/types/message_submit_bundle_proposal.go index afd860c5..e0b1c382 100644 --- a/x/bundles/types/message_submit_bundle_proposal.go +++ b/x/bundles/types/message_submit_bundle_proposal.go @@ -4,11 +4,13 @@ import ( "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) -const TypeMsgSubmitBundleProposal = "submit_bundle_proposal" - -var _ sdk.Msg = &MsgSubmitBundleProposal{} +var ( + _ legacytx.LegacyMsg = &MsgSubmitBundleProposal{} + _ sdk.Msg = &MsgSubmitBundleProposal{} +) func NewMsgSubmitBundleProposal(creator string, staker string, poolId uint64, storageId string, dataSize uint64, dataHash string, fromIndex uint64, bundleSize uint64, fromKey string, toKey string, bundleSummary string) *MsgSubmitBundleProposal { return &MsgSubmitBundleProposal{ @@ -26,12 +28,9 @@ func NewMsgSubmitBundleProposal(creator string, staker string, poolId uint64, st } } -func (msg *MsgSubmitBundleProposal) Route() string { - return RouterKey -} - -func (msg *MsgSubmitBundleProposal) Type() string { - return TypeMsgSubmitBundleProposal +func (msg *MsgSubmitBundleProposal) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) } func (msg *MsgSubmitBundleProposal) GetSigners() []sdk.AccAddress { @@ -39,12 +38,16 @@ func (msg *MsgSubmitBundleProposal) GetSigners() []sdk.AccAddress { if err != nil { panic(err) } + return []sdk.AccAddress{creator} } -func (msg *MsgSubmitBundleProposal) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) +func (msg *MsgSubmitBundleProposal) Route() string { + return RouterKey +} + +func (msg *MsgSubmitBundleProposal) Type() string { + return "kyve/bundles/MsgSubmitBundleProposal" } func (msg *MsgSubmitBundleProposal) ValidateBasic() error { diff --git a/x/bundles/types/message_vote_bundle_proposal.go b/x/bundles/types/message_vote_bundle_proposal.go index f77833c8..ddb35e5b 100644 --- a/x/bundles/types/message_vote_bundle_proposal.go +++ b/x/bundles/types/message_vote_bundle_proposal.go @@ -4,11 +4,13 @@ import ( "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) -const TypeMsgVoteBundleProposal = "vote_bundle_proposal" - -var _ sdk.Msg = &MsgVoteBundleProposal{} +var ( + _ legacytx.LegacyMsg = &MsgVoteBundleProposal{} + _ sdk.Msg = &MsgVoteBundleProposal{} +) func NewMsgVoteBundleProposal(creator string, staker string, poolId uint64, storageId string, vote VoteType) *MsgVoteBundleProposal { return &MsgVoteBundleProposal{ @@ -20,12 +22,9 @@ func NewMsgVoteBundleProposal(creator string, staker string, poolId uint64, stor } } -func (msg *MsgVoteBundleProposal) Route() string { - return RouterKey -} - -func (msg *MsgVoteBundleProposal) Type() string { - return TypeMsgVoteBundleProposal +func (msg *MsgVoteBundleProposal) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) } func (msg *MsgVoteBundleProposal) GetSigners() []sdk.AccAddress { @@ -33,12 +32,16 @@ func (msg *MsgVoteBundleProposal) GetSigners() []sdk.AccAddress { if err != nil { panic(err) } + return []sdk.AccAddress{creator} } -func (msg *MsgVoteBundleProposal) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) +func (msg *MsgVoteBundleProposal) Route() string { + return RouterKey +} + +func (msg *MsgVoteBundleProposal) Type() string { + return "kyve/bundles/MsgVoteBundleProposal" } func (msg *MsgVoteBundleProposal) ValidateBasic() error { diff --git a/x/delegation/module.go b/x/delegation/module.go index d9a9be8e..b4873b48 100644 --- a/x/delegation/module.go +++ b/x/delegation/module.go @@ -45,7 +45,7 @@ func (AppModuleBasic) Name() string { // RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) + types.RegisterLegacyAminoCodec(cdc) } // RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message diff --git a/x/delegation/types/codec.go b/x/delegation/types/codec.go index 17853d7a..2f597c0a 100644 --- a/x/delegation/types/codec.go +++ b/x/delegation/types/codec.go @@ -2,13 +2,19 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + codecTypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptoCodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" ) -func RegisterCodec(_ *codec.LegacyAmino) {} +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgDelegate{}, "kyve/delegation/MsgDelegate", nil) + cdc.RegisterConcrete(&MsgWithdrawRewards{}, "kyve/delegation/MsgWithdrawRewards", nil) + cdc.RegisterConcrete(&MsgUndelegate{}, "kyve/delegation/MsgUndelegate", nil) + cdc.RegisterConcrete(&MsgRedelegate{}, "kyve/delegation/MsgRedelegate", nil) +} -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { +func RegisterInterfaces(registry codecTypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgDelegate{}) registry.RegisterImplementations((*sdk.Msg)(nil), &MsgWithdrawRewards{}) registry.RegisterImplementations((*sdk.Msg)(nil), &MsgUndelegate{}) @@ -18,5 +24,11 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { var ( Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) + ModuleCdc = codec.NewAminoCodec(Amino) ) + +func init() { + RegisterLegacyAminoCodec(Amino) + cryptoCodec.RegisterCrypto(Amino) + sdk.RegisterLegacyAminoCodec(Amino) +} diff --git a/x/delegation/types/message_delegate.go b/x/delegation/types/message_delegate.go index bfd1ae6b..15a4f820 100644 --- a/x/delegation/types/message_delegate.go +++ b/x/delegation/types/message_delegate.go @@ -1,21 +1,20 @@ package types import ( - sdkErrors "cosmossdk.io/errors" + "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) -const TypeMsgDelegate = "delegate" - -var _ sdk.Msg = &MsgDelegate{} - -func (msg *MsgDelegate) Route() string { - return RouterKey -} +var ( + _ legacytx.LegacyMsg = &MsgDelegate{} + _ sdk.Msg = &MsgDelegate{} +) -func (msg *MsgDelegate) Type() string { - return TypeMsgDelegate +func (msg *MsgDelegate) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) } func (msg *MsgDelegate) GetSigners() []sdk.AccAddress { @@ -23,23 +22,27 @@ func (msg *MsgDelegate) GetSigners() []sdk.AccAddress { if err != nil { panic(err) } + return []sdk.AccAddress{creator} } -func (msg *MsgDelegate) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) +func (msg *MsgDelegate) Route() string { + return RouterKey +} + +func (msg *MsgDelegate) Type() string { + return "kyve/delegation/MsgDelegate" } func (msg *MsgDelegate) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkErrors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address (%s)", err) + return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address (%s)", err) } _, err = sdk.AccAddressFromBech32(msg.Staker) if err != nil { - return sdkErrors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid staker address (%s)", err) + return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid staker address (%s)", err) } return nil } diff --git a/x/delegation/types/message_redelegate.go b/x/delegation/types/message_redelegate.go index 7098440d..cc46d3b3 100644 --- a/x/delegation/types/message_redelegate.go +++ b/x/delegation/types/message_redelegate.go @@ -1,21 +1,20 @@ package types import ( - sdkErrors "cosmossdk.io/errors" + "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) -const TypeMsgRedelegate = "redelegate" - -var _ sdk.Msg = &MsgRedelegate{} - -func (msg *MsgRedelegate) Route() string { - return RouterKey -} +var ( + _ legacytx.LegacyMsg = &MsgRedelegate{} + _ sdk.Msg = &MsgRedelegate{} +) -func (msg *MsgRedelegate) Type() string { - return TypeMsgRedelegate +func (msg *MsgRedelegate) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) } func (msg *MsgRedelegate) GetSigners() []sdk.AccAddress { @@ -23,18 +22,22 @@ func (msg *MsgRedelegate) GetSigners() []sdk.AccAddress { if err != nil { panic(err) } + return []sdk.AccAddress{creator} } -func (msg *MsgRedelegate) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) +func (msg *MsgRedelegate) Route() string { + return RouterKey +} + +func (msg *MsgRedelegate) Type() string { + return "kyve/delegation/MsgRedelegate" } func (msg *MsgRedelegate) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkErrors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address (%s)", err) + return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address (%s)", err) } return nil } diff --git a/x/delegation/types/message_undelegate.go b/x/delegation/types/message_undelegate.go index 69fa4a32..bf6811ab 100644 --- a/x/delegation/types/message_undelegate.go +++ b/x/delegation/types/message_undelegate.go @@ -1,21 +1,20 @@ package types import ( - sdkErrors "cosmossdk.io/errors" + "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) -const TypeMsgUndelegate = "undelegate" - -var _ sdk.Msg = &MsgUndelegate{} - -func (msg *MsgUndelegate) Route() string { - return RouterKey -} +var ( + _ legacytx.LegacyMsg = &MsgUndelegate{} + _ sdk.Msg = &MsgUndelegate{} +) -func (msg *MsgUndelegate) Type() string { - return TypeMsgUndelegate +func (msg *MsgUndelegate) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) } func (msg *MsgUndelegate) GetSigners() []sdk.AccAddress { @@ -23,23 +22,27 @@ func (msg *MsgUndelegate) GetSigners() []sdk.AccAddress { if err != nil { panic(err) } + return []sdk.AccAddress{creator} } -func (msg *MsgUndelegate) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) +func (msg *MsgUndelegate) Route() string { + return RouterKey +} + +func (msg *MsgUndelegate) Type() string { + return "kyve/delegation/MsgUndelegate" } func (msg *MsgUndelegate) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkErrors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address (%s)", err) + return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address (%s)", err) } _, err = sdk.AccAddressFromBech32(msg.Staker) if err != nil { - return sdkErrors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid staker address (%s)", err) + return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid staker address (%s)", err) } return nil diff --git a/x/delegation/types/message_withdraw_rewards.go b/x/delegation/types/message_withdraw_rewards.go index d567758b..4c46c396 100644 --- a/x/delegation/types/message_withdraw_rewards.go +++ b/x/delegation/types/message_withdraw_rewards.go @@ -1,21 +1,20 @@ package types import ( - sdkErrors "cosmossdk.io/errors" + "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) -const TypeMsgWithdrawRewards = "withdraw_rewards" - -var _ sdk.Msg = &MsgWithdrawRewards{} - -func (msg *MsgWithdrawRewards) Route() string { - return RouterKey -} +var ( + _ legacytx.LegacyMsg = &MsgWithdrawRewards{} + _ sdk.Msg = &MsgWithdrawRewards{} +) -func (msg *MsgWithdrawRewards) Type() string { - return TypeMsgWithdrawRewards +func (msg *MsgWithdrawRewards) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) } func (msg *MsgWithdrawRewards) GetSigners() []sdk.AccAddress { @@ -23,23 +22,27 @@ func (msg *MsgWithdrawRewards) GetSigners() []sdk.AccAddress { if err != nil { panic(err) } + return []sdk.AccAddress{creator} } -func (msg *MsgWithdrawRewards) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) +func (msg *MsgWithdrawRewards) Route() string { + return RouterKey +} + +func (msg *MsgWithdrawRewards) Type() string { + return "kyve/delegation/MsgWithdrawRewards" } func (msg *MsgWithdrawRewards) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return sdkErrors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address (%s)", err) + return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address (%s)", err) } _, err = sdk.AccAddressFromBech32(msg.Staker) if err != nil { - return sdkErrors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid staker address (%s)", err) + return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid staker address (%s)", err) } return nil diff --git a/x/pool/module.go b/x/pool/module.go index bb003ede..32d9e222 100644 --- a/x/pool/module.go +++ b/x/pool/module.go @@ -46,7 +46,7 @@ func (AppModuleBasic) Name() string { // RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) + types.RegisterLegacyAminoCodec(cdc) } // RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message diff --git a/x/pool/types/codec.go b/x/pool/types/codec.go index 5f388232..394956cf 100644 --- a/x/pool/types/codec.go +++ b/x/pool/types/codec.go @@ -2,13 +2,17 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + codecTypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptoCodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" ) -func RegisterCodec(_ *codec.LegacyAmino) {} +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgFundPool{}, "kyve/pool/MsgFundPool", nil) + cdc.RegisterConcrete(&MsgDefundPool{}, "kyve/pool/MsgDefundPool", nil) +} -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { +func RegisterInterfaces(registry codecTypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgFundPool{}) registry.RegisterImplementations((*sdk.Msg)(nil), &MsgDefundPool{}) @@ -22,5 +26,11 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { var ( Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) + ModuleCdc = codec.NewAminoCodec(Amino) ) + +func init() { + RegisterLegacyAminoCodec(Amino) + cryptoCodec.RegisterCrypto(Amino) + sdk.RegisterLegacyAminoCodec(Amino) +} diff --git a/x/pool/types/message_defund_pool.go b/x/pool/types/message_defund_pool.go index 08782d24..ba6a2b63 100644 --- a/x/pool/types/message_defund_pool.go +++ b/x/pool/types/message_defund_pool.go @@ -4,11 +4,13 @@ import ( "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) -const TypeMsgDefundPool = "defund_pool" - -var _ sdk.Msg = &MsgDefundPool{} +var ( + _ legacytx.LegacyMsg = &MsgDefundPool{} + _ sdk.Msg = &MsgDefundPool{} +) func NewMsgDefundPool(creator string, id uint64, amount uint64) *MsgDefundPool { return &MsgDefundPool{ @@ -18,12 +20,9 @@ func NewMsgDefundPool(creator string, id uint64, amount uint64) *MsgDefundPool { } } -func (msg *MsgDefundPool) Route() string { - return RouterKey -} - -func (msg *MsgDefundPool) Type() string { - return TypeMsgDefundPool +func (msg *MsgDefundPool) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) } func (msg *MsgDefundPool) GetSigners() []sdk.AccAddress { @@ -31,12 +30,16 @@ func (msg *MsgDefundPool) GetSigners() []sdk.AccAddress { if err != nil { panic(err) } + return []sdk.AccAddress{creator} } -func (msg *MsgDefundPool) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) +func (msg *MsgDefundPool) Route() string { + return RouterKey +} + +func (msg *MsgDefundPool) Type() string { + return "kyve/pool/MsgDefundPool" } func (msg *MsgDefundPool) ValidateBasic() error { diff --git a/x/pool/types/message_fund_pool.go b/x/pool/types/message_fund_pool.go index 2cb637fc..61c716f8 100644 --- a/x/pool/types/message_fund_pool.go +++ b/x/pool/types/message_fund_pool.go @@ -5,9 +5,13 @@ import ( "github.com/KYVENetwork/chain/util" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) -var _ sdk.Msg = &MsgFundPool{} +var ( + _ legacytx.LegacyMsg = &MsgFundPool{} + _ sdk.Msg = &MsgFundPool{} +) func NewMsgFundPool(creator string, id uint64, amount uint64) *MsgFundPool { return &MsgFundPool{ @@ -17,6 +21,11 @@ func NewMsgFundPool(creator string, id uint64, amount uint64) *MsgFundPool { } } +func (msg *MsgFundPool) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + func (msg *MsgFundPool) GetSigners() []sdk.AccAddress { creator, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { @@ -26,6 +35,14 @@ func (msg *MsgFundPool) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{creator} } +func (msg *MsgFundPool) Route() string { + return RouterKey +} + +func (msg *MsgFundPool) Type() string { + return "kyve/pool/MsgFundPool" +} + func (msg *MsgFundPool) ValidateBasic() error { if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { return errors.Wrapf(errorsTypes.ErrInvalidAddress, "invalid creator address: %s", err) diff --git a/x/team/module.go b/x/team/module.go index 4266c8db..2edd5a53 100644 --- a/x/team/module.go +++ b/x/team/module.go @@ -51,7 +51,7 @@ func (AppModuleBasic) Name() string { // RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs to/from []byte in order to persist them in the module's KVStore func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterCodec(cdc) + types.RegisterLegacyAminoCodec(cdc) } // RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message diff --git a/x/team/types/codec.go b/x/team/types/codec.go index 1f8f403a..3f3b5b8c 100644 --- a/x/team/types/codec.go +++ b/x/team/types/codec.go @@ -2,13 +2,20 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + codecTypes "github.com/cosmos/cosmos-sdk/codec/types" + cryptoCodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" ) -func RegisterCodec(_ *codec.LegacyAmino) {} +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgCreateTeamVestingAccount{}, "kyve/team/MsgCreateTeamVestingAccount", nil) + cdc.RegisterConcrete(&MsgClaimUnlocked{}, "kyve/team/MsgClaimUnlocked", nil) + cdc.RegisterConcrete(&MsgClawback{}, "kyve/team/MsgClawback", nil) + cdc.RegisterConcrete(&MsgClaimAccountRewards{}, "kyve/team/MsgClaimAccountRewards", nil) + cdc.RegisterConcrete(&MsgClaimAuthorityRewards{}, "kyve/team/MsgClaimAuthorityRewards", nil) +} -func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { +func RegisterInterfaces(registry codecTypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgCreateTeamVestingAccount{}) registry.RegisterImplementations((*sdk.Msg)(nil), &MsgClaimUnlocked{}) registry.RegisterImplementations((*sdk.Msg)(nil), &MsgClawback{}) @@ -18,5 +25,11 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { var ( Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) + ModuleCdc = codec.NewAminoCodec(Amino) ) + +func init() { + RegisterLegacyAminoCodec(Amino) + cryptoCodec.RegisterCrypto(Amino) + sdk.RegisterLegacyAminoCodec(Amino) +} diff --git a/x/team/types/message_claim_account_rewards.go b/x/team/types/message_claim_account_rewards.go index 8c6e205d..f0dd34b1 100644 --- a/x/team/types/message_claim_account_rewards.go +++ b/x/team/types/message_claim_account_rewards.go @@ -4,18 +4,17 @@ import ( "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) -const TypeMsgClaimAccountRewards = "claim_account_rewards" - -var _ sdk.Msg = &MsgClaimAccountRewards{} - -func (msg *MsgClaimAccountRewards) Route() string { - return RouterKey -} +var ( + _ legacytx.LegacyMsg = &MsgClaimAccountRewards{} + _ sdk.Msg = &MsgClaimAccountRewards{} +) -func (msg *MsgClaimAccountRewards) Type() string { - return TypeMsgClaimAccountRewards +func (msg *MsgClaimAccountRewards) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) } func (msg *MsgClaimAccountRewards) GetSigners() []sdk.AccAddress { @@ -23,12 +22,16 @@ func (msg *MsgClaimAccountRewards) GetSigners() []sdk.AccAddress { if err != nil { panic(err) } + return []sdk.AccAddress{creator} } -func (msg *MsgClaimAccountRewards) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) +func (msg *MsgClaimAccountRewards) Route() string { + return RouterKey +} + +func (msg *MsgClaimAccountRewards) Type() string { + return "kyve/team/MsgClaimAccountRewards" } func (msg *MsgClaimAccountRewards) ValidateBasic() error { diff --git a/x/team/types/message_claim_authority_rewards.go b/x/team/types/message_claim_authority_rewards.go index 4b30000a..fdef7020 100644 --- a/x/team/types/message_claim_authority_rewards.go +++ b/x/team/types/message_claim_authority_rewards.go @@ -4,18 +4,17 @@ import ( "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) -const TypeMsgClaimAuthorityRewards = "claim_authority_rewards" - -var _ sdk.Msg = &MsgClaimAuthorityRewards{} - -func (msg *MsgClaimAuthorityRewards) Route() string { - return RouterKey -} +var ( + _ legacytx.LegacyMsg = &MsgClaimAuthorityRewards{} + _ sdk.Msg = &MsgClaimAuthorityRewards{} +) -func (msg *MsgClaimAuthorityRewards) Type() string { - return TypeMsgClaimAuthorityRewards +func (msg *MsgClaimAuthorityRewards) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) } func (msg *MsgClaimAuthorityRewards) GetSigners() []sdk.AccAddress { @@ -26,9 +25,12 @@ func (msg *MsgClaimAuthorityRewards) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{creator} } -func (msg *MsgClaimAuthorityRewards) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) +func (msg *MsgClaimAuthorityRewards) Route() string { + return RouterKey +} + +func (msg *MsgClaimAuthorityRewards) Type() string { + return "kyve/team/MsgClaimAuthorityRewards" } func (msg *MsgClaimAuthorityRewards) ValidateBasic() error { diff --git a/x/team/types/message_claim_unlocked.go b/x/team/types/message_claim_unlocked.go index df1d4aa7..34feba1b 100644 --- a/x/team/types/message_claim_unlocked.go +++ b/x/team/types/message_claim_unlocked.go @@ -4,18 +4,17 @@ import ( "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) -const TypeMsgClaimUnlocked = "claim_unlocked" - -var _ sdk.Msg = &MsgClaimUnlocked{} - -func (msg *MsgClaimUnlocked) Route() string { - return RouterKey -} +var ( + _ legacytx.LegacyMsg = &MsgClaimUnlocked{} + _ sdk.Msg = &MsgClaimUnlocked{} +) -func (msg *MsgClaimUnlocked) Type() string { - return TypeMsgClaimUnlocked +func (msg *MsgClaimUnlocked) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) } func (msg *MsgClaimUnlocked) GetSigners() []sdk.AccAddress { @@ -23,12 +22,16 @@ func (msg *MsgClaimUnlocked) GetSigners() []sdk.AccAddress { if err != nil { panic(err) } + return []sdk.AccAddress{creator} } -func (msg *MsgClaimUnlocked) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) +func (msg *MsgClaimUnlocked) Route() string { + return RouterKey +} + +func (msg *MsgClaimUnlocked) Type() string { + return "kyve/team/MsgClaimUnlocked" } func (msg *MsgClaimUnlocked) ValidateBasic() error { diff --git a/x/team/types/message_clawback.go b/x/team/types/message_clawback.go index 466f9615..5122b47d 100644 --- a/x/team/types/message_clawback.go +++ b/x/team/types/message_clawback.go @@ -4,18 +4,17 @@ import ( "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) -const TypeMsgClawback = "clawback" - -var _ sdk.Msg = &MsgClawback{} - -func (msg *MsgClawback) Route() string { - return RouterKey -} +var ( + _ legacytx.LegacyMsg = &MsgClawback{} + _ sdk.Msg = &MsgClawback{} +) -func (msg *MsgClawback) Type() string { - return TypeMsgClawback +func (msg *MsgClawback) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) } func (msg *MsgClawback) GetSigners() []sdk.AccAddress { @@ -23,12 +22,16 @@ func (msg *MsgClawback) GetSigners() []sdk.AccAddress { if err != nil { panic(err) } + return []sdk.AccAddress{creator} } -func (msg *MsgClawback) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) +func (msg *MsgClawback) Route() string { + return RouterKey +} + +func (msg *MsgClawback) Type() string { + return "kyve/team/MsgClawback" } func (msg *MsgClawback) ValidateBasic() error { diff --git a/x/team/types/message_create_team_vesting_account.go b/x/team/types/message_create_team_vesting_account.go index 1d172388..e0d9d8bf 100644 --- a/x/team/types/message_create_team_vesting_account.go +++ b/x/team/types/message_create_team_vesting_account.go @@ -4,18 +4,17 @@ import ( "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" errorsTypes "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx" ) -const TypeMsgCreateTeamVestingAccount = "create_team_vesting_account" - -var _ sdk.Msg = &MsgCreateTeamVestingAccount{} - -func (msg *MsgCreateTeamVestingAccount) Route() string { - return RouterKey -} +var ( + _ legacytx.LegacyMsg = &MsgCreateTeamVestingAccount{} + _ sdk.Msg = &MsgCreateTeamVestingAccount{} +) -func (msg *MsgCreateTeamVestingAccount) Type() string { - return TypeMsgCreateTeamVestingAccount +func (msg *MsgCreateTeamVestingAccount) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) } func (msg *MsgCreateTeamVestingAccount) GetSigners() []sdk.AccAddress { @@ -23,12 +22,16 @@ func (msg *MsgCreateTeamVestingAccount) GetSigners() []sdk.AccAddress { if err != nil { panic(err) } + return []sdk.AccAddress{creator} } -func (msg *MsgCreateTeamVestingAccount) GetSignBytes() []byte { - bz := ModuleCdc.MustMarshalJSON(msg) - return sdk.MustSortJSON(bz) +func (msg *MsgCreateTeamVestingAccount) Route() string { + return RouterKey +} + +func (msg *MsgCreateTeamVestingAccount) Type() string { + return "kyve/team/MsgCreateTeamVestingAccount" } func (msg *MsgCreateTeamVestingAccount) ValidateBasic() error { From a0c4de5c300e72a5d9f41a35d9b338bdd90dbbdf Mon Sep 17 00:00:00 2001 From: John Letey Date: Fri, 12 May 2023 10:36:02 +0200 Subject: [PATCH 4/4] chore: update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a5265951..b1a3e4fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ ### Bug Fixes +- [#48](https://github.com/KYVENetwork/chain/pull/48) Register amino types for full Ledger support. - (`x/team`) [#45](https://github.com/KYVENetwork/chain/pull/45) Adjust vesting schedules of multiple KYVE Core Team members. ### API Breaking