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

module.Manager.RunMigrations should probably call InitGenesis when new modules are added #8989

Closed
aaronc opened this issue Mar 25, 2021 · 2 comments · Fixed by #9007
Closed
Assignees
Milestone

Comments

@aaronc
Copy link
Member

aaronc commented Mar 25, 2021

I was checking out module.Manager.RunMigrations to see what happens when new modules are added and created #8988.

When a module is added to a chain during an upgrade, we should probably be calling its InitGenesis method. Modules probably expect that InitGenesis was called at some point and may do some special initialization there even with empty genesis state. Either this should either happen automatically in RunMigrations (with an empty genesis state) or explicitly in the UpgradeHandler with possibly some initial state. What do you think @AmauryM @technicallyty ?

@amaury1093
Copy link
Contributor

amaury1093 commented Mar 25, 2021

Calling InitGenesis with empty state iif fromVersion == 0 makes sense to me

If an app developer wants to override that, they can just explicitly set the module's fromVersion to the latest version in the upgrade handler, and call InitGenesis with their own custom genesis.

@aaronc
Copy link
Member Author

aaronc commented Mar 25, 2021

Calling InitGenesis with empty state iif fromVersion == 0 makes sense to me

If an app developer wants to override that, they can just explicitly set the module's fromVersion to the latest version in the upgrade handler, and call InitGenesis with their own custom genesis.

Makes sense. I like that approach. Let's remember to document that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants