Consensys / smart-contract-best-practices

A guide to smart contract security best practices
https://consensys.github.io/smart-contract-best-practices/
7.5k stars 1.48k forks source link

Delete "Insecure Arithmetic" Page? #309

Open DavidBDiligence opened 1 year ago

DavidBDiligence commented 1 year ago

Now that "Solidity automatically reverts on integer overflow and underflow, as of version 0.8.0." shall we delete the Insecure Arithmetic page?

rupak21 commented 1 year ago

@DavidBDiligence hey i think that even though Solidity now automatically reverts on integer overflow and underflow as of version 0.8.0, the Insecure Arithmetic page should not be deleted.

This is because the page still contains valuable information about how integer overflow and underflow can cause unexpected results in earlier versions of Solidity, as well as in other programming languages that do not have automatic overflow and underflow protection. In addition, there may be legacy code that is still being maintained and relies on the old behavior, so it is important to have this information available for those cases.

It is worth noting that the Insecure Arithmetic page should be updated to reflect the changes in Solidity 0.8.0, and to provide guidance on how to write code that is compatible with the new automatic overflow and underflow protection. This could include best practices for handling arithmetic operations and avoiding integer overflow and underflow, as well as information on how to handle errors that result from these operations.