Closed code423n4 closed 2 years ago
The truncation here is desired, so that the rewardCycleEnd goes down to the nearest integer multiple of the rewardsCycleLength.
Could be a duplicate of #51 , though the warden does not explain how this could lead to an exploit.
closing as invalid, lacks impact
Lines of code
https://github.com/corddry/ERC4626/blob/643cd044fac34bcbf64e1c3790a5126fec0dbec1/src/xERC4626.sol#L40 https://github.com/corddry/ERC4626/blob/643cd044fac34bcbf64e1c3790a5126fec0dbec1/src/xERC4626.sol#L89
Vulnerability details
Impact
Solidity could truncate the results, performing multiplication before division will prevent rounding/truncation in solidity math.
Proof of Concept
https://github.com/corddry/ERC4626/blob/643cd044fac34bcbf64e1c3790a5126fec0dbec1/src/xERC4626.sol#L40
https://github.com/corddry/ERC4626/blob/643cd044fac34bcbf64e1c3790a5126fec0dbec1/src/xERC4626.sol#L89
Tools Used
Slither + Manual Analysis
Recommended Mitigation Steps
Consider ordering multiplication first.