Created
July 5, 2022 01:11
-
-
Save zeroFruit/4cdeef13eb5fafe9f3312518a100583c to your computer and use it in GitHub Desktop.
Cosmos Dev Series: Cosmos-SDK-based Blockchain Upgrade - x/foo module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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