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.
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
fix: avoid panic when migrate param for newly added host #6167
Changes from 7 commits
3d09829
0f52582
ef89bbe
c140b93
eb28d2c
f33b221
215785d
3ffc86c
338df0b
debe264
8cb18ce
5c1b9ec
4142567
0c5c440
1ba7d37
7f45153
c2d0397
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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! 🙏