-
Notifications
You must be signed in to change notification settings - Fork 116
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
[x/programs] Utilize safe math for programs #591
Comments
I don't think we need a safe-math library. Rust has all the It might be more beneficial to gently guide hyper-program developers to fuzz and/or prop-testing their public methods, such that they realize which std types and methods they need to use to prevent overflows/underflows, etc. |
IMO we should use Rust-native functionality wherever possible. We should optimize for as minimal of a cognitive leap as required to go from Rust to writing HyperSDK Programs. The nice byproduct of this is that it reduces the size of the codebase we need to maintain. |
Apparently in in solidity 0.8.0+ any integer overflows or underflows automatically cause the transaction to revert. Maybe panicking on case of an overflow is the best solution? |
My understanding is that in |
This issue has become stale because it has been open 60 days with no activity. Adding the |
Arithmetic operations in smart contracts require usage of a "safe math" library to prevent overflows and underflows.
There are well supported safe math libraries in Ethereum.
It should be clear that an overflow is an error that is handled gracefully. Both the NFT and token program are currently vulnerable to overflows.
The text was updated successfully, but these errors were encountered: