-
Notifications
You must be signed in to change notification settings - Fork 955
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
Add methods for checked additions/subtractions of Amount
s
#748
Comments
slight note: the referred methods only panic in |
We should always be using checked arithmetic. @bengtlofgren is this maybe a quick change you could do? |
NB: there is now already namada/core/src/types/token.rs Lines 74 to 79 in 76169dc
|
Checked arithmetic was also brought in by other branches, but this one is the only one with the tests. * james/mainline/checked-amounts: [ci] wasm checksums update Add changelog Add tests for Amount checked arithmetic Add Amount::checked_add method
Amount::spend
andAmount::receive
panic if there is an overflow/underflow. We want methods as well to do checked additions or subtractions safely, e.g. we may want a VP to reject a transaction in the normal way if it would overflow rather than panicking.The text was updated successfully, but these errors were encountered: