Platform: Code4rena
Start Date: 13/05/2022
Pot Size: $30,000 USDC
Total HM: 8
Participants: 65
Period: 3 days
Judge: hickuphh3
Total Solo HM: 1
Id: 125
League: ETH
Rank: 30/65
Findings: 3
Award: $83.11
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: pedroais
Also found by: 0x4non, 0x52, 0xf15ers, 0xliumin, CertoraInc, Dravee, GimelSec, IllIllI, MaratCerby, StErMi, TerrierLover, WatchPug, berndartmueller, cccz, dipp, fatherOfBlocks, hake, hickuphh3, hyh, isamjay, mtz, oyc_109, p4st13r4, peritoflores, rotcivegaf, saian, simon135, sorrynotsorry, sseefried, tabish, z3s
14.8433 USDC - $14.84
In lines 140 and 141 a low-level transfer is performed and first it is reversed and then it is validated with the require if it was done correctly. This can generate many problems, since the transaction may not be carried out and a message may be returned as if it had been carried out correctly.
You must first perform the validation (line 140) and then perform the return (line 141)
#0 - sforman2000
2022-05-18T03:09:29Z
🌟 Selected for report: IllIllI
Also found by: 0x1f8b, 0x4non, 0xNazgul, 0xf15ers, 0xkatana, 0xliumin, AlleyCat, BouSalman, Dravee, Funen, GimelSec, Hawkeye, MaratCerby, Picodes, StErMi, TerrierLover, WatchPug, Waze, berndartmueller, bobirichman, cryptphi, csanuragjain, defsec, delfin454000, dipp, fatherOfBlocks, hake, hickuphh3, hyh, joestakey, kebabsec, mics, mtz, oyc_109, p4st13r4, p_crypt0, robee, rotcivegaf, sikorico, simon135, sorrynotsorry, tintin
44.8581 USDC - $44.86
GeneralVault.sol
In general, they only put the contracts and no interfaces or other components inside the repository, therefore we cannot validate how correct a call to an interface is, for example. How can we know if they are respecting the interface or not.
Another example of this is the function withdrawCollateral() which is called on line 119 and has the comment: In Lido vault, it will return ETH or stETH to user, but we don't know how it is implemented.
In the L51 it appears that the vault fee is 20%, it is not clear what that comment refers to. This generates confusion since in the setTreasuryInfo() function it allows setting up to 30% of the fee.
LidoVault.sol
By not having access to the dependencies we cannot know how some calls are specifically implemented, for example, on line 57 when TransferHelper.transferFrom() is called, it is not known if some type of reentrance could be generated, for example.
In most methods you start by setting the LIDO address variable = _addressesProvider.getAddress('LIDO'); Since both are used and the LIDO value is set in the constructor, the LIDO variable could be created in storage and in the constructor set it with this line: "LIDO = _addressesProvider.getAddress('LIDO');"
Inside the function _withdrawFromYieldPool() when swapExactTokensForTokens(L130) is called, the value of 200 is found as the last parameter reading the code that represents that 200 is very difficult to understand.
YieldManager.sol
ConvexCurveLPVault.sol
L40/27/62 - convexBooster address is hardcoded, that means it can only be run on one network, therefore
it only serves for testing on a certain testnet or only for mainnet.
It should be a constant and should be directly hardcoded into storage.
It would be better to simplify the use of interfaces, if in storage convexBooster instead of address directly it is of type IConvexBooster.
L137 - It is not necessary to request a parameter that can only be unique, therefore it is better not to request the _asset variable in the signature of _depositToYieldPool and remove the require.
L178 - It is not necessary to request a parameter that can only be unique, therefore it is better not to request the _asset variable in the signature of withdrawOnLiquidationy() removes the require.
L192 - It is not necessary to request a parameter that can only be unique, therefore it is better not to request the _asset variable in the signature of _withdrawFromYieldPool() removes the require.
#0 - HickupHH3
2022-06-06T07:26:46Z
working through the bullet pts:
Hence, 1 low and 2 NC have been raised
🌟 Selected for report: IllIllI
Also found by: 0v3rf10w, 0x1f8b, 0x4non, 0xNazgul, 0xf15ers, 0xkatana, 0xliumin, Cityscape, Dravee, Fitraldys, Funen, GimelSec, Hawkeye, JC, MaratCerby, SooYa, StErMi, Tomio, WatchPug, Waze, bobirichman, defsec, delfin454000, fatherOfBlocks, hake, hansfriese, hickuphh3, ignacio, joestakey, kebabsec, mics, mtz, oyc_109, robee, rotcivegaf, samruna, sikorico, simon135, z3s
23.4132 USDC - $23.41
GeneralVault.sol
L29/L34: You can save 20,000 gas if instead of using modifiers you use a private view function.
L218: In the for loop you could save 25,000 gas if instead of using uint256 i= 0, you didn't set it to its default value. Also, instead of terminating with i++ to raise the value of i, use unchecked with ++i on the last line of the loop.
YieldManager.sol
L51: the onlyOwner() could generate a saving of 20,000 gas, if it is created as a private view.
L120/130/156: In the for loop you could save 25,000 gas if instead of using uint256 i= 0, you didn't set it to its default value. Also, instead of terminating with i++ to raise the value of i, use unchecked with ++i on the last line of the loop.
CollateralAdapter.sol
ConvexCurveLPVault.sol
#0 - sforman2000
2022-05-18T01:20:33Z
Particularly high quality.
Edit: After further review, it looks like the numbers cited are incorrect
#1 - iris112
2022-05-18T16:26:29Z
L29/L34: You can save 20,000 gas if instead of using modifiers you use a private view function.
I'm not sure how it could save 20000 gas.
I have a test on remix with simple contract, when i change from modifier to private view function, deploying cost and function call cost is increased.
#2 - iris112
2022-05-18T17:03:01Z
Also, how did you estimated the reducing gas amount? You specified the reducing gas amount (ex: 20000, 25000 etc...)
#3 - HickupHH3
2022-06-07T06:37:24Z
I'm invalidating this report, numbers are over-inflated to possibly game the system.
#4 - HickupHH3
2022-06-07T06:38:52Z
Nvm the removal of zero initialisations and prefix increment suggestions are valid. However, I'll award a lower score for the inflated numbers.