Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: catch up with the upstream's module versions #1007

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 8 additions & 5 deletions x/auth/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down
5 changes: 4 additions & 1 deletion x/bank/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down Expand Up @@ -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

Expand Down
5 changes: 0 additions & 5 deletions x/crisis/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 8 additions & 5 deletions x/distribution/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down Expand Up @@ -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
Expand All @@ -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) {
Expand Down
5 changes: 0 additions & 5 deletions x/evidence/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 0 additions & 5 deletions x/gov/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions x/mint/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 8 additions & 5 deletions x/slashing/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down Expand Up @@ -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
Expand All @@ -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) {
Expand Down
14 changes: 9 additions & 5 deletions x/staking/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ import (
"github.com/Finschia/finschia-sdk/x/staking/types"
)

const (
consensusVersion uint64 = 2
)

var (
_ module.AppModule = AppModule{}
_ module.AppModuleBasic = AppModuleBasic{}
Expand Down Expand Up @@ -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
Expand All @@ -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) {
Expand Down
5 changes: 0 additions & 5 deletions x/upgrade/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading