Platform: Code4rena
Start Date: 31/03/2022
Pot Size: $75,000 USDC
Total HM: 7
Participants: 42
Period: 7 days
Judge: Jack the Pug
Total Solo HM: 5
Id: 102
League: ETH
Rank: 20/42
Findings: 2
Award: $210.24
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: rayn
Also found by: 0xDjango, 0xkatana, 0xkowloon, BouSalman, CertoraInc, Dravee, Funen, Hawkeye, IllIllI, Jujic, Kenshin, Kthere, Meta0xNull, Sleepy, TerrierLover, async, aysha, berndartmueller, catchup, cccz, cmichel, csanuragjain, danb, defsec, georgypetrov, hake, hubble, kenta, kyliek, pauliax, rfa, robee, sahar, shenwilly, teryanarmen
125.7841 USDC - $125.78
https://github.com/code-423n4/2022-03-volt/blob/main/contracts/oracle/ScalingPriceOracle.sol#L78-L82
uint256 chainId; // solhint-disable-next-line no-inline-assembly assembly { chainId := chainid() }
There is no need to use assembly to get chainId. See reference.
uint256 chainId = block.chainid;
#0 - ElliotFriedman
2022-04-04T17:31:38Z
Nice one!
🌟 Selected for report: IllIllI
Also found by: 0v3rf10w, 0xNazgul, 0xkatana, 0xkowloon, CertoraInc, Dravee, Funen, Hawkeye, Jujic, Kenshin, Meta0xNull, Sleepy, TerrierLover, catchup, csanuragjain, defsec, georgypetrov, kenta, okkothejawa, rayn, rfa, robee, saian, samruna
84.4552 USDC - $84.46
https://github.com/code-423n4/2022-03-volt/blob/main/contracts/core/Permissions.sol#L28-L42
modifier onlyGovernor() { require( isGovernor(msg.sender), "Permissions: Caller is not a governor" ); _; } modifier onlyGuardian() { require( isGuardian(msg.sender), "Permissions: Caller is not a guardian" ); _; }
onlyGovernor and onlyGuardian modifiers are used many places. Hence, using Custom Error can reduce the deployment gas cost.
Using custom error can reduce the deployment gas cost.
error NotGovernor(); error NotGuardian(); ... modifier onlyGovernor() { if(!isGovernor(msg.sender)) { revert NotGovernor(); } _; } modifier onlyGuardian() { if(!isGuardian(msg.sender)) { revert NotGuardian(); } _; }
Contract | Before | After | Change |
---|---|---|---|
Core | 3200606 | 3169956 | -30650 |
#0 - ElliotFriedman
2022-04-05T22:09:31Z
Agree that we could reduce error code lengths to save gas on the sad path and bytecode size.