-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
ADR 041: In-Place Store Migrations #8646
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 this is a great addition. Thanks @AmauryM for the ADR.
Just small nits otherwise, looks great
Just a little idea, instead of per module increasing of protocolVersion that is somehow "arbitrary" wouldn't it be better if there was a fixed general version and the modules that update can subscribe their update to it? In the end we only migrate when we change version, ex. 2.0.1 to 3, even minor versions too. So for example staking can subscribe an update to version 2.0.1, but maybe wont subscribe to version 3 when it comes. |
I wonder if we could use the upgrade plan name instead of version numbers, this way it would be even more clear from a administration perspective. I agree on the subscription idea, it would be easier to maintain in the future. |
I don't really consider it arbitrary at all. When a module introduces a state machine breaking change it increments its version creating a mechanism for running automatic migrations.
The upgrade plan names live at a totally different level from these module versions. Each chain using modules has their own upgrade names, but modules need a way to track their own state machine version. That's all this is doing. |
Thanks for clarification @aaronc, makes a lot of sense. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally LGTM. Thanks @AmauryM !
- Fetch the old ConsensusVersion of the module from its `migrationMap` argument (let's call it `M`). | ||
- Fetch the new ConsensusVersion of the module from the `ConsensusVersion()` method on `AppModule` (call it `N`). | ||
- If `N>M`, run all registered migrations for the module sequentially `M -> M+1 -> M+2...` until `N`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's explain that if there is no old ConsensusVersion, no migration is run but the version is set in the new migration map. i.e. if we add module foo
to our chain at version 5, no migrations will be run but 5 will be saved as the current version after migrations are run.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. The upgradeKeeper.SetCurrentConsensusVersions()
method to store the current module versions is run right after the upgrade handler.
Co-authored-by: Aaron Craelius <[email protected]>
Co-authored-by: Robert Zaremba <[email protected]>
Co-authored-by: Robert Zaremba <[email protected]>
Co-authored-by: Robert Zaremba <[email protected]>
Co-authored-by: Robert Zaremba <[email protected]>
Co-authored-by: Robert Zaremba <[email protected]>
Co-authored-by: Robert Zaremba <[email protected]>
…cosmos-sdk into am/adr-in-place-migrations
to make the keepers not so fat, I added in the latest commits the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 🎉 . Left a few minor comments. Feel free to merge when ready.
Co-authored-by: Aaron Craelius <[email protected]>
Co-authored-by: Aaron Craelius <[email protected]>
Co-authored-by: Aaron Craelius <[email protected]>
Description
closes #8532
rendered
Please note that the implementation of this ADR has already started as part of #8345
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes