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

fix!: Fix foundation amino codec #833

Merged
merged 2 commits into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Breaking Changes

* (codec) [#833](https://github.com/line/lbm-sdk/pull/833) Fix foundation amino codec

### Build, CI

### Document Updates
2 changes: 2 additions & 0 deletions x/auth/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
sdk "github.com/line/lbm-sdk/types"
"github.com/line/lbm-sdk/x/auth/legacy/legacytx"
authzcodec "github.com/line/lbm-sdk/x/authz/codec"
fdncodec "github.com/line/lbm-sdk/x/foundation/codec"
govcodec "github.com/line/lbm-sdk/x/gov/codec"
)

Expand Down Expand Up @@ -54,4 +55,5 @@ func init() {
// used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances
RegisterLegacyAminoCodec(authzcodec.Amino)
RegisterLegacyAminoCodec(govcodec.Amino)
RegisterLegacyAminoCodec(fdncodec.Amino)
}
2 changes: 2 additions & 0 deletions x/auth/vesting/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
authtypes "github.com/line/lbm-sdk/x/auth/types"
"github.com/line/lbm-sdk/x/auth/vesting/exported"
authzcodec "github.com/line/lbm-sdk/x/authz/codec"
fdncodec "github.com/line/lbm-sdk/x/foundation/codec"
govcodec "github.com/line/lbm-sdk/x/gov/codec"
)

Expand Down Expand Up @@ -77,4 +78,5 @@ func init() {
// used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances
RegisterLegacyAminoCodec(authzcodec.Amino)
RegisterLegacyAminoCodec(govcodec.Amino)
RegisterLegacyAminoCodec(fdncodec.Amino)
}
2 changes: 2 additions & 0 deletions x/authz/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
sdk "github.com/line/lbm-sdk/types"
"github.com/line/lbm-sdk/types/msgservice"
authzcodec "github.com/line/lbm-sdk/x/authz/codec"
fdncodec "github.com/line/lbm-sdk/x/foundation/codec"
govcodec "github.com/line/lbm-sdk/x/gov/codec"
)

Expand Down Expand Up @@ -42,4 +43,5 @@ func init() {
// used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances
RegisterLegacyAminoCodec(authzcodec.Amino)
RegisterLegacyAminoCodec(govcodec.Amino)
RegisterLegacyAminoCodec(fdncodec.Amino)
}
2 changes: 2 additions & 0 deletions x/bank/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/line/lbm-sdk/types/msgservice"
"github.com/line/lbm-sdk/x/authz"
authzcodec "github.com/line/lbm-sdk/x/authz/codec"
fdncodec "github.com/line/lbm-sdk/x/foundation/codec"
govcodec "github.com/line/lbm-sdk/x/gov/codec"
)

Expand Down Expand Up @@ -47,4 +48,5 @@ func init() {
// used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances
RegisterLegacyAminoCodec(authzcodec.Amino)
RegisterLegacyAminoCodec(govcodec.Amino)
RegisterLegacyAminoCodec(fdncodec.Amino)
}
2 changes: 2 additions & 0 deletions x/collection/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
sdk "github.com/line/lbm-sdk/types"
"github.com/line/lbm-sdk/types/msgservice"
authzcodec "github.com/line/lbm-sdk/x/authz/codec"
fdncodec "github.com/line/lbm-sdk/x/foundation/codec"
govcodec "github.com/line/lbm-sdk/x/gov/codec"
)

Expand Down Expand Up @@ -94,4 +95,5 @@ func init() {
// used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances
RegisterLegacyAminoCodec(authzcodec.Amino)
RegisterLegacyAminoCodec(govcodec.Amino)
RegisterLegacyAminoCodec(fdncodec.Amino)
}
2 changes: 2 additions & 0 deletions x/crisis/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
sdk "github.com/line/lbm-sdk/types"
"github.com/line/lbm-sdk/types/msgservice"
authzcodec "github.com/line/lbm-sdk/x/authz/codec"
fdncodec "github.com/line/lbm-sdk/x/foundation/codec"
govcodec "github.com/line/lbm-sdk/x/gov/codec"
)

Expand Down Expand Up @@ -39,4 +40,5 @@ func init() {
// used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances
RegisterLegacyAminoCodec(authzcodec.Amino)
RegisterLegacyAminoCodec(govcodec.Amino)
RegisterLegacyAminoCodec(fdncodec.Amino)
}
2 changes: 2 additions & 0 deletions x/distribution/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
sdk "github.com/line/lbm-sdk/types"
"github.com/line/lbm-sdk/types/msgservice"
authzcodec "github.com/line/lbm-sdk/x/authz/codec"
fdncodec "github.com/line/lbm-sdk/x/foundation/codec"
govcodec "github.com/line/lbm-sdk/x/gov/codec"
govtypes "github.com/line/lbm-sdk/x/gov/types"
)
Expand Down Expand Up @@ -53,4 +54,5 @@ func init() {
// instances.
RegisterLegacyAminoCodec(authzcodec.Amino)
RegisterLegacyAminoCodec(govcodec.Amino)
RegisterLegacyAminoCodec(fdncodec.Amino)
}
2 changes: 2 additions & 0 deletions x/evidence/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/line/lbm-sdk/types/msgservice"
authzcodec "github.com/line/lbm-sdk/x/authz/codec"
"github.com/line/lbm-sdk/x/evidence/exported"
fdncodec "github.com/line/lbm-sdk/x/foundation/codec"
govcodec "github.com/line/lbm-sdk/x/gov/codec"
)

Expand Down Expand Up @@ -45,4 +46,5 @@ func init() {
// used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances
RegisterLegacyAminoCodec(authzcodec.Amino)
RegisterLegacyAminoCodec(govcodec.Amino)
RegisterLegacyAminoCodec(fdncodec.Amino)
}
2 changes: 2 additions & 0 deletions x/feegrant/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
sdk "github.com/line/lbm-sdk/types"
"github.com/line/lbm-sdk/types/msgservice"
authzcodec "github.com/line/lbm-sdk/x/authz/codec"
fdncodec "github.com/line/lbm-sdk/x/foundation/codec"
govcodec "github.com/line/lbm-sdk/x/gov/codec"
)

Expand Down Expand Up @@ -62,4 +63,5 @@ func init() {
// used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances
RegisterLegacyAminoCodec(authzcodec.Amino)
RegisterLegacyAminoCodec(govcodec.Amino)
RegisterLegacyAminoCodec(fdncodec.Amino)
}
12 changes: 2 additions & 10 deletions x/foundation/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"github.com/line/lbm-sdk/codec"
"github.com/line/lbm-sdk/codec/legacy"
"github.com/line/lbm-sdk/codec/types"
cryptocodec "github.com/line/lbm-sdk/crypto/codec"
sdk "github.com/line/lbm-sdk/types"
"github.com/line/lbm-sdk/types/msgservice"
authzcodec "github.com/line/lbm-sdk/x/authz/codec"
fdncodec "github.com/line/lbm-sdk/x/foundation/codec"
govcodec "github.com/line/lbm-sdk/x/gov/codec"
)

Expand Down Expand Up @@ -69,18 +69,10 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
)
}

var (
Amino = codec.NewLegacyAmino()
ModuleCdc = codec.NewAminoCodec(Amino)
)

func init() {
RegisterLegacyAminoCodec(Amino)
cryptocodec.RegisterCrypto(Amino)
sdk.RegisterLegacyAminoCodec(Amino)

// Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be
// used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances
RegisterLegacyAminoCodec(authzcodec.Amino)
RegisterLegacyAminoCodec(govcodec.Amino)
RegisterLegacyAminoCodec(fdncodec.Amino)
}
18 changes: 18 additions & 0 deletions x/foundation/codec/cdc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package codec

import (
"github.com/line/lbm-sdk/codec"
cryptocodec "github.com/line/lbm-sdk/crypto/codec"
sdk "github.com/line/lbm-sdk/types"
)

var (
Amino = codec.NewLegacyAmino()
ModuleCdc = codec.NewAminoCodec(Amino)
)

func init() {
cryptocodec.RegisterCrypto(Amino)
codec.RegisterEvidences(Amino)
sdk.RegisterLegacyAminoCodec(Amino)
}
27 changes: 14 additions & 13 deletions x/foundation/msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
codectypes "github.com/line/lbm-sdk/codec/types"
sdk "github.com/line/lbm-sdk/types"
sdkerrors "github.com/line/lbm-sdk/types/errors"
"github.com/line/lbm-sdk/x/foundation/codec"
)

var _ sdk.Msg = (*MsgUpdateParams)(nil)
Expand Down Expand Up @@ -41,7 +42,7 @@ func (m MsgUpdateParams) Route() string {

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgUpdateParams) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m))
}

var _ sdk.Msg = (*MsgFundTreasury)(nil)
Expand Down Expand Up @@ -77,7 +78,7 @@ func (m MsgFundTreasury) Route() string {

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgFundTreasury) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m))
}

var _ sdk.Msg = (*MsgWithdrawFromTreasury)(nil)
Expand Down Expand Up @@ -117,7 +118,7 @@ func (m MsgWithdrawFromTreasury) Route() string {

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgWithdrawFromTreasury) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m))
}

var _ sdk.Msg = (*MsgUpdateMembers)(nil)
Expand Down Expand Up @@ -157,7 +158,7 @@ func (m MsgUpdateMembers) Route() string {

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgUpdateMembers) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m))
}

var _ sdk.Msg = (*MsgUpdateDecisionPolicy)(nil)
Expand Down Expand Up @@ -196,7 +197,7 @@ func (m MsgUpdateDecisionPolicy) Route() string {

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgUpdateDecisionPolicy) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m))
}

func (m MsgUpdateDecisionPolicy) GetDecisionPolicy() DecisionPolicy {
Expand Down Expand Up @@ -293,7 +294,7 @@ func (m MsgSubmitProposal) Route() string {

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgSubmitProposal) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m))
}

var _ sdk.Msg = (*MsgWithdrawProposal)(nil)
Expand Down Expand Up @@ -329,7 +330,7 @@ func (m MsgWithdrawProposal) Route() string {

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgWithdrawProposal) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m))
}

var _ sdk.Msg = (*MsgVote)(nil)
Expand Down Expand Up @@ -373,7 +374,7 @@ func (m MsgVote) Route() string {

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgVote) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m))
}

var _ sdk.Msg = (*MsgExec)(nil)
Expand Down Expand Up @@ -409,7 +410,7 @@ func (m MsgExec) Route() string {

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgExec) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m))
}

var _ sdk.Msg = (*MsgLeaveFoundation)(nil)
Expand Down Expand Up @@ -441,7 +442,7 @@ func (m MsgLeaveFoundation) Route() string {

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgLeaveFoundation) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m))
}

var _ sdk.Msg = (*MsgGrant)(nil)
Expand Down Expand Up @@ -512,7 +513,7 @@ func (m MsgGrant) Route() string {

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgGrant) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m))
}

var _ sdk.Msg = (*MsgRevoke)(nil)
Expand Down Expand Up @@ -552,7 +553,7 @@ func (m MsgRevoke) Route() string {

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgRevoke) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m))
}

var _ sdk.Msg = (*MsgGovMint)(nil)
Expand Down Expand Up @@ -592,5 +593,5 @@ func (m MsgGovMint) Route() string {

// GetSignBytes implements the LegacyMsg.GetSignBytes method.
func (m MsgGovMint) GetSignBytes() []byte {
return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m))
return sdk.MustSortJSON(codec.ModuleCdc.MustMarshalJSON(&m))
}
2 changes: 2 additions & 0 deletions x/gov/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
sdk "github.com/line/lbm-sdk/types"
"github.com/line/lbm-sdk/types/msgservice"
authzcodec "github.com/line/lbm-sdk/x/authz/codec"
fdncodec "github.com/line/lbm-sdk/x/foundation/codec"
govcodec "github.com/line/lbm-sdk/x/gov/codec"
)

Expand Down Expand Up @@ -42,4 +43,5 @@ func init() {
// used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances
RegisterLegacyAminoCodec(authzcodec.Amino)
RegisterLegacyAminoCodec(govcodec.Amino)
RegisterLegacyAminoCodec(fdncodec.Amino)
}
2 changes: 2 additions & 0 deletions x/slashing/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
sdk "github.com/line/lbm-sdk/types"
"github.com/line/lbm-sdk/types/msgservice"
authzcodec "github.com/line/lbm-sdk/x/authz/codec"
fdncodec "github.com/line/lbm-sdk/x/foundation/codec"
govcodec "github.com/line/lbm-sdk/x/gov/codec"
)

Expand Down Expand Up @@ -38,4 +39,5 @@ func init() {
// used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances
RegisterLegacyAminoCodec(authzcodec.Amino)
RegisterLegacyAminoCodec(govcodec.Amino)
RegisterLegacyAminoCodec(fdncodec.Amino)
}
2 changes: 2 additions & 0 deletions x/staking/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/line/lbm-sdk/types/msgservice"
"github.com/line/lbm-sdk/x/authz"
authzcodec "github.com/line/lbm-sdk/x/authz/codec"
fdncodec "github.com/line/lbm-sdk/x/foundation/codec"
govcodec "github.com/line/lbm-sdk/x/gov/codec"
)

Expand Down Expand Up @@ -58,4 +59,5 @@ func init() {
// used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances
RegisterLegacyAminoCodec(authzcodec.Amino)
RegisterLegacyAminoCodec(govcodec.Amino)
RegisterLegacyAminoCodec(fdncodec.Amino)
}
4 changes: 2 additions & 2 deletions x/stakingplus/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/line/lbm-sdk/codec/types"
authzcodec "github.com/line/lbm-sdk/x/authz/codec"
"github.com/line/lbm-sdk/x/foundation"
fdncodec "github.com/line/lbm-sdk/x/foundation/codec"
govcodec "github.com/line/lbm-sdk/x/gov/codec"
)

Expand All @@ -26,6 +27,5 @@ func init() {
// used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances
RegisterLegacyAminoCodec(authzcodec.Amino)
RegisterLegacyAminoCodec(govcodec.Amino)

RegisterLegacyAminoCodec(foundation.Amino)
RegisterLegacyAminoCodec(fdncodec.Amino)
}
2 changes: 2 additions & 0 deletions x/token/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
sdk "github.com/line/lbm-sdk/types"
"github.com/line/lbm-sdk/types/msgservice"
authzcodec "github.com/line/lbm-sdk/x/authz/codec"
fdncodec "github.com/line/lbm-sdk/x/foundation/codec"
govcodec "github.com/line/lbm-sdk/x/gov/codec"
)

Expand Down Expand Up @@ -58,4 +59,5 @@ func init() {
// used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances
RegisterLegacyAminoCodec(authzcodec.Amino)
RegisterLegacyAminoCodec(govcodec.Amino)
RegisterLegacyAminoCodec(fdncodec.Amino)
}
2 changes: 2 additions & 0 deletions x/upgrade/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
cryptocodec "github.com/line/lbm-sdk/crypto/codec"
sdk "github.com/line/lbm-sdk/types"
authzcodec "github.com/line/lbm-sdk/x/authz/codec"
fdncodec "github.com/line/lbm-sdk/x/foundation/codec"
govcodec "github.com/line/lbm-sdk/x/gov/codec"
govtypes "github.com/line/lbm-sdk/x/gov/types"
)
Expand Down Expand Up @@ -40,4 +41,5 @@ func init() {
// instances.
RegisterLegacyAminoCodec(authzcodec.Amino)
RegisterLegacyAminoCodec(govcodec.Amino)
RegisterLegacyAminoCodec(fdncodec.Amino)
}
Loading