-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
feat: update x/upgrade keeper.DumpUpgradeInfoToDisk to support Plan.Info #10532
Conversation
x/upgrade/keeper/keeper.go
Outdated
// `info` should be provided and contain Plan.Info data in order to support | ||
// auto upgrade functionality by cosmovisor and other tools using upgarde-info.json | ||
// (GetUpgradeInfoPath()) file. | ||
func (k Keeper) DumpUpgradeInfoToDisk(height int64, name string, info ...string) error { |
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.
trick to make the API backward compatible.
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.
Why don't we just add another overload DumpFullUpgradeInfoToDisk
? The varargs feels too hacky.
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.
The master
branch already has it as DumpUpgradeInfoToDisk(height int64, p types.Plan) error
. This PR is just to get the functionality into v0.44.x
.
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.
The question was if we should do it by adding new function (and instantly marking it "deprecated") or overloading the existing DumpUpgradeInfoToDisk
.
In general overloading smells bad, so Aaron comment makes 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.
LGTM
// `info` should be provided and contain Plan.Info data in order to support | ||
// auto download functionality by cosmovisor and other tools using upgarde-info.json | ||
// (GetUpgradeInfoPath()) file. | ||
func (k Keeper) DumpUpgradeInfoWithInfoToDisk(height int64, name string, info string) error { |
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.
I hate this kind of names.... but couldn't find better one
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.
I don't like it either lol. What about *WithPlan
? Also, why is a new function being introduced and marked as deprecated?
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.
The whole thing is a Plan (name, height, info...).
In original solution I overloaded the DumpUpgradeInfoToDisk
using additional vararg (that made it backward compatible). I agree with Aaron, that overloading doesn't smell good. see: #10532 (comment)
return k.DumpUpgradeInfoWithInfoToDisk(height, name, "") | ||
} | ||
|
||
// Deprecated: DumpUpgradeInfoWithInfoToDisk writes upgrade information to UpgradeInfoFileName. |
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.
adding a new function which is deprecated
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.
Ok
…nfo (cosmos#10532) * feat: update x/upgrade keeper.DumpUpgradeInfoToDisk to support Plan.Info * add changelog * create DumpUpgradeInfoWithInfoToDisk instead of overloading DumpUpgradeInfoToDisk
…nfo (cosmos#10532) * feat: update x/upgrade keeper.DumpUpgradeInfoToDisk to support Plan.Info * add changelog * create DumpUpgradeInfoWithInfoToDisk instead of overloading DumpUpgradeInfoToDisk
…nfo (cosmos#10532) * feat: update x/upgrade keeper.DumpUpgradeInfoToDisk to support Plan.Info * add changelog * create DumpUpgradeInfoWithInfoToDisk instead of overloading DumpUpgradeInfoToDisk
Description
Closes: #10531
Closes: #10428
Straw-man attempt to bring the plan.Info data in to upgrade-info.json file in a backward compatible way.
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change