Juicebox V2 contest - UnusualTurtle's results

The decentralized fundraising and treasury protocol.

General Information

Platform: Code4rena

Start Date: 01/07/2022

Pot Size: $75,000 USDC

Total HM: 17

Participants: 105

Period: 7 days

Judge: Jack the Pug

Total Solo HM: 5

Id: 143

League: ETH

Juicebox

Findings Distribution

Researcher Performance

Rank: 80/105

Findings: 1

Award: $38.83

🌟 Selected for report: 0

πŸš€ Solo Findings: 0

1. ++I COSTS LESS GAS THAN ++I, ESPECIALLY WHEN IT’S USED IN FOR-LOOPS (--I/I-- TOO)

Examples of this issue in the codebase:

  1. File: contracts\JBController.sol (Line 913)

  2. File: contracts\JBController.sol (Line 1014)


2. AVOIDING INITIALIZATION OF LOOP INDEX CAN SAVE A LITTLE GAS

Examples of this issue in the codebase:

  1. File: contracts\JBSplitsStore.sol (Line 304)

  2. File: contracts\JBOperatorStore.sol (Line 135)


3. <ARRAY>.LENGTH SHOULD NOT BE LOOKED UP IN EVERY LOOP OF A FOR-LOOP

Even memory arrays incur the overhead of bit tests and bit shifts to calculate the array length

Examples of this issue in the codebase:

  1. File: contracts\JBController.sol (Line 1014)

4. USING BOOLS FOR STORAGE INCURS OVERHEAD

refer to this.

Examples of this issue in the codebase:

  1. File: contracts\JBTokenStore.sol (Line 101)

  2. File: contracts\JBDirectory.sol (Line 91)


5. MINIMIZE THE NUMBER OF EXPENSIVE SLOAD CALL

Examples of this issue in the codebase:

  1. File: contracts\JBDirectory.sol _terminalsOf[_projectId].length can be cached (Line 139)

  2. File: contracts\JBDirectory.sol _terminalsOf[_projectId].length can be cached (Line 167)


6. ++I/I++ SHOULD BE UNCHECKED{++I}/UNCHECKED{++I} WHEN IT IS NOT POSSIBLE FOR THEM TO OVERFLOW, AS IS THE CASE WHEN USED IN FOR- AND WHILE-LOOPS

Examples of this issue in the codebase:

  1. File: contracts\JBOperatorStore.sol (Line 135)

  2. File: contracts\JBSplitsStore.sol (Line 229)


7. USE CallData INSTEAD OF MEMORY

Examples of this issue in the codebase:

  1. File: contracts\JBController.sol _terminals can be changed to calldata (Line 418)

  2. File: contracts\NibblVault.sol _fundAccessConstraints can be changed to calldata (Line 470)

  3. File: contracts\JBController.sol _terminals can be changed to calldata (Line 471)


8. USING > 0 COSTS MORE GAS THAN != 0 WHEN USED ON A UINT

Examples of this issue in the codebase:

  1. File: contracts\JBTokenStore.sol (Line 356)

  2. File: contracts\JBTokenStore.sol (Line 367)


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