PartyDAO contest - CRYP70's results

A protocol for buying, using, and selling NFTs as a group.

General Information

Platform: Code4rena

Start Date: 12/09/2022

Pot Size: $75,000 USDC

Total HM: 19

Participants: 110

Period: 7 days

Judge: HardlyDifficult

Total Solo HM: 9

Id: 160

League: ETH

PartyDAO

Findings Distribution

Researcher Performance

Rank: 34/110

Findings: 2

Award: $121.98

🌟 Selected for report: 0

🚀 Solo Findings: 0

QA / Low

L915:PartyGovernance.sol - Consider emitting an event when after tokens are safely reclaimed by the user. This allows for off chain monitoring in addition to allowing end users to observe and trust that these changes have occurred correctly. Source: https://github.com/PartyDAO/party-contracts-c4/blob/main/contracts/party/PartyGovernance.sol#L913

#0 - 0xble

2022-09-26T03:13:18Z

Not sure what this means

++i Saves More Gas Than i++

++i generally costs less gas than i++ or i = i + 1 (about 5 units per increment) because i++ must increment a value and then "return" the old value which means the program may need to hold two numbers in memory. When ++i is used, it will only ever use one number in memory.

See the example below for an simplified illustration:

pragma solidity ^0.8.13; contract MyFavouriteCounter { uint public count; function incrementPrefixCount() public returns (uint) { count = 1; return (++count); // returns 2 } function incrementPostfixCount() public returns (uint) { count = 1; return (count++); // returns 1 } }

I managed to identify this in the following locations: https://github.com/PartyDAO/party-contracts-c4/blob/main/contracts/crowdfund/CollectionBuyCrowdfund.sol#L62

Use external instead of public for functions only called outside the contract

I recommend changing the functions outlined below to be externally facing contracts as they are not used within the contract itself. This might help in saving gas as calling a public function costs 496 gas while an external function only uses 261 gas. The reason for this is that public functions need to write all of its arguments to memory so they may be called internally, which is actually an entirely different process than external calls. For external functions, the compiler does not allow internal calls so it allows arguments to be read from calldata, thus skipping an entire copy step.

Recommendation: Simply changing the functions outlined from public facing to external

This was identified in the following locations: https://github.com/PartyDAO/party-contracts-c4/blob/main/contracts/crowdfund/CrowdfundFactory.sol#L39 https://github.com/PartyDAO/party-contracts-c4/blob/main/contracts/crowdfund/CrowdfundFactory.sol#L65 https://github.com/PartyDAO/party-contracts-c4/blob/main/contracts/crowdfund/CrowdfundFactory.sol#L91

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