-
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
fix(x/distribution): add nil check in Params.ValidateBasic #17236
Conversation
Hi! Could you add a test? |
x/distribution/types/params.go
Outdated
@@ -18,6 +19,10 @@ func DefaultParams() Params { | |||
|
|||
// ValidateBasic performs basic validation on distribution parameters. | |||
func (p Params) ValidateBasic() error { | |||
if p.CommunityTax.IsNil() { |
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 not using just doing return validateCommunityTax(p.CommunityTax)
instead?
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.
That's a good idea. I'll add an update
Use function `validateCommunityTax` in `Params.ValidateBasic`.
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.
Awesome, thank you! Could you add a changelog entry under unreleased bug fixes?
Using function |
You could add the following test case in {"community tax nil", fields{sdkmath.LegacyDec{}, toDec("0"), toDec("0"), false}, true}, |
Both test case and change log is updated. |
Could you update the integration tests?
|
Add test case in integration test `TestMsgUpdateParams` and update related error messages.
Head branch was pushed to by a user without write access
(cherry picked from commit b9b325e)
…17236) (#17241) Co-authored-by: n0b0dy <[email protected]>
Description
This change fixes a scenario in which Params.Validate() would panic when given a nil CommunityTax.
Fixes #17235
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
make lint
andmake test
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