Skip to content
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: types: ensure .Amount is non-nil in Coin.Validate() #15691

Merged
merged 1 commit into from
Apr 5, 2023

Conversation

odeke-em
Copy link
Collaborator

@odeke-em odeke-em commented Apr 4, 2023

This change fixes a scenario in which Coin.Validate() would panic when given a nil Amount. While here, added a fuzz test along with unit/regression tests.

Fixes #15690

@odeke-em odeke-em requested a review from a team as a code owner April 4, 2023 16:55
@github-actions

This comment has been minimized.

@odeke-em odeke-em force-pushed the types-make-Coin.Validate-check-for-non-nil-Amount branch 3 times, most recently from 5217ed6 to 6a7d94c Compare April 4, 2023 16:59
@odeke-em odeke-em requested a review from tac0turtle April 4, 2023 17:20
@odeke-em odeke-em force-pushed the types-make-Coin.Validate-check-for-non-nil-Amount branch from 6a7d94c to 3bab1c8 Compare April 4, 2023 17:37
Copy link
Contributor

@JeancarloBarrios JeancarloBarrios left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

types/coin_test.go Outdated Show resolved Hide resolved
@odeke-em odeke-em force-pushed the types-make-Coin.Validate-check-for-non-nil-Amount branch from 3bab1c8 to 268429c Compare April 4, 2023 18:05
@odeke-em
Copy link
Collaborator Author

odeke-em commented Apr 4, 2023

Kindly cc-ing @julienrbrt for a review too. Thank you

Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this makes sense!

types/coin_test.go Outdated Show resolved Hide resolved
This change fixes a scenario in which Coin.Validate() would
panic when given a nil Amount. While here, added a fuzz test
along with unit/regression tests.
Found and reported by the Quicksilver team.

Fixes #15690
@odeke-em odeke-em force-pushed the types-make-Coin.Validate-check-for-non-nil-Amount branch from 268429c to c95c6c7 Compare April 5, 2023 05:35
@odeke-em odeke-em enabled auto-merge (squash) April 5, 2023 06:13
@odeke-em odeke-em merged commit a7e2df2 into main Apr 5, 2023
@odeke-em odeke-em deleted the types-make-Coin.Validate-check-for-non-nil-Amount branch April 5, 2023 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants