Skip to content

Commit

Permalink
chore(x/auth): use cosmossdk.io/core/codec instead of `github.com/c…
Browse files Browse the repository at this point in the history
…osmos/cosmos-sdk/codec` (backport #23403) (#23435)
  • Loading branch information
mergify[bot] authored Jan 17, 2025
1 parent 0455db9 commit ee47f7c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
8 changes: 6 additions & 2 deletions x/auth/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import (
"cosmossdk.io/collections"
"cosmossdk.io/core/appmodule"
appmodulev2 "cosmossdk.io/core/appmodule/v2"
"cosmossdk.io/core/codec"
"cosmossdk.io/core/registry"
"cosmossdk.io/core/transaction"
"cosmossdk.io/schema"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/simsx"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
Expand Down Expand Up @@ -123,7 +123,11 @@ func (am AppModule) RegisterMigrations(mr appmodule.MigrationRegistrar) error {

// DefaultGenesis returns default genesis state as raw bytes for the auth module.
func (am AppModule) DefaultGenesis() json.RawMessage {
return am.cdc.MustMarshalJSON(types.DefaultGenesisState())
data, err := am.cdc.MarshalJSON(types.DefaultGenesisState())
if err != nil {
panic(err)
}
return data
}

// ValidateGenesis performs genesis state validation for the auth module.
Expand Down
2 changes: 1 addition & 1 deletion x/auth/tx/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (

txv1beta1 "cosmossdk.io/api/cosmos/tx/v1beta1"
"cosmossdk.io/core/address"
"cosmossdk.io/core/codec"
errorsmod "cosmossdk.io/errors"
"cosmossdk.io/x/tx/decode"

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/tx"
Expand Down
3 changes: 2 additions & 1 deletion x/auth/tx/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import (
gogoproto "github.com/cosmos/gogoproto/proto"
"google.golang.org/protobuf/proto"

"github.com/cosmos/cosmos-sdk/codec"
"cosmossdk.io/core/codec"

sdk "github.com/cosmos/cosmos-sdk/types"
sdktx "github.com/cosmos/cosmos-sdk/types/tx"
)
Expand Down
7 changes: 5 additions & 2 deletions x/auth/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import (
"github.com/cosmos/gogoproto/proto"
gogoprotoany "github.com/cosmos/gogoproto/types/any"

"github.com/cosmos/cosmos-sdk/codec"
"cosmossdk.io/core/codec"

"github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
Expand Down Expand Up @@ -55,7 +56,9 @@ func GetGenesisStateFromAppState(cdc codec.Codec, appState map[string]json.RawMe
var genesisState GenesisState

if appState[ModuleName] != nil {
cdc.MustUnmarshalJSON(appState[ModuleName], &genesisState)
if err := cdc.UnmarshalJSON(appState[ModuleName], &genesisState); err != nil {
panic(err)
}
}

return genesisState
Expand Down

0 comments on commit ee47f7c

Please sign in to comment.