Platform: Code4rena
Start Date: 04/01/2022
Pot Size: $75,000 USDC
Total HM: 17
Participants: 33
Period: 7 days
Judge: 0xean
Total Solo HM: 14
Id: 74
League: ETH
Rank: 15/33
Findings: 2
Award: $679.35
🌟 Selected for report: 2
🚀 Solo Findings: 0
🌟 Selected for report: robee
robee
Users can mistakenly think that the return value is the named return, but it is actually the actualreturn statement that comes after. To know that the user needs to read the code and is confusing. Furthermore, removing either the actual return or the named return will save gas.
TimeswapPair.sol, constantProduct TimeswapPair.sol, constantProduct TimeswapPair.sol, constantProduct
#0 - amateur-dev
2022-01-15T12:37:20Z
Similar issue reported over here #84; hence closing this issue
#1 - 0xean
2022-01-25T23:49:41Z
Not a duplicate of the referenced issue. Removing dupe label.
🌟 Selected for report: robee
93.0809 USDC - $93.08
robee
The function dueOf in CollateralizedDebt.sol could be set external
#0 - Mathepreneur
2022-01-18T09:47:09Z
robee
Prefix increments are cheaper than postfix increments.
Further more, using unchecked {++x} is even more gas efficient, and the gas saving accumulates every iteration and can make a real change
There is no risk of overflow caused by increamenting the iteration index in for loops (the ++i
in for (uint256 i = 0; i < numIterations; ++i)
).
But increments perform overflow checks that are not necessary in this case.
These functions use not using prefix increments (++x
) or not using the unchecked keyword:
change to prefix increment and unchecked: TimeswapPair.sol, i, 359
#0 - amateur-dev
2022-01-15T03:24:07Z
Similar issue reported over here #170; hence closing this
robee
Caching the array length is more gas efficient.
This is because access to a local variable in solidity is more efficient than query storage / calldata / memory
We recommend to change from:
for (uint256 i=0; i<array.length; i++) { ... }
to:
uint len = array.length
for (uint256 i=0; i<len; i++) { ... }
These functions use not using prefix increments (++x
) or not using the unchecked keyword:
TimeswapPair.sol, ids, 359
#0 - amateur-dev
2022-01-14T10:28:12Z
Similar issue reported over here #151