Skip to content

Commit

Permalink
Cosmos v0.46 upgrade follow ups (#1522)
Browse files Browse the repository at this point in the history
* ensure RewardIndexes.Mul method is called in test

* remove deprecated line breaks,
add new v0.46 keys cmd

* register kava msg types on authz ModuleCdc
  • Loading branch information
rhuairahrighairidh authored Apr 6, 2023
1 parent bdf7a4d commit 5b3162c
Show file tree
Hide file tree
Showing 18 changed files with 101 additions and 28 deletions.
3 changes: 1 addition & 2 deletions client/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,10 @@ The pass backend requires GnuPG: https://gnupg.org/
keys.ImportKeyCommand(),
keys.ListKeysCmd(),
keys.ShowKeysCmd(),
flags.LineBreak,
keys.DeleteKeyCommand(),
keys.RenameKeyCommand(),
keys.ParseKeyStringCommand(),
keys.MigrateCommand(),
flags.LineBreak,
ethclient.UnsafeExportEthKeyCommand(),
ethclient.UnsafeImportKeyCommand(),
)
Expand Down
6 changes: 5 additions & 1 deletion x/auction/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package types
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"

cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec"
)

// RegisterLegacyAminoCodec registers all the necessary types and interfaces for the
Expand Down Expand Up @@ -58,4 +58,8 @@ var (
func init() {
RegisterLegacyAminoCodec(amino)
cryptocodec.RegisterCrypto(amino)

// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be
// used to properly serialize MsgGrant and MsgExec instances
RegisterLegacyAminoCodec(authzcodec.Amino)
}
5 changes: 5 additions & 0 deletions x/bep3/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec"
)

// RegisterLegacyAminoCodec registers all the necessary types and interfaces for the
Expand Down Expand Up @@ -41,4 +42,8 @@ var (
func init() {
RegisterLegacyAminoCodec(amino)
cryptocodec.RegisterCrypto(amino)

// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be
// used to properly serialize MsgGrant and MsgExec instances
RegisterLegacyAminoCodec(authzcodec.Amino)
}
6 changes: 5 additions & 1 deletion x/cdp/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package types
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"

cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec"
)

// RegisterLegacyAminoCodec registers all the necessary types and interfaces for the
Expand Down Expand Up @@ -41,4 +41,8 @@ var (
func init() {
RegisterLegacyAminoCodec(amino)
cryptocodec.RegisterCrypto(amino)

// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be
// used to properly serialize MsgGrant and MsgExec instances
RegisterLegacyAminoCodec(authzcodec.Amino)
}
6 changes: 6 additions & 0 deletions x/committee/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec"
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
proposaltypes "github.com/cosmos/cosmos-sdk/x/params/types/proposal"
Expand All @@ -31,6 +32,10 @@ func init() {
cryptocodec.RegisterCrypto(amino)
// amino is not sealed so that other modules can register their own pubproposal and/or permission types.

// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be
// used to properly serialize MsgGrant and MsgExec instances
RegisterLegacyAminoCodec(authzcodec.Amino)

// CommitteeChange/Delete proposals along with Permission types are
// registered on gov's ModuleCdc
RegisterLegacyAminoCodec(govv1beta1.ModuleCdc.LegacyAmino)
Expand All @@ -42,6 +47,7 @@ func init() {
RegisterProposalTypeCodec(govv1beta1.TextProposal{}, "cosmos-sdk/TextProposal")
RegisterProposalTypeCodec(upgradetypes.SoftwareUpgradeProposal{}, "cosmos-sdk/SoftwareUpgradeProposal")
RegisterProposalTypeCodec(upgradetypes.CancelSoftwareUpgradeProposal{}, "cosmos-sdk/CancelSoftwareUpgradeProposal")

}

// RegisterLegacyAminoCodec registers all the necessary types and interfaces for the module.
Expand Down
11 changes: 7 additions & 4 deletions x/community/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ package types
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"

cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec"
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
)

// RegisterLegacyAminoCodec registers all the necessary types and interfaces for the module.
Expand Down Expand Up @@ -40,4 +39,8 @@ var (
func init() {
RegisterLegacyAminoCodec(amino)
cryptocodec.RegisterCrypto(amino)

// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be
// used to properly serialize MsgGrant and MsgExec instances
RegisterLegacyAminoCodec(authzcodec.Amino)
}
8 changes: 6 additions & 2 deletions x/earn/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package types
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"

cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec"
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
)

Expand Down Expand Up @@ -43,4 +43,8 @@ var (
func init() {
RegisterLegacyAminoCodec(amino)
cryptocodec.RegisterCrypto(amino)

// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be
// used to properly serialize MsgGrant and MsgExec instances
RegisterLegacyAminoCodec(authzcodec.Amino)
}
5 changes: 5 additions & 0 deletions x/evmutil/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec"
)

// RegisterLegacyAminoCodec registers the necessary evmutil interfaces and concrete types
Expand Down Expand Up @@ -33,4 +34,8 @@ func init() {
RegisterLegacyAminoCodec(amino)
cryptocodec.RegisterCrypto(amino)
amino.Seal()

// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be
// used to properly serialize MsgGrant and MsgExec instances
RegisterLegacyAminoCodec(authzcodec.Amino)
}
6 changes: 5 additions & 1 deletion x/hard/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package types
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"

cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec"
)

func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
Expand Down Expand Up @@ -37,4 +37,8 @@ var (
func init() {
RegisterLegacyAminoCodec(amino)
cryptocodec.RegisterCrypto(amino)

// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be
// used to properly serialize MsgGrant and MsgExec instances
RegisterLegacyAminoCodec(authzcodec.Amino)
}
21 changes: 15 additions & 6 deletions x/incentive/types/claims_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/crypto"
)
Expand Down Expand Up @@ -334,13 +335,21 @@ func TestRewardIndexes(t *testing.T) {

for _, tc := range testcases {
t.Run(tc.name, func(t *testing.T) {
// require.Equal() fails with zero values abs: <nil> and abs: {}
actual := tc.rewardIndexes.Mul(tc.multiplier)

for i := range tc.rewardIndexes {
require.True(t,
tc.expected[i].RewardFactor.
Equal(tc.rewardIndexes[i].RewardFactor.Mul(tc.multiplier)),
)
if len(tc.expected) == 0 {
require.Equal(t, actual, tc.expected)
} else {
require.Len(t, actual, len(tc.expected))
for i := range tc.expected {
assert.Equal(t,
actual[i].CollateralType,
tc.expected[i].CollateralType,
)
assert.True(t,
actual[i].RewardFactor.Equal(tc.expected[i].RewardFactor),
)
}
}
})
}
Expand Down
6 changes: 5 additions & 1 deletion x/incentive/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package types
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"

cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec"
)

// RegisterLegacyAminoCodec registers all the necessary types and interfaces for the
Expand Down Expand Up @@ -42,4 +42,8 @@ var (
func init() {
RegisterLegacyAminoCodec(amino)
cryptocodec.RegisterCrypto(amino)

// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be
// used to properly serialize MsgGrant and MsgExec instances
RegisterLegacyAminoCodec(authzcodec.Amino)
}
6 changes: 5 additions & 1 deletion x/issuance/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package types
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"

cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec"
)

var (
Expand Down Expand Up @@ -39,4 +39,8 @@ func RegisterInterfaces(registry types.InterfaceRegistry) {
func init() {
RegisterLegacyAminoCodec(amino)
cryptocodec.RegisterCrypto(amino)

// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be
// used to properly serialize MsgGrant and MsgExec instances
RegisterLegacyAminoCodec(authzcodec.Amino)
}
5 changes: 5 additions & 0 deletions x/kavadist/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/cosmos/cosmos-sdk/codec"
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec"
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
)

Expand All @@ -29,4 +30,8 @@ func init() {
RegisterLegacyAminoCodec(amino)
cryptocodec.RegisterCrypto(amino)
amino.Seal()

// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be
// used to properly serialize MsgGrant and MsgExec instances
RegisterLegacyAminoCodec(authzcodec.Amino)
}
9 changes: 6 additions & 3 deletions x/liquid/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ package types
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"

cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec"
)

// RegisterLegacyAminoCodec registers all the necessary types and interfaces for the module.
Expand Down Expand Up @@ -35,4 +34,8 @@ var (
func init() {
RegisterLegacyAminoCodec(amino)
cryptocodec.RegisterCrypto(amino)

// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be
// used to properly serialize MsgGrant and MsgExec instances
RegisterLegacyAminoCodec(authzcodec.Amino)
}
7 changes: 5 additions & 2 deletions x/pricefeed/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ package types
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"

cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec"
)

// RegisterLegacyAminoCodec registers all the necessary types and interfaces for the
Expand All @@ -32,4 +31,8 @@ var (
func init() {
RegisterLegacyAminoCodec(amino)
cryptocodec.RegisterCrypto(amino)

// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be
// used to properly serialize MsgGrant and MsgExec instances
RegisterLegacyAminoCodec(authzcodec.Amino)
}
6 changes: 5 additions & 1 deletion x/router/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package types
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"

cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec"
)

// RegisterLegacyAminoCodec registers all the necessary types and interfaces for the module.
Expand Down Expand Up @@ -39,4 +39,8 @@ var (
func init() {
RegisterLegacyAminoCodec(amino)
cryptocodec.RegisterCrypto(amino)

// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be
// used to properly serialize MsgGrant and MsgExec instances
RegisterLegacyAminoCodec(authzcodec.Amino)
}
7 changes: 5 additions & 2 deletions x/savings/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ package types
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"

cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec"
)

// RegisterLegacyAminoCodec registers all the necessary types and interfaces for the
Expand All @@ -34,4 +33,8 @@ var (
func init() {
RegisterLegacyAminoCodec(amino)
cryptocodec.RegisterCrypto(amino)

// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be
// used to properly serialize MsgGrant and MsgExec instances
RegisterLegacyAminoCodec(authzcodec.Amino)
}
6 changes: 5 additions & 1 deletion x/swap/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package types
import (
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/types"

cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/msgservice"
authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec"
)

// RegisterLegacyAminoCodec registers all the necessary types and interfaces for the
Expand Down Expand Up @@ -40,4 +40,8 @@ var (
func init() {
RegisterLegacyAminoCodec(amino)
cryptocodec.RegisterCrypto(amino)

// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be
// used to properly serialize MsgGrant and MsgExec instances
RegisterLegacyAminoCodec(authzcodec.Amino)
}

0 comments on commit 5b3162c

Please sign in to comment.