Nested Finance contest - sirhashalot's results

The one-stop Defi app to build, manage and monetize your portfolio.

General Information

Platform: Code4rena

Start Date: 10/02/2022

Pot Size: $30,000 USDC

Total HM: 5

Participants: 24

Period: 3 days

Judge: harleythedog

Total Solo HM: 3

Id: 86

League: ETH

Nested Finance

Findings Distribution

Researcher Performance

Rank: 24/24

Findings: 1

Award: $75.57

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

Awards

75.5694 USDC - $75.57

Labels

bug
G (Gas Optimization)
sponsor confirmed

External Links

Use cached variable value

Impact

The _submitOutOrders() function sets batchLength = _batchedOrders.orders.length, but in the for loop the value "_batchedOrders.orders.length" is used instead of "batchLength". Using the cached variable could save gas.

Proof of Concept

The for loop on line 369 could use the batchLength variable. This approach is used in the similar for loop on line 327.

Use the cached "batchLength" variable

#0 - harleythedogC4

2022-03-13T04:12:07Z

My personal judgments:

  1. "Use cached variable value". Other reports had their submissions marked as invalid as they recommend using a cached length variable, and this was already acknowledged in the first contest. However, this submission is different, since the length is already cached, and so it definitely makes sense to use the cached length. Valid and small-optimization.

#1 - harleythedogC4

2022-03-13T06:18:24Z

Now, here is the methodology I used for calculating a score for each gas report. I first assigned each submission to be either small-optimization (1 point), medium-optimization (5 points) or large-optimization (10 points), depending on how useful the optimization is. The score of a gas report is the sum of these points, divided by the maximum number of points achieved by a gas report. This maximum number was 10 points, achieved by #67.

The number of points achieved by this report is 1 points. Thus the final score of this gas report is (1/10)*100 = 10.

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