Platform: Code4rena
Start Date: 11/11/2022
Pot Size: $90,500 USDC
Total HM: 52
Participants: 92
Period: 7 days
Judge: LSDan
Total Solo HM: 20
Id: 182
League: ETH
Rank: 76/92
Findings: 1
Award: $52.03
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: 0xSmartContract
Also found by: 0x4non, 0xNazgul, 0xRoxas, 0xdeadbeef0x, 0xmuxyz, 9svR6w, Awesome, Aymen0909, B2, Bnke0x0, CloudX, Deivitto, Diana, Franfran, IllIllI, Josiah, RaymondFam, ReyAdmirado, Rolezn, Sathish9098, Secureverse, SmartSek, Trust, Udsen, a12jmx, aphak5010, brgltd, bulej93, c3phas, ch0bu, chaduke, chrisdior4, clems4ever, cryptostellar5, datapunk, delfin454000, fs0c, gogo, gz627, hl_, immeas, joestakey, lukris02, martin, nogo, oyc_109, pashov, pavankv, peanuts, pedr02b2, rbserver, rotcivegaf, sahar, sakman, shark, tnevler, trustindistrust, zaskoh, zgo
52.0338 USDC - $52.03
custom error
statement instead of using revert("<Error message written by string type>")
statementrevert("<Error message written by string type>")
statement is still used and it has not been optimized yet:
Custom error
statement that consists of both error()
statement and revert()
statement has been able to use since solidity version 0.8.4
custom error
statement have been introduced as a more gas-efficient
way than using revert("<Error message written by string type>")
statement.
https://blog.soliditylang.org/2021/04/21/custom-errors/revert("<Error message written by string type>")
statement with using custom error
statement that consists of both error()
statement and revert()
statement to save gas.
(Reference:https://blog.soliditylang.org/2021/04/21/custom-errors/ )For example,
custom error
statement like below:contract LiquidStakingManager is ILiquidStakingManager, Initializable, ReentrancyGuard, StakehouseAPI { //@dev - Define a custom error error UnexpectedState(); 〜〜Omission〜〜 function _authorizeRepresentative( address _smartWallet, address _eoaRepresentative, bool _isEnabled ) internal { if(!_isEnabled && smartWalletRepresentative[_smartWallet] != address(0)) { 〜〜Omission〜〜 emit RepresentativeAppointed(_smartWallet, _eoaRepresentative); } else { //@dev - Apply custom error revert UnexpectedState(); } }
#0 - c4-judge
2022-12-01T23:52:36Z
dmvt marked the issue as grade-b