diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c5c5569f4..ba5678b8db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Breaking Changes * (consensus) [\#1178](https://github.com/Finschia/finschia-sdk/pull/1178) change the consensus from Ostracon to Tendermint v0.34.24 +* (all) [\#1007](https://github.com/Finschia/finschia-sdk/pull/1007) catch up with the upstream's module versions ### State Machine Breaking diff --git a/x/auth/module.go b/x/auth/module.go index b228cd64a9..b0bfc34791 100644 --- a/x/auth/module.go +++ b/x/auth/module.go @@ -22,6 +22,9 @@ import ( "github.com/Finschia/finschia-sdk/x/auth/types" ) +// ConsensusVersion defines the current x/auth module consensus version. +const ConsensusVersion = 2 + var ( _ module.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} @@ -122,10 +125,10 @@ func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sd func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterQueryServer(cfg.QueryServer(), am.accountKeeper) - // m := keeper.NewMigrator(am.accountKeeper) - // if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil { - // panic(fmt.Sprintf("failed to migrate x/auth from version 1 to 2: %v", err)) - // } + m := keeper.NewMigrator(am.accountKeeper, cfg.QueryServer()) + if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil { + panic(fmt.Sprintf("failed to migrate x/auth from version 1 to 2: %v", err)) + } } // InitGenesis performs genesis initialization for the auth module. It returns @@ -145,7 +148,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } +func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } // AppModuleSimulation functions diff --git a/x/bank/module.go b/x/bank/module.go index adfa071d94..43fe038e22 100644 --- a/x/bank/module.go +++ b/x/bank/module.go @@ -25,6 +25,9 @@ import ( "github.com/Finschia/finschia-sdk/x/bank/types" ) +// ConsensusVersion defines the current x/bank module consensus version. +const ConsensusVersion = 2 + var ( _ module.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} @@ -158,7 +161,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } +func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } // AppModuleSimulation functions diff --git a/x/crisis/module.go b/x/crisis/module.go index 787320a404..61e6435e40 100644 --- a/x/crisis/module.go +++ b/x/crisis/module.go @@ -129,11 +129,6 @@ func (AppModule) LegacyQuerierHandler(*codec.LegacyAmino) sdk.Querier { return n // RegisterServices registers module services. func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), am.keeper) - - // m := keeper.NewMigrator(*am.keeper) - // if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil { - // panic(fmt.Sprintf("failed to migrate x/crisis from version 1 to 2: %v", err)) - // } } // InitGenesis performs genesis initialization for the crisis module. It returns diff --git a/x/distribution/module.go b/x/distribution/module.go index b5ab03481b..5916b073a9 100644 --- a/x/distribution/module.go +++ b/x/distribution/module.go @@ -22,6 +22,9 @@ import ( "github.com/Finschia/finschia-sdk/x/distribution/types" ) +// ConsensusVersion defines the current x/distribution module consensus version. +const ConsensusVersion = 2 + var ( _ module.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} @@ -136,10 +139,10 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), am.keeper) - // m := keeper.NewMigrator(am.keeper) - // if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil { - // panic(fmt.Sprintf("failed to migrate x/distribution from version 1 to 2: %v", err)) - // } + m := keeper.NewMigrator(am.keeper) + if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil { + panic(fmt.Sprintf("failed to migrate x/distribution from version 1 to 2: %v", err)) + } } // InitGenesis performs genesis initialization for the distribution module. It returns @@ -159,7 +162,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } +func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } // BeginBlock returns the begin blocker for the distribution module. func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { diff --git a/x/evidence/module.go b/x/evidence/module.go index 74c91b3650..dd091b7804 100644 --- a/x/evidence/module.go +++ b/x/evidence/module.go @@ -140,11 +140,6 @@ func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sd func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), am.keeper) - - // m := keeper.NewMigrator(am.keeper) - // if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil { - // panic(fmt.Sprintf("failed to migrate x/evidence from version 1 to 2: %v", err)) - // } } // RegisterInvariants registers the evidence module's invariants. diff --git a/x/gov/module.go b/x/gov/module.go index 8ab13f287e..4fc810a513 100644 --- a/x/gov/module.go +++ b/x/gov/module.go @@ -146,11 +146,6 @@ func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sd func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), am.keeper) - - // m := keeper.NewMigrator(am.keeper) - // if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil { - // panic(fmt.Sprintf("failed to migrate x/gov from version 1 to 2: %v", err)) - // } } // InitGenesis performs genesis initialization for the gov module. It returns diff --git a/x/mint/module.go b/x/mint/module.go index d13d8024bd..2d3aee1d83 100644 --- a/x/mint/module.go +++ b/x/mint/module.go @@ -118,11 +118,6 @@ func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sd // module-specific gRPC queries. func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterQueryServer(cfg.QueryServer(), am.keeper) - - /* m := keeper.NewMigrator(am.keeper) - if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil { - panic(fmt.Sprintf("failed to migrate x/mint from version 1 to 2: %v", err)) - } */ } // InitGenesis performs genesis initialization for the mint module. It returns diff --git a/x/slashing/module.go b/x/slashing/module.go index 45d9bb95bb..9dc575d267 100644 --- a/x/slashing/module.go +++ b/x/slashing/module.go @@ -22,6 +22,9 @@ import ( "github.com/Finschia/finschia-sdk/x/slashing/types" ) +// ConsensusVersion defines the current x/slashing module consensus version. +const ConsensusVersion = 2 + var ( _ module.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} @@ -131,10 +134,10 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), am.keeper) - // m := keeper.NewMigrator(am.keeper) - // if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil { - // panic(fmt.Sprintf("failed to migrate x/slashing from version 1 to 2: %v", err)) - // } + m := keeper.NewMigrator(am.keeper) + if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil { + panic(fmt.Sprintf("failed to migrate x/slashing from version 1 to 2: %v", err)) + } } // InitGenesis performs genesis initialization for the slashing module. It returns @@ -154,7 +157,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } +func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } // BeginBlock returns the begin blocker for the slashing module. func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { diff --git a/x/staking/module.go b/x/staking/module.go index 81acce60b8..85ea5e39ce 100644 --- a/x/staking/module.go +++ b/x/staking/module.go @@ -22,6 +22,10 @@ import ( "github.com/Finschia/finschia-sdk/x/staking/types" ) +const ( + consensusVersion uint64 = 2 +) + var ( _ module.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} @@ -133,10 +137,10 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { querier := keeper.Querier{Keeper: am.keeper} types.RegisterQueryServer(cfg.QueryServer(), querier) - // m := keeper.NewMigrator(am.keeper) - // if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil { - // panic(fmt.Sprintf("failed to migrate x/staking from version 1 to 2: %v", err)) - // } + m := keeper.NewMigrator(am.keeper) + if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil { + panic(fmt.Sprintf("failed to migrate x/staking from version 1 to 2: %v", err)) + } } // InitGenesis performs genesis initialization for the staking module. It returns @@ -157,7 +161,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } +func (AppModule) ConsensusVersion() uint64 { return consensusVersion } // BeginBlock returns the begin blocker for the staking module. func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { diff --git a/x/upgrade/module.go b/x/upgrade/module.go index 3da462e2b8..c1cb610278 100644 --- a/x/upgrade/module.go +++ b/x/upgrade/module.go @@ -94,11 +94,6 @@ func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sd // module-specific GRPC queries. func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterQueryServer(cfg.QueryServer(), am.keeper) - - /* m := keeper.NewMigrator(am.keeper) - if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil { - panic(fmt.Sprintf("failed to migrate x/upgrade from version 1 to 2: %v", err)) - } */ } // InitGenesis is ignored, no sense in serializing future upgrades