Platform: Code4rena
Start Date: 12/04/2023
Pot Size: $60,500 USDC
Total HM: 21
Participants: 199
Period: 7 days
Judge: hansfriese
Total Solo HM: 5
Id: 231
League: ETH
Rank: 178/199
Findings: 1
Award: $21.03
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: c3phas
Also found by: 0xDACA, 0xRB, 0xSmartContract, 0xhacksmithh, 0xnev, Aymen0909, BenRai, Breeje, DishWasher, Erko, EvanW, JCN, MohammedRizwan, NoamYakov, Polaris_tow, Proxy, Rageur, Raihan, RaymondFam, ReyAdmirado, SAAJ, Sathish9098, Satyam_Sharma, Udsen, __141345__, aria, codeslide, decade, fatherOfBlocks, hunter_w3b, karanctf, matrix_0wl, nadin, naman1778, niser93, pavankv, petrichor, pfapostol, sebghatullah, slvDev, trysam2003, xmxanuel
21.0255 USDC - $21.03
The && operator is a logical AND operator that checks if both of its operands evaluate to true. Using the && operator can be more expensive regarding gas costs than using separate expressions because it requires additional computational overhead to evaluate the operands and check the result.
84: if (_applicationPeriod < MIN_APPLICATION_PERIOD && totalSupply() > 0) revert PeriodTooShort(); 85: if (_applicationFee < MIN_FEE && totalSupply() > 0) revert FeeTooLow();
https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/Frankencoin.sol
This is because X>0 requires the EVM to perform an additional operation with 0, which can consume slightly more gas than the X!=0 operator, which simply checks whether the value is non-zero.
104: if (explicit > 0)
https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/Frankencoin.sol
203 if (challenge.bid > 0) {
https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/MintingHub.sol
This is because the <= operator requires the EVM to perform an additional comparison operation to check if the value is equal, while the > operator only needs to check if the value is greater. This additional comparison operation can consume more gas and result in slightly higher gas costs.
141: if (balance <= minReserve) 282:if (reserveLeft >= _amount)
https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/Frankencoin.sol
171: require(challenge.size >= min); 172: require(copy.size >= min); 201: if (block.timestamp >= challenge.end) revert TooLate(); 218: if (earliestEnd >= challenge.end) {
https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/MintingHub.sol
184: if (time >= exp) 305: if (block.timestamp >= expiration){ 374: if (block.timestamp <= cooldown) revert Hot();
https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/Position.sol
50: require(block.timestamp <= horizon, "expired");
https://github.com/code-423n4/2023-04-frankencoin/blob/main/contracts/StablecoinBridge.sol
#0 - c4-judge
2023-05-16T13:34:40Z
hansfriese marked the issue as grade-b