Nouns DAO contest - mics'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: 21/160

Findings: 2

Award: $122.27

🌟 Selected for report: 0

🚀 Solo Findings: 0

Table Of Content

QA REPORT

Missing 0 address check at transfer

Some contracts does not support 0 transfer, then the transaction will revert with no explanation. We recommend to add a require statement that the amount is not 0.

Code Instances:

Unused success return value

The following calls ignores the return value of the called function that might indicate the the call failed.

Code Instances:

SPDX license not provided in source file

Before publishing, consider adding a comment containing 'SPDX-License-Identifier: MIT' at the beginning of each source file.

Code Instances:

Use safeTransfer() instead transfer()

Use openzeppelin safeTransfer() method instead of transfer() in the following locations.

Code Instances:

Use safe math for solidity version <8

You should use safe math for solidity version <8 since there is no default over/under flow check it those versions.'

For instance, Multicall2.sol

Use timelock modifier for setter functions

It is good to have a timelock for functions that set key/critical variables.

Code Instances:

Loss of precision by using division over possible multiplication

In cases of computing a / b < c you could improve precision by doing instead a < c * b.

For instance, NounsAuctionHouse.sol#L109

Missing zero address check for initializers functions

Missing checks for zero-addresses may lead to infunctional protocol. In this case the function is an initializer then the value can be passed only once and is important to be validated. If the variable addresses are updated incorrectly.

For instance, NounsAuctionHouse.sol#L69

Array access is out of bounds

There is no check for the access to be in the array bounds.

Code Instances:

Avoid floating pragma

Contracts should be deployed with the same compiler version and flags that they have been tested with thoroughly. Locking the pragma helps to ensure that contracts do not accidentally get deployed using, for example, an outdated compiler version that might introduce bugs that affect the contract system negatively. (SWC-103)

Code Instances:

Conditions that are based on block number

The following condition statements are based on block number that can be manipulated by a malicious miner.

Code Instances:

Missing zero address check in a state variable setter function

A state variable of type 'address' is set without a non-zero verification. This can lead to undesired behavior.

Code Instances:

Not indexed events

The emitted event is not indexed, making off-chain scripts such as front-ends of dApps difficult to filter the events efficiently.

Code Instances:

Consider adding constant variables instead of hardcoded strings

A good practice is to use constant variables instead of hardcoded strings in the code.

Code Instances:

Missing an event after critical initialize() functions

To record the initialize parameters for off-chain monitoring and transparency reasons, you might find it useful to emit an event after the initialize() functions

For instance, NounsAuctionHouse.sol#L69

Some of the following function specification is missing

Code Instances:

Events not emitted for important state changes

When changing state variables events are not emitted. Emitting events allows monitoring activities with off-chain monitoring tools.

Code Instances:

Several functions are declaring named returns but then are using return statements. I suggest choosing only one for readability reasons.

Using both named returns and a return statement isn't necessary. Removing one of those can improve code clarity.

Code Instances:

Magical number should be documented and explained. Use a constant instead

Code Instances:

Add event to the following functions

Code Instances:

Table Of Content

GAS REPORT

Use custom errors

In the following require statements you can use custom errors to save gas and improve code quality.

Code Instances:

Using abiEncodePacked() is more efficient that abiEncode()

Code Instances:

Use assembly opcodes iszero instead of solidity equation to save gas

Code Instances:

If the function is onlyOwner you may make it payable to reduce gas usage.

Code Instances:

Split require statement with & operator

instead of require(A & B, ...) consider having two require statements require(A, ...) and require(B, ...) for better code quality and improved gas usage.

Code Instances:

Replace transferFrom(this, ...) with transfer(...)

transferFrom(this, ...) and transfer(...) has the same meaning while transfer cost less gas.

For instance, NounsAuctionHouse.sol#L232

--

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