-
Notifications
You must be signed in to change notification settings - Fork 110
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
zetacored migrations run twice #2077
Comments
re migration run twice: I think if you upgrade from v15->v16 you have 1 upgrade handler and one consensus version for modules being upgraded (in this case observer consensus version is bumped from 6 to 7, therefore migration is run) if you want to upgrade v16->v17 and again upgrade observer module, you again bump consensus version and add migration script and so on, but also upgrade handler changes, where you would remove triggering observer migration if you don't need it, or add new migration from consensus version 7 to 8 etc - basically it is also new upgrade handler for every upgrade i think we store only last upgrade handler in codebase, so we are modifying it at the moment with new upgrades, but for next upgrade upgrade handler will probably be different in situation you mention, upgrade handler for v17 would not contain part that triggers observer migration setting manually to latest ConsensusVersion is recommended in upgrade handler afaik, if you want to skip init genesis as you mentioned (or in other words, if module is not new), but i agree we don't store module version map, which is why we need to manually trigger migration by reducing consensus version -1 this causes extra effort and more manual work if we want to run cosmos modules upgrades when we upgrade cosmos-sdk version (eg in cosmos 0.47 upgrade PR i have to do the same for cosmos modules to trigger their migrations, otherwise it wont be detected automatically because we dont store the map and so we should store this map, and remove |
All I think we can do for now is add the |
The function is already called automatically I belive when the upgrade is applied We can see the versions on mainnet here However, I do agree manually decrementing the version is not the correct approach |
THe issue with initi genesis , should also be solved because new modules would not exist in the fromVM , which is much more cleaner that using using some some weird logic like this .
Just posting this as an example to explain what I mean |
Ah I understand now the point of calling So the consensus versions should already be committed to the disk on |
but maybe we still need to add this to init chainer to test upgrades locally? currently |
Yeah, exactly. We can remove the -1 for now. It should solve the following problems for us.
I can create a PR and run some tests. |
The zetacored migrations seem to be running twice. To reproduce, upgrade from
v14
tov15
to a third version:The way that we choose which migrations to run seems to differ quite a bit from how cosmos suggests. First, there is this logic which means that we will always run the last migration from the observer module:
node/app/setup_handlers.go
Lines 47 to 49 in 022ea57
We also seem to be just ignoring the
x/upgrade
state version map and forcibly setting all modules to the latest version:node/app/setup_handlers.go
Lines 19 to 21 in 022ea57
This has effect of always skipping migrations of any module other than
observer
. It apparently will also result inInitGenesis
not being called for any new modules. SeeRunMigrations
for more info. If we just want to always skipInitGenesis
for all modules, then the correct logic would look more like this:We also do not seem to be ever calling
app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap())
inInitChainer
so the upgrade state is never committed to the disk. Because of this, theupgradeHandler
fromVM
version map always returns 0.The text was updated successfully, but these errors were encountered: