<!-- canonical: https://0xsimao.com/findings/1inch-rounding-whitelist-discount-avoided -->

# Significant rounding error in whitelist discount that could be avoided

Low/Info · Sherlock · DEX aggregator · 14th April, 2025

Finding L-3 of the 1inch Fee Extension security review.

- Protocol: https://1inch.com/
- Report: /reports/1inch
- Source: https://github.com/1inch/1inch-audits/blob/master/Fees%20for%20LO%20and%20Fusion%20V1/Fee%20flow%20v1-Sherlock.pdf

---

## Summary

Whitelisted users pay less resolver fee but the discount is applied too early leading to rounding errors.

## Vulnerability Detail

The resolver fee is discounted by doing the following:
```solidity
if (isWhitelisted) {
    resolverFee = resolverFee * whitelistDiscountNumerator / _BASE_1E2;
}
```
As can be seen, it is applied in the `resolverFee` itself, which just has `1e5` precision.

## Impact

## Code Snippet

https://github.com/sherlock-audit/2025-04-1inch/blob/main/limit-order-protocol/contracts/extensions/AmountGetterWithFee.sol#L88

## Tool Used

Manual Review

## Recommendation

In `_getMakingAmount()` it may not be possible to apply the fix directly because it is dividing by the `resolverFee`. Probably adding a precision multiplier would be better. For example, scaling it to 1e18 fixes the issue:
Suppose the fee is 9999, taking amount is 10_000 USD, share is `50%`.
Scaled fee = resolver fee * 1e18 / 1e5 / 2 = 9999 * 1e18 / 1e5 / 2 = 4.9995e16 (notice how the 0.5 is kept).
Fixed total resolver fee = takingAmount * resolverFee / 1e18 = 10_000e6 * 4.9995e16 / 1e18 = 499.95e6. The 0.05 USD component would be lost without scaling the fee. It may not be much but with enough volume it adds up.

---

Related findings:

- [Significant rounding errors due to `gameETH` not having precision](https://0xsimao.com/findings/codeup-rounding-game-eth-precision): CODEUP
- [`FluidLocker::_getUnlockingPercentage()` divides before multiplying, suffering a significant precision error](https://0xsimao.com/findings/superfluid-locker-system-unlocking-multiplying-suffering-precision): Superfluid Locker System
- [Rounding error in Aave Lending Pool](https://0xsimao.com/findings/gaib-rounding-error-aave-lending): GAIB Pre-Vaults
- [Unhandled rounding error in DistributionVault.getClaimable leads to locked dust](https://0xsimao.com/findings/m-0-rounding-claimable-locked-dust): M^0 Minter Gateway
