migrate oracle to v2 from commit-b4a331e67 #241
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This is a demo to show how migration works.
This commit upgrade oracle from consesusVersion=1 to consensusVersion=2 which modified the structure of
Params
Changes
Notable Changes:
1.1 functions to do the modification on v1 data structure
func MigrateV1ToV2(ctx sdk.Context, k keeper.Keeper) error
, it basically includes: a) read v1 data from kv, b) do transformation, c) save new data into kv1.2 register the migration function into configuration, this is done inside
RegisterService
, so WhenRegisterService
is called, the migration methods will be registered on that configuration, which will finally be referred by moduleManager2.1 implement a
setHandler
method for ExocoreApp, and invoke it before state is loaded when start a node.2.2 in the
setHandler
, it will do:2.2.1 set the Handler with the 'upgradeName' which need to be the same with the name set in gov-proposal
2.2.2 the handler function should eventually call moduleManager.RunMigrations, which will iterate all migration executor of each modules and run it if exists.
2.3 after the handler registered. If there is need to do one of {add, rename, delete} upgrade-action, we should do it here by reset the storeLoader with the upgradeInfo
Closes #XXX