Submitted by t0x1c, also found by bin2chen
The BalancerFlashLender::flashFee() function returns a rounded-down fee. This fee is then later used across the protocol while providing spend approval to the flash loan provider. This can result in an approval less than that expected by the provider and hence cause the call to flash loan to revert. This is because flash loan providers calculate their fee by rounding up in their favour, instead of rounding down:
and
Flash loan call reverts for many amount and fee percentage combinations.
Round up in favour of the protocol. A library like solmate can be used which has mulDivUp:
hvasconcelos (BakerFi) confirmed
ickas (BakerFi) commented:
