chore(x/gov, x/authz): use cosmossdk.io/core/codec instead of github.com/cosmos/cosmos-sdk/codec (#23292)
This commit is contained in:
parent
7da5372dd2
commit
e4d50b07da
@ -4,11 +4,11 @@ import (
|
||||
"context"
|
||||
|
||||
"cosmossdk.io/core/appmodule"
|
||||
"cosmossdk.io/core/codec"
|
||||
"cosmossdk.io/store/prefix"
|
||||
"cosmossdk.io/x/authz"
|
||||
"cosmossdk.io/x/authz/internal/conv"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/runtime"
|
||||
)
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ import (
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"cosmossdk.io/core/appmodule"
|
||||
"cosmossdk.io/core/codec"
|
||||
"cosmossdk.io/core/registry"
|
||||
"cosmossdk.io/errors"
|
||||
"cosmossdk.io/x/authz"
|
||||
@ -18,7 +19,6 @@ import (
|
||||
"cosmossdk.io/x/authz/simulation"
|
||||
|
||||
sdkclient "github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
cdctypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/simsx"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
@ -110,7 +110,11 @@ func (AppModule) GetTxCmd() *cobra.Command {
|
||||
|
||||
// DefaultGenesis returns default genesis state as raw bytes for the authz module.
|
||||
func (am AppModule) DefaultGenesis() json.RawMessage {
|
||||
return am.cdc.MustMarshalJSON(authz.DefaultGenesisState())
|
||||
data, err := am.cdc.MarshalJSON(authz.DefaultGenesisState())
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
// ValidateGenesis performs genesis state validation for the authz module.
|
||||
|
||||
@ -4,10 +4,10 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"cosmossdk.io/core/codec"
|
||||
"cosmossdk.io/x/authz"
|
||||
"cosmossdk.io/x/authz/keeper"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/types/kv"
|
||||
)
|
||||
|
||||
@ -18,13 +18,21 @@ func NewDecodeStore(cdc codec.Codec) func(kvA, kvB kv.Pair) string {
|
||||
switch {
|
||||
case bytes.Equal(kvA.Key[:1], keeper.GrantKey):
|
||||
var grantA, grantB authz.Grant
|
||||
cdc.MustUnmarshal(kvA.Value, &grantA)
|
||||
cdc.MustUnmarshal(kvB.Value, &grantB)
|
||||
if err := cdc.Unmarshal(kvA.Value, &grantA); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if err := cdc.Unmarshal(kvB.Value, &grantB); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return fmt.Sprintf("%v\n%v", grantA, grantB)
|
||||
case bytes.Equal(kvA.Key[:1], keeper.GrantQueuePrefix):
|
||||
var grantA, grantB authz.GrantQueueItem
|
||||
cdc.MustUnmarshal(kvA.Value, &grantA)
|
||||
cdc.MustUnmarshal(kvB.Value, &grantB)
|
||||
if err := cdc.Unmarshal(kvA.Value, &grantA); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if err := cdc.Unmarshal(kvB.Value, &grantB); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return fmt.Sprintf("%v\n%v", grantA, grantB)
|
||||
default:
|
||||
panic(fmt.Sprintf("invalid authz key %X", kvA.Key))
|
||||
|
||||
@ -4,10 +4,9 @@ import (
|
||||
"context"
|
||||
|
||||
"cosmossdk.io/collections"
|
||||
"cosmossdk.io/core/codec"
|
||||
corestoretypes "cosmossdk.io/core/store"
|
||||
govv1 "cosmossdk.io/x/gov/types/v1"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@ -10,6 +10,7 @@ import (
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"cosmossdk.io/core/appmodule"
|
||||
"cosmossdk.io/core/codec"
|
||||
"cosmossdk.io/core/registry"
|
||||
govclient "cosmossdk.io/x/gov/client"
|
||||
"cosmossdk.io/x/gov/client/cli"
|
||||
@ -20,7 +21,6 @@ import (
|
||||
"cosmossdk.io/x/gov/types/v1beta1"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/client"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/simsx"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
|
||||
@ -157,7 +157,11 @@ func (am AppModule) RegisterMigrations(mr appmodule.MigrationRegistrar) error {
|
||||
|
||||
// DefaultGenesis returns default genesis state as raw bytes for the gov module.
|
||||
func (am AppModule) DefaultGenesis() json.RawMessage {
|
||||
return am.cdc.MustMarshalJSON(v1.DefaultGenesisState())
|
||||
data, err := am.cdc.MarshalJSON(v1.DefaultGenesisState())
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
// ValidateGenesis performs genesis state validation for the gov module.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user