Nouns Builder contest - martin's results

A permissionless, governed protocol to deploy nouns-style DAOs complete with treasury, generative collections, and governance mechanisms.

General Information

Platform: Code4rena

Start Date: 06/09/2022

Pot Size: $90,000 USDC

Total HM: 33

Participants: 168

Period: 9 days

Judge: GalloDaSballo

Total Solo HM: 10

Id: 157

League: ETH

Nouns Builder

Findings Distribution

Researcher Performance

Rank: 85/168

Findings: 2

Award: $106.39

🌟 Selected for report: 0

šŸš€ Solo Findings: 0

Nouns Builder

QA Report

L-01 emit function called early

​ There are 3 instances of this issue: ​

File: token/metadata/MetadataRenderer.sol
​
348: emit ContractImageUpdated(settings.contractImage, _newContractImage);

356: emit RendererBaseUpdated(settings.rendererBase, _newRendererBase);

364: emit DescriptionUpdated(settings.description, _newDescription);

​ https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/token/metadata/MetadataRenderer.sol

N-01 Event is missing indexed fields

​ There are 32 instances of this issue: ​

File: auction/IAuction.sol
​
22: event AuctionBid(uint256 tokenId, address bidder, uint256 amount, bool extended, uint256 endTime);

28: event AuctionSettled(uint256 tokenId, address winner, uint256 amount);

34: event AuctionCreated(uint256 tokenId, uint256 startTime, uint256 endTime);

38: event DurationUpdated(uint256 duration);

42: event ReservePriceUpdated(uint256 reservePrice);

46: event MinBidIncrementPercentageUpdated(uint256 minBidIncrementPercentage);

50: event TimeBufferUpdated(uint256 timeBuffer);

​ https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/auction/IAuction.sol

File: governance/governor/IGovernor.sol

18: event ProposalCreated(​

29: event ProposalQueued(bytes32 proposalId, uint256 eta);

33: event ProposalExecuted(bytes32 proposalId);

36: event ProposalCanceled(bytes32 proposalId);

39: event ProposalVetoed(bytes32 proposalId);

42: event VoteCast(address voter, bytes32 proposalId, uint256 support, uint256 weight, string reason);

45: event VotingDelayUpdated(uint256 prevVotingDelay, uint256 newVotingDelay);

48: event VotingPeriodUpdated(uint256 prevVotingPeriod, uint256 newVotingPeriod);

51: event ProposalThresholdBpsUpdated(uint256 prevBps, uint256 newBps);

54: event QuorumVotesBpsUpdated(uint256 prevBps, uint256 newBps);

57: event VetoerUpdated(address prevVetoer, address newVetoer);

​ https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/governance/governor/IGovernor.sol

File: governance/treasury/ITreasury.sol
​
16: event TransactionScheduled(bytes32 proposalId, uint256 timestamp);

19: event TransactionCanceled(bytes32 proposalId);

22: event TransactionExecuted(bytes32 proposalId, address[] targets, uint256[] values, bytes[] payloads);

25: event DelayUpdated(uint256 prevDelay, uint256 newDelay);

28: event GracePeriodUpdated(uint256 prevGracePeriod, uint256 newGracePeriod);

​ https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/governance/treasury/ITreasury.sol

File: manager/IManager.sol
​
21: event DAODeployed(address token, address metadata, address auction, address treasury, address governor);

26: event UpgradeRegistered(address baseImpl, address upgradeImpl);

31: event UpgradeRemoved(address baseImpl, address upgradeImpl);

​ https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/manager/IManager.sol

File: token/metadata/interfaces/IPropertyIPFSMetadataRenderer.sol
​
16: event PropertyAdded(uint256 id, string name);

19: event ItemAdded(uint256 propertyId, uint256 index);

22: event ContractImageUpdated(string prevImage, string newImage);

25: event RendererBaseUpdated(string prevRendererBase, string newRendererBase);

28: event DescriptionUpdated(string prevDescription, string newDescription);

​ https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/token/metadata/interfaces/IPropertyIPFSMetadataRenderer.sol

File: token/IToken.sol
​
21: event MintScheduled(uint256 baseTokenId, uint256 founderId, Founder founder);

​ https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/token/IToken.sol

N-02 Use a more recent version of solidity

There are 20 instances of this issue:

File: lib/interfaces/IEIP712.sol

File: lib/interfaces/IERC1967Upgrade.sol

File: lib/interfaces/IERC721.sol

File: lib/interfaces/IERC721Votes.sol

File: lib/interfaces/IInitializable.sol

File: lib/interfaces/IOwnable.sol

File: lib/interfaces/IPausable.sol

File: lib/proxy/ERC1967Proxy.sol

File: lib/proxy/ERC1967Upgrade.sol

File: lib/proxy/UUPS.sol

File: lib/token/ERC721.sol

File: lib/token/ERC721Votes.sol

File: lib/utils/Address.sol

File: lib/utils/EIP712.sol

File: lib/utils/Initializable.sol

File: lib/utils/Ownable.sol

File: lib/utils/Pausable.sol

File: lib/utils/ReentrancyGuard.sol

File: lib/utils/SafeCast.sol

File: lib/utils/TokenReceiver.sol

#0 - GalloDaSballo

2022-09-27T00:28:18Z

Version -> NC

Rest I disagree / Should be more developed for a report

Nouns Builder

Gas Optimizations Report

​

Replace x <= y with x < y + 1, and x >= y with x > y - 1

In the EVM, there is no opcode for >= or <=. When using greater than or equal, two operations are performed: > and =. Using strict comparison operators hence saves gas ​ There are 2 instances of this issue: ​

File: auction/Auction.sol
​
98: if (block.timestamp >= _auction.endTime) revert AUCTION_OVER();

​ https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/auction/Auction.sol

File: governance/treasury/Treasury.sol
​
89: return timestamps[_proposalId] != 0 && block.timestamp >= timestamps[_proposalId];

​ https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/governance/treasury/Treasury.sol

<x> += <y> costs more gas than <x> = <x> + <y> for state variables

There are 6 instances of this issue:

File: governance/governor/Governor.sol

280: proposal.againstVotes += uint32(weight);

285: proposal.forVotes += uint32(weight);

290: proposal.abstainVotes += uint32(weight);

https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/governance/governor/Governor.sol

File: token/metadata/MetadataRenderer.sol

140: _propertyId += numStoredProperties;

https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/token/metadata/MetadataRenderer.sol

File: token/Token.sol

88: if ((totalOwnership += uint8(founderPct)) > 100) revert INVALID_FOUNDER_OWNERSHIP();

118: (baseTokenId += schedule) % 100;

https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/token/Token.sol

Use calldata instead of memory for function parameters

If a reference type function parameter is read-only, it is cheaper in gas to use calldata instead of memory. Calldata is a non-modifiable, non-persistent area where function arguments are stored, and behaves mostly like memory. Try to use calldata as a data location because it will avoid copies and also makes sure that the data cannot be modified.

There are 9 instances of this issue:

File: governance/governor/Governor.sol

99: address[] memory _targets,

100: uint256[] memory _values,

101: bytes[] memory _calldatas,

117: address[] memory _targets,

118: uint256[] memory _values,

119: bytes[] memory _calldatas,

120: string memory _description

195: string memory _reason

252: string memory _reason

https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/governance/governor/Governor.sol

It costs more gas to initialize non-constant/non-immutable variables to zero than to let the default of zero be applied

Not overwriting the default for stack variables saves 8 gas. Storage and memory variables have larger savings

There are 5 instances of this issue:

File: governance/treasury/Treasury.sol

162: for (uint256 i = 0; i < numTargets; ++i) {

https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/governance/treasury/Treasury.sol

File: token/metadata/MetadataRenderer.sol

119: for (uint256 i = 0; i < numNewProperties; ++i) {

133: for (uint256 i = 0; i < numNewItems; ++i) {

189: for (uint256 i = 0; i < numProperties; ++i) {

229: for (uint256 i = 0; i < numProperties; ++i) {

https://github.com/code-423n4/2022-09-nouns-builder/blob/main/src/token/metadata/MetadataRenderer.sol

#0 - GalloDaSballo

2022-09-26T20:06:50Z

Calldata -> Memory 500

Rest is negligible

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