Blog

Addressing rounding in smart contract audits

When you audit smart contracts, there will always be some rounding issues/truncation.

It is just a question if it can get exploited.

Example: In the function below take the amount of 109 wei, a fee rate of 1e3 (10%)

Therefore, the fee should be 10% which is 10.9, due to truncation it is 10.

Now is this exploitable? Most probably not because most of the time you won’t profit from 1 wei less fee.

As you can see, the devil is in the details and ideally you check all divisions for potential problems.