code-423n4 / 2021-04-meebits-findings

0 stars 0 forks source link

SafeMath library asserts instead of reverts #17

Open code423n4 opened 3 years ago

code423n4 commented 3 years ago

Handle

cmichel

Vulnerability details

Vulnerability Details

The implementation of SafeMath asserts instead of performing a revert on failure.

Impact

An assert will consume all gas of the transaction whereas a revert/require releases the remaining gas to the transaction sender again. Usually, one wants to try to keep the gas cost for contract failures low and use assert only for invariants that should always be true.

Recommended Mitigation Steps

Use require instead of assert