-
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
Migrate genesis cmd #4471
Migrate genesis cmd #4471
Conversation
Signed-off-by: Karoly Albert Szabo <[email protected]>
Signed-off-by: Karoly Albert Szabo <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #4471 +/- ##
==========================================
+ Coverage 54.81% 54.89% +0.07%
==========================================
Files 269 271 +2
Lines 16923 16975 +52
==========================================
+ Hits 9276 9318 +42
- Misses 6965 6972 +7
- Partials 682 685 +3 |
@sabau this shouldn't exist in the SDK :) |
So should we move also the other script in Gaia? |
I think those migration helpers belong to here or to the docs. |
@sabau I guess if there isn't anything specific pertaining to gaia, then it's fine. But also, the SDK may not contain all upgrades that are possible (e.g. we're skipping v0.35.0). So maybe it should live in Gaia? Also, @rigelrozanski expressed interest in the new script being written in Go. i.e. under |
But this means translating/moving also the previous script? I don't have strong preferences between having it in Bash, Go or Python I would just prefer to have all those migrations tools written in the same language. |
@alexanderbez I strongly disagree with this, specially because we'll need to create structs specifically for the changes made (see this comment #4023 (review)). I actually started the last genesis script in Go (see first commits on #4023) but then we all agreed on using Python because it's untyped and way easier to make the changes required. cc: @alessio |
Signed-off-by: Karoly Albert Szabo <[email protected]>
Yes, that exactly was the rationale behind the choice of the language |
No, we should leave this unchanged.
Correct. This is mostly a point of contention with @rigelrozanski. |
So we keep Python for this release and I've opened an issue to build the proper tool for long term upgrading, sounds good?
Wouldn't we want to cover situations where someone updates from 0.33 to 0.36? Or we say that only from a certain point on this will happen (after the proper migration strategy is implemented) Can we apply a logic similar to typical database migrations? So from now on (next release on) every PR that breaks genesis will need also to add a script that does the conversion |
No, we wouldn't. We don't need to take on that technical burden and overhead. If someone really wants to migrate genesis from cosmoshub-1 to cosmoshub-3, they can first migrate to cosmoshub-2.
As discussed in person, PRs that break genesis state must include the accompanying migration logic in |
Maybe it's a good idea to also create a |
Recreating structs and types that had been abandoned in favor of new ones comes with maintenance burden - incidentally it would be the only reason to write the migration script/logic in Go. So I see 2 options here:
If we go with 1. we need to implement such logic in Go, integrate it in the codebase and maintain it. |
@alessio I think in the long run we'll want to automatically migrate the genesis state. Ideally any PR that breaks the genesis should include a port file with functions that port the specific genesis state that's broken to the new version. It'd be cool to have something like what we have with the |
There is zero maintenance burden. You define them once. You don't have to maintain anything. We're drastically overthinking here as this is outside the scope of live upgrades. This is simply a means to migrate genesis from the current version to the next/new version. It should be pretty trivial to implement. We only implement a migration from one version to another -- we don't maintain or support anything else. Any PR that changes the genesis is responsible for including any necessary updates to the current and only migration (script). So I agree with @fedekunze here that we should use a GH tag for this. Example:// contrib/export/v0_34_x_to_v0_36_0
// NOTE: We skip v0.35.0
package main
type (
// THESE TYPES NEVER CHANGE ONCE REVIEWED/MERGED
CurrentProposal struct {
// ...
}
NewProposal struct {
// ...
}
)
func migrate(appStateBz []byte) NewGenesisState {
var (
appState OldGenesisState
newAppState NewGenesisState
)
// use old types to load into appState
// use new types to set into newAppState
return newAppState
}
func main() {
appStateBz := read(args[0])
newGenState := migrate(appStateBz)
err := write(newGenState, output)
// handle error
} |
In the short them I would prefer Python, but if can be propedeutic to for the proper store upgrade let's do it in Go |
Signed-off-by: Karoly Albert Szabo <[email protected]>
Once done need to experiment with go plugins to switch types as make parameters Signed-off-by: Karoly Albert Szabo <[email protected]>
Signed-off-by: Karoly Albert Szabo <[email protected]>
Signed-off-by: Karoly Albert Szabo <[email protected]>
Signed-off-by: Karoly Albert Szabo <[email protected]>
Signed-off-by: Karoly Albert Szabo <[email protected]>
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
@fedekunze @rigelrozanski last changes should fix your concerns, would you like to take a look? |
Signed-off-by: Karoly Albert Szabo <[email protected]>
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.
utACK. One minor nit
Co-Authored-By: Federico Kunze <[email protected]>
Signed-off-by: Karoly Albert Szabo <[email protected]>
… sabau/4409-migrate-genesis
Signed-off-by: Karoly Albert Szabo <[email protected]>
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.
One more tiny nit. Also, we need to account for and test two further changes/updates:
- Supply module (any pools). Sync with @rigelrozanski and @fedekunze on this.
- Slash event periods are now required to be included in the ValidatorSlashEvent object. Sync with @rigelrozanski on this.
Signed-off-by: Karoly Albert Szabo <[email protected]>
I think will make more sense to merge this as it is and add the supply changes in a second PR and the validator slash changes in a third (that will be really little), or we end up having another big PR. |
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 in addressing further changes in separate PRs.
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.
uACK
Closes #4409
Targeted PR against correct branch (see CONTRIBUTING.md)
Linked to github-issue with discussion and accepted design OR link to spec that describes this work.
Wrote tests
Updated relevant documentation (
docs/
)Added a relevant changelog entry:
clog add [section] [stanza] [message]
rereviewed
Files changed
in the github PR explorerFor Admin Use: