Foundation Drop contest - Funen's results

Foundation is a web3 destination.

General Information

Platform: Code4rena

Start Date: 11/08/2022

Pot Size: $40,000 USDC

Total HM: 8

Participants: 108

Period: 4 days

Judge: hickuphh3

Total Solo HM: 2

Id: 152

League: ETH

Foundation

Findings Distribution

Researcher Performance

Rank: 95/108

Findings: 1

Award: $20.60

🌟 Selected for report: 0

🚀 Solo Findings: 0

  1. Short reason string can be used for saving more gas

Every reason string takes at least 32 bytes. Use short reason strings that fits in 32 bytes or it will become more expensive.

File :

/main/contracts/NFTCollection.sol#L158 "NFTCollection: tokenCreatorPaymentAddress is required" /main/contracts/NFTCollection.sol#L268 "NFTCollection: Max token count has already been minted" /main/contracts/NFTCollection.sol#L327 "NFTCollection: URI query for nonexistent token" /main/contracts/NFTDropCollection.sol#L172 "NFTDropCollection: `count` must be greater than 0" /main/contracts/NFTDropCollection.sol#L179 "NFTDropCollection: Exceeds max tokenId" /main/contracts/NFTDropCollection.sol#L238 "NFTDropCollection: use `reveal` instead" /main/contracts/mixins/collections/SequentialMintCollection.sol#L63 "SequentialMintCollection: Creator cannot be the zero address"; /main/contracts/mixins/collections/SequentialMintCollection.sol#L75 "SequentialMintCollection: Any NFTs minted must be burned first" /main/contracts/mixins/collections/SequentialMintCollection.sol#L87 "SequentialMintCollection: Max token ID may not be cleared" /main/contracts/mixins/collections/SequentialMintCollection.sol#L88 "SequentialMintCollection: Max token ID must be >= last mint" /main/contracts/mixins/collections/SequentialMintCollection.sol#L89 "SequentialMintCollection: Max token ID may not increase"
  1. Custom Error

Custom errors can be used from Solidity 0.8.4 are cheaper than revert strings. Its cheaper deployment cost and runtime cost when the revert condition is met.

/main/contracts/NFTCollection.sol#L158 /main/contracts/NFTCollection.sol#L268 /main/contracts/NFTCollection.sol#L327 /main/contracts/NFTDropCollection.sol#L172 /main/contracts/NFTDropCollection.sol#L179 /main/contracts/NFTDropCollection.sol#L238 /main/contracts/mixins/collections/SequentialMintCollection.sol#L63 /main/contracts/mixins/collections/SequentialMintCollection.sol#L75 /main/contracts/mixins/collections/SequentialMintCollection.sol#L87 /main/contracts/mixins/collections/SequentialMintCollection.sol#L88 /main/contracts/mixins/collections/SequentialMintCollection.sol#L89
  1. change uint256 i = 0 into uint256 i for saving more gas

using this implementation can saving more gas for each loops.

Files :

https://github.com/code-423n4/2022-08-foundation/blob/main/contracts/mixins/shared/MarketFees.sol#L126

https://github.com/code-423n4/2022-08-foundation/blob/main/contracts/mixins/shared/MarketFees.sol#L198

https://github.com/code-423n4/2022-08-foundation/blob/main/contracts/mixins/shared/MarketFees.sol#L484

#0 - HardlyDifficult

2022-08-19T15:02:37Z

Use short error messages

Agree but won't fix. We use up to 64 bytes, aiming to respect the incremental cost but 32 bytes is a bit too short to provide descriptive error messages for our users.

Custom errors

Agree but won't fix at this time. We use these in the market but not in collections. Unfortunately custom errors are still not as good of an experience for users (e.g. on etherscan). We used them in the market originally because we were nearing the max contract size limit and this was a good way to reduce the bytecode. We'll consider this in the future as tooling continues to improve.

Don't initialize variables with default values.

Invalid. This optimization technique is no longer applicable with the current version of Solidity.

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