Skip to content

Commit

Permalink
Upgraded cosmos version to v0.44
Browse files Browse the repository at this point in the history
  • Loading branch information
arhamchordia committed Jan 5, 2022
1 parent 0651459 commit 30993ec
Show file tree
Hide file tree
Showing 8 changed files with 692 additions and 154 deletions.
11 changes: 7 additions & 4 deletions application/application.go
Expand Up @@ -10,19 +10,18 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth"
authTypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
sdkAuthzModule "github.com/cosmos/cosmos-sdk/x/authz/module"
"github.com/cosmos/cosmos-sdk/x/bank"
"github.com/cosmos/cosmos-sdk/x/capability"
"github.com/cosmos/cosmos-sdk/x/crisis"
"github.com/cosmos/cosmos-sdk/x/distribution"
distributionClient "github.com/cosmos/cosmos-sdk/x/distribution/client"
distributionTypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
"github.com/cosmos/cosmos-sdk/x/evidence"
sdkFeegrantModule "github.com/cosmos/cosmos-sdk/x/feegrant/module"
"github.com/cosmos/cosmos-sdk/x/genutil"
"github.com/cosmos/cosmos-sdk/x/gov"
govTypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/cosmos/cosmos-sdk/x/ibc/applications/transfer"
ibcTransferTypes "github.com/cosmos/cosmos-sdk/x/ibc/applications/transfer/types"
ibc "github.com/cosmos/cosmos-sdk/x/ibc/core"
"github.com/cosmos/cosmos-sdk/x/mint"
mintTypes "github.com/cosmos/cosmos-sdk/x/mint/types"
"github.com/cosmos/cosmos-sdk/x/params"
Expand All @@ -32,6 +31,9 @@ import (
stakingTypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradeClient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
"github.com/cosmos/ibc-go/v2/modules/apps/transfer"
ibcTransferTypes "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v2/modules/core"
"github.com/persistenceOne/persistenceCore/x/halving"
)

Expand Down Expand Up @@ -64,6 +66,7 @@ var ModuleBasics = module.NewBasicManager(
evidence.AppModuleBasic{},
transfer.AppModuleBasic{},
vesting.AppModuleBasic{},

sdkAuthzModule.AppModuleBasic{},
sdkFeegrantModule.AppModuleBasic{},
halving.AppModuleBasic{},
)
204 changes: 127 additions & 77 deletions application/base.go

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions application/initialize/addGenesisAccountCommand.go
Expand Up @@ -45,8 +45,8 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx := client.GetClientContextFromCmd(cmd)
depCdc := clientCtx.JSONMarshaler
cdc := depCdc.(codec.Marshaler)
depCdc := clientCtx.Codec
cdc := depCdc.(codec.Codec)

serverCtx := server.GetServerContextFromCmd(cmd)
config := serverCtx.Config
Expand Down
2 changes: 1 addition & 1 deletion application/params/encoding.go
Expand Up @@ -15,7 +15,7 @@ import (
// This is provided for compatibility between protobuf and amino implementations.
type EncodingConfiguration struct {
InterfaceRegistry types.InterfaceRegistry
Marshaler codec.Marshaler
Marshaler codec.Codec
TransactionConfig client.TxConfig
Amino *codec.LegacyAmino
}
16 changes: 9 additions & 7 deletions go.mod
Expand Up @@ -3,21 +3,23 @@ module github.com/persistenceOne/persistenceCore
go 1.16

require (
github.com/cosmos/cosmos-sdk v0.42.8
github.com/cosmos/cosmos-sdk v0.44.5

This comment has been minimized.

Copy link
@faddat

faddat Jan 22, 2022

somewhat strongly recommend that you skip directly to v0.45.0-- same state breaking painful upgrade, new, better performance

github.com/cosmos/ibc-go/v2 v2.0.2
github.com/gogo/protobuf v1.3.3
github.com/golang/protobuf v1.5.2
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/rakyll/statik v0.1.7
github.com/spf13/cobra v1.1.3
github.com/spf13/viper v1.7.1
github.com/spf13/cobra v1.2.1
github.com/spf13/viper v1.8.1
github.com/strangelove-ventures/packet-forward-middleware v1.0.1
github.com/stretchr/testify v1.7.0
github.com/tendermint/tendermint v0.34.11
github.com/tendermint/tendermint v0.34.14
github.com/tendermint/tm-db v0.6.4
google.golang.org/genproto v0.0.0-20210114201628-6edceaf6022f
google.golang.org/grpc v1.37.0
google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71
google.golang.org/grpc v1.42.0
gopkg.in/yaml.v2 v2.4.0
honnef.co/go/tools v0.0.1-2019.2.3
honnef.co/go/tools v0.0.1-2020.1.4
)

replace google.golang.org/grpc => google.golang.org/grpc v1.33.2
Expand Down
588 changes: 533 additions & 55 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions node/main.go
Expand Up @@ -49,7 +49,7 @@ func main() {

encodingConfig := application.MakeEncodingConfig()
initClientCtx := client.Context{}.
WithJSONMarshaler(encodingConfig.Marshaler).
WithJSONCodec(encodingConfig.Marshaler).
WithInterfaceRegistry(encodingConfig.InterfaceRegistry).
WithTxConfig(encodingConfig.TransactionConfig).
WithLegacyAmino(encodingConfig.Amino).
Expand All @@ -68,7 +68,7 @@ func main() {
return err
}

return server.InterceptConfigsPreRunHandler(cmd)
return server.InterceptConfigsPreRunHandler(cmd, "", nil)
},
}

Expand Down
17 changes: 11 additions & 6 deletions x/halving/module.go
Expand Up @@ -36,7 +36,7 @@ var (

// AppModuleBasic defines the basic application module used by the halving module.
type AppModuleBasic struct {
cdc codec.Marshaler
cdc codec.Codec
}

var _ module.AppModuleBasic = AppModuleBasic{}
Expand All @@ -54,12 +54,12 @@ func (b AppModuleBasic) RegisterInterfaces(_ cdctypes.InterfaceRegistry) {}

// DefaultGenesis returns default genesis state as raw bytes for the halving
// module.
func (AppModuleBasic) DefaultGenesis(cdc codec.JSONMarshaler) json.RawMessage {
func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage {
return cdc.MustMarshalJSON(types.DefaultGenesisState())
}

// ValidateGenesis performs genesis state validation for the halving module.
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONMarshaler, _ client.TxEncodingConfig, bz json.RawMessage) error {
func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error {
var data types.GenesisState
if err := cdc.UnmarshalJSON(bz, &data); err != nil {
return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err)
Expand Down Expand Up @@ -96,7 +96,7 @@ type AppModule struct {
}

// NewAppModule creates a new AppModule object
func NewAppModule(cdc codec.Marshaler, keeper keeper.Keeper) AppModule {
func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule {
return AppModule{
AppModuleBasic: AppModuleBasic{cdc: cdc},
keeper: keeper,
Expand All @@ -119,6 +119,11 @@ func (AppModule) QuerierRoute() string {
return types.QuerierRoute
}

// ConsensusVersion returns the halving module's consensus version number.
func (am AppModule) ConsensusVersion() uint64 {
return am.ConsensusVersion()
}

// LegacyQuerierHandler returns the halving module sdk.Querier.
func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier {
return keeper.NewQuerier(am.keeper, legacyQuerierCdc)
Expand All @@ -132,7 +137,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) {

// InitGenesis performs genesis initialization for the halving module. It returns
// no validator updates.
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONMarshaler, data json.RawMessage) []abci.ValidatorUpdate {
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate {
var genesisState types.GenesisState
cdc.MustUnmarshalJSON(data, &genesisState)

Expand All @@ -142,7 +147,7 @@ func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONMarshaler, data j

// ExportGenesis returns the exported genesis state as raw bytes for the halving
// module.
func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONMarshaler) json.RawMessage {
func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage {
gs := ExportGenesis(ctx, am.keeper)
return cdc.MustMarshalJSON(gs)
}
Expand Down

0 comments on commit 30993ec

Please sign in to comment.