Platform: Code4rena
Start Date: 08/05/2023
Pot Size: $90,500 USDC
Total HM: 17
Participants: 102
Period: 7 days
Judge: 0xean
Total Solo HM: 4
Id: 236
League: ETH
Rank: 52/102
Findings: 2
Award: $101.57
π Selected for report: 0
π Solo Findings: 0
π Selected for report: brgltd
Also found by: 0x73696d616f, 0xAce, 0xSmartContract, 0xWaitress, 0xkazim, 0xnev, Aymen0909, BGSecurity, Bauchibred, Cayo, ChrisTina, Franfran, IceBear, Infect3d, Kose, Lilyjjo, PNS, RaymondFam, Sathish9098, Team_Rocket, Udsen, YakuzaKiawe, YoungWolves, berlin-101, bin2chen, btk, codeslide, fatherOfBlocks, frazerch, kodyvim, koxuan, lfzkoala, lukris02, matrix_0wl, nadin, naman1778, sashik_eth, tnevler, volodya, wonjun, yjrwkk
56.6347 USDC - $56.63
ExponentialNoError.sol
L149 - Before doing the division, you should check that b is not 0 to handle the exception and not just that it occurs.
L12/16 - Two structs are created: Exp and Double, which only have one variable inside, this is strange since the idea of ββstucts is to group multiple variables in one concept.
BaseJumpRateModelV2.sol
ComptrollerInterface.sol
RiskFund/ProtocolShareReserve.sol
WhitePaperInterestRateModel.sol
VTokenInterfaces.sol
RiskFund/RiskFund.sol
Rewards/RewardsDistributor.sol
L420/422 - The _grantRewardToken() function has only two possible return values: 0 or amount. Therefore, it could be simplified by using bool.
Shortfall/Shortfall.sol
#0 - c4-judge
2023-05-18T18:21:40Z
0xean marked the issue as grade-b
π Selected for report: JCN
Also found by: 0xAce, 0xSmartContract, Aymen0909, K42, Rageur, Raihan, ReyAdmirado, SAAJ, SM3_SS, Sathish9098, Team_Rocket, Udsen, c3phas, codeslide, descharre, fatherOfBlocks, hunter_w3b, j4ld1na, lllu_23, matrix_0wl, naman1778, petrichor, pontifex, rapha, souilos, wahedtalash77
44.9387 USDC - $44.94
RiskFund/RiskFund.sol
L47 - The AmountOutMinUpdated event is created, but it is never used, therefore it generates unnecessary expense in the deploy.
L83 - When the MaxLoopsLimit contract is initialized it is zero, therefore, in the MaxLoopsLimitHelper contract, Line 26 validates this: require(input > maxLoopsLimit, "Comptroller: Invalid maxLoopsLimit"); therefore it is not necessary to validate two times the same operation.
L100/101/102/103/117/118/119/128/129/130/140/141/142 - Gas could be saved if instead of implementing it like this, it was done like this: example: require(_poolRegistry != address(0), "Risk Fund: Pool registry address invalid"); emit PoolRegistryUpdated(poolRegistry, _poolRegistry); poolRegistry = _poolRegistry;
Pool/PoolRegistry.sol
L425/426/427/434/435/436 - Gas could be saved if instead of implementing it like this, it was done like this:
emit NewShortfallContract(shortfall, address(shortfall_)); shortfall = shortfall_;
Lens/PoolLens.sol
Comptroller.sol
L707/708/709/785/788/791/915/916/917/964/965/966 - Gas could be saved if instead of implementing it like this, it was done like this: For example: emit NewPriceOracle(oracle, newOracle); oracle = newOracle;
L1059/1061 - It is not necessary to create a variable in memory if it does not help to understand the code better and it is only used once, therefore the least expensive would be to use the operation directly where it is needed.
L1214 - The calculation of the allMarkets length is performed for the second time, this is an unnecessary expense of gas, since the only line that is added after the operation in line 1206 is the push in L1214. Therefore you could directly execute _ensureMaxLoops(marketsCount + 1);
ErrorReporter.sol GO
MaxLoopsLimitHelper.sol GO
ExponentialNoError.sol
L22/23 - Two constants are created: halfExpScale and mantissaOne in storage, but they are never used, therefore it is an unnecessary expense in the deploy.
L39/40 - It is not necessary to create a variable in memory if it does not help to better understand the code and it is only used once, therefore the least expensive would be to use the operation directly where it is needed.
RiskFund/ProtocolShareReserve.sol
#0 - c4-judge
2023-05-18T17:25:25Z
0xean marked the issue as grade-b