Volt Protocol contest - TerrierLover's results

Inflation Protected Stablecoin.

General Information

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

Volt Protocol

Findings Distribution

Researcher Performance

Rank: 20/42

Findings: 2

Award: $210.24

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

125.7841 USDC - $125.78

Labels

bug
QA (Quality Assurance)

External Links

Can use block.chainid at constructor in ScalingPriceOracle.sol

Target codebase

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.

Potential improvement

uint256 chainId = block.chainid;

#0 - ElliotFriedman

2022-04-04T17:31:38Z

Nice one!

Awards

84.4552 USDC - $84.46

Labels

bug
G (Gas Optimization)

External Links

Can use Custom Errors at Permissions.sol to reduce both gas cost and contract size

Target codebase

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.

Potential improvement

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(); } _; }

Deployment gas improvement

ContractBeforeAfterChange
Core32006063169956-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.

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter