The linked mathematical operations are guaranteed to be performed safely by surrounding conditionals evaluated in either require checks or if-else constructs.
Given that safe arithmetics are toggled on by default in pragma versions of 0.8.X, we advise the linked statements to be wrapped in unchecked code blocks thereby optimizing their execution cost.
RDR-01C: Ineffectual Usage of Safe Arithmetics
Description:
The linked mathematical operations are guaranteed to be performed safely by surrounding conditionals evaluated in either
require
checks orif-else
constructs.Example:
Recommendation:
Given that safe arithmetics are toggled on by default in
pragma
versions of0.8.X
, we advise the linked statements to be wrapped inunchecked
code blocks thereby optimizing their execution cost.