Nouns DAO contest - shr1ftyy's results

A DAO-driven NFT project on Ethereum.

General Information

Platform: Code4rena

Start Date: 22/08/2022

Pot Size: $50,000 USDC

Total HM: 4

Participants: 160

Period: 5 days

Judge: gzeon

Total Solo HM: 2

Id: 155

League: ETH

Nouns DAO

Findings Distribution

Researcher Performance

Rank: 155/160

Findings: 1

Award: $16.66

🌟 Selected for report: 0

🚀 Solo Findings: 0

NounsDAOLogicV2.sol - queue() - Array Length Caching

git diff:

@@ -289,7 +289,8 @@ contract NounsDAOLogicV2 is NounsDAOStorageV2, NounsDAOEventsV2 {
         );
         Proposal storage proposal = _proposals[proposalId];
         uint256 eta = block.timestamp + timelock.delay();
-        for (uint256 i = 0; i < proposal.targets.length; i++) {
+        uint256 len = proposal.targets.length;
+        for (uint256 i = 0; i < len; i++) {
             queueOrRevertInternal(
                 proposal.targets[i],
                 proposal.values[i],

Gas Usage

Before:After:Savings:
Avg.140617140507110

NounsDAOLogicV2.sol - execute() - Array Length Caching

git diff:

@@ -327,7 +328,8 @@ contract NounsDAOLogicV2 is NounsDAOStorageV2, NounsDAOEventsV2 {
         );
         Proposal storage proposal = _proposals[proposalId];
         proposal.executed = true;
-        for (uint256 i = 0; i < proposal.targets.length; i++) {
+        uint256 len = proposal.targets.length;
+        for (uint256 i = 0; i < len; i++) {
             timelock.executeTransaction(
                 proposal.targets[i],
                 proposal.values[i],

Gas Usage

Before:After:Savings:
Avg.11795910266498

NounsDAOLogicV2.sol - cancel() - Array Length Caching

git diff:

@@ -354,7 +356,8 @@ contract NounsDAOLogicV2 is NounsDAOStorageV2, NounsDAOEventsV2 {
         );
 
         proposal.canceled = true;
-        for (uint256 i = 0; i < proposal.targets.length; i++) {
+        uint256 len = proposal.targets.length;
+        for (uint256 i = 0; i < len; i++) {
             timelock.cancelTransaction(
                 proposal.targets[i],
                 proposal.values[i],

Gas Usage

Before:After:Savings:
Avg.102664102765101
Min.9515495205101
Max.110174110275101

NounsDAOLogicV2.sol - veto() - Array Length Caching

git diff:

@@ -379,7 +382,8 @@ contract NounsDAOLogicV2 is NounsDAOStorageV2, NounsDAOEventsV2 {
         Proposal storage proposal = _proposals[proposalId];
 
         proposal.vetoed = true;
-        for (uint256 i = 0; i < proposal.targets.length; i++) {
+        uint256 len = proposal.targets.length;
+        for (uint256 i = 0; i < len; i++) {
             timelock.cancelTransaction(
                 proposal.targets[i],
                 proposal.values[i],

Gas Usage

Before:After:Savings:
Avg.9853898429101
Min.7310872999109
Max.116668116559109

Total Average Gas Saved: 410


Before:After:Savings:
Avg.45546798429101
Min.45380972999109
Max.473709116559109
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