Skip to content

Instantly share code, notes, and snippets.

@zeroFruit
Created July 5, 2022 01:11
Show Gist options
  • Save zeroFruit/4cdeef13eb5fafe9f3312518a100583c to your computer and use it in GitHub Desktop.
Save zeroFruit/4cdeef13eb5fafe9f3312518a100583c to your computer and use it in GitHub Desktop.
Cosmos Dev Series: Cosmos-SDK-based Blockchain Upgrade - x/foo module
package foo
// RegisterServices registers a GRPC query service to respond to the
// module-specific GRPC queries.
func (am AppModule) RegisterServices(cfg module.Configurator) {
...
migrator := keeper.NewMigrator(am.keeper)
// register v1 -> v2 migration
if err := cfg.RegisterMigration(types.ModuleName, 1, migrator.Migrate1to2); err != nil {
panic(fmt.Errorf("failed to migrate %s to v2: %w", types.ModuleName, err))
}
}
// ConsensusVersion implements ConsensusVersion.
func (AppModule) ConsensusVersion() uint64 {
return 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment