-
Notifications
You must be signed in to change notification settings - Fork 628
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
fix: avoid panic when migrate param for newly added host #6167
Merged
Merged
Changes from 13 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
3d09829
fix: avoid panic when migrate param for newly added host
mmsqe 0f52582
keep default params
mmsqe ef89bbe
Apply suggestions from code review
mmsqe c140b93
Merge remote-tracking branch 'origin/main' into host_params
mmsqe eb28d2c
allow use default params when set nil legacySubspace
mmsqe f33b221
Merge remote-tracking branch 'origin/main' into host_params
mmsqe 215785d
Update CHANGELOG.md
3ffc86c
Update CHANGELOG.md
338df0b
cleanup
mmsqe debe264
Merge remote-tracking branch 'origin/main' into host_params
mmsqe 8cb18ce
refactor: rm setter in icahost migrator and adjust test case
damiannolan 5c1b9ec
chore: update changelog
damiannolan 4142567
Merge branch 'main' into host_params
damiannolan 0c5c440
Apply suggestions from code review
mmsqe 1ba7d37
Merge remote-tracking branch 'origin/main' into host_params
mmsqe 7f45153
Apply suggestions from code review
mmsqe c2d0397
Apply suggestions from code review
mmsqe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Just to clarify when icahost was added in your upgrade it was created with a
nil
legacy subspace? @mmsqeThere 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.
we bypass param migrate with a mockSubspace, but we could change to nil when generic fix is backported
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.
Okay, thank you! In that case this should be fine.
I'm curious about a case in which an actual params subspace is created and passed but which does not have any params stored in the param set from a previous version. As genesis would already have been run for the ica module but not setup default params I would imagine it to be empty. I assume in that case
params.Validate()
should error below, and this would technically misconfiguration by the chain's app wiring.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.
does it error in that case? 🤔 An empty legacySubspace would init params as
{true, []string{}}
which shouldn't fail validation.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.
Aha, yea I believe you're right @DimitrisJim. With
RegisterParamSet(&Params{})
, right?That's probably fine behaviour imo - given this would probably be the result of misconfig anyways - a param's change would need to be done for allowing msgs in
[]string
then. This is a pretty edge case scenario either way. Most chains deploy host first anyways, and controller laterThere 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.
Wondering if this migration code would be safer and cover edge cases such as described above (this would at least init params with all msgs allowed instead of the empty string slice, its a bit more explicit than relying on a side effect of
RegisterParamSet
):Any thoughts? Happy to stick with the current changes tho if agreed.
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.
reads clearer to me! Would we want to use
IfExists
variant though? I'd assume we'd want to panic if we try toget
something and it doesn't exist.One sidenote here, should we be doing same sanity checks for controller?
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.
Do we want to align IfExists for controller in this 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.
I'm not sure, and I don't feel particularly strongly about this - if it doesn't exist we've at least assigned safe defaults via
types.DefaultParams
rather than panicking. Do you have any feedback here @mmsqe, as someone maintaining a chain?@mmsqe yes I think it would be nice to align the controller migration code as well, thank you! 🙏