Nouns DAO contest - hyh'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: 47/160

Findings: 2

Award: $52.34

🌟 Selected for report: 0

🚀 Solo Findings: 0

1. MAX_QUORUM_VOTES_BPS_UPPER_BOUND limit description isn't fully accurate (low)

_setDynamicQuorumParams() description isn't fully correct.

Proof of Concept

https://github.com/code-423n4/2022-08-nounsdao/blob/452695d4764ba9d5e1d3eef0d5ecca3d004f215a/contracts/governance/NounsDAOLogicV2.sol#L744

     *     Must be lower than `MAX_QUORUM_VOTES_BPS_UPPER_BOUND`

https://github.com/code-423n4/2022-08-nounsdao/blob/452695d4764ba9d5e1d3eef0d5ecca3d004f215a/contracts/governance/NounsDAOLogicV2.sol#L762-L764

        if (newMaxQuorumVotesBPS > MAX_QUORUM_VOTES_BPS_UPPER_BOUND) {
            revert InvalidMaxQuorumVotesBPS();
        }

Same for _setMaxQuorumVotesBPS():

https://github.com/code-423n4/2022-08-nounsdao/blob/452695d4764ba9d5e1d3eef0d5ecca3d004f215a/contracts/governance/NounsDAOLogicV2.sol#L698

     *     Must be lower than `MAX_QUORUM_VOTES_BPS_UPPER_BOUND`

https://github.com/code-423n4/2022-08-nounsdao/blob/452695d4764ba9d5e1d3eef0d5ecca3d004f215a/contracts/governance/NounsDAOLogicV2.sol#L705-L708

        require(
            newMaxQuorumVotesBPS <= MAX_QUORUM_VOTES_BPS_UPPER_BOUND,
            'NounsDAO::_setMaxQuorumVotesBPS: invalid max quorum votes bps'
        );

Consider correcting it in the both cases:

https://github.com/code-423n4/2022-08-nounsdao/blob/452695d4764ba9d5e1d3eef0d5ecca3d004f215a/contracts/governance/NounsDAOLogicV2.sol#L744

-    *     Must be lower than `MAX_QUORUM_VOTES_BPS_UPPER_BOUND`
+    *     Must be lower than or equal to `MAX_QUORUM_VOTES_BPS_UPPER_BOUND`

2. proposalThresholdBPS required range description doesn't fully match the logic (low)

_setProposalThresholdBPS() description isn't fully correct.

Proof of Concept

The description states that it's newProposalThresholdBPS > MIN_PROPOSAL_THRESHOLD_BPS:

https://github.com/code-423n4/2022-08-nounsdao/blob/452695d4764ba9d5e1d3eef0d5ecca3d004f215a/contracts/governance/NounsDAOLogicV2.sol#L651

     * @dev newProposalThresholdBPS must be greater than the hardcoded min

It's in fact should be in the range with boundaries included:

https://github.com/code-423n4/2022-08-nounsdao/blob/452695d4764ba9d5e1d3eef0d5ecca3d004f215a/contracts/governance/NounsDAOLogicV2.sol#L656-L660

        require(
            newProposalThresholdBPS >= MIN_PROPOSAL_THRESHOLD_BPS &&
                newProposalThresholdBPS <= MAX_PROPOSAL_THRESHOLD_BPS,
            'NounsDAO::_setProposalThreshold: invalid proposal threshold bps'
        );

Update to match newProposalThresholdBPS >= MIN_PROPOSAL_THRESHOLD_BPS && newProposalThresholdBPS <= MAX_PROPOSAL_THRESHOLD_BPS logic.

3. MAX_QUORUM_VOTES_BPS_UPPER_BOUND comment doesn't match the logic (low)

Incorrect number of points is stated:

https://github.com/code-423n4/2022-08-nounsdao/blob/452695d4764ba9d5e1d3eef0d5ecca3d004f215a/contracts/governance/NounsDAOLogicV2.sol#L85-L86

    /// @notice The upper bound of maximum quorum votes basis points
    uint256 public constant MAX_QUORUM_VOTES_BPS_UPPER_BOUND = 6_000; // 4,000 basis points or 60%

https://github.com/code-423n4/2022-08-nounsdao/blob/452695d4764ba9d5e1d3eef0d5ecca3d004f215a/contracts/governance/NounsDAOLogicV2.sol#L85-L86

    /// @notice The upper bound of maximum quorum votes basis points
-   uint256 public constant MAX_QUORUM_VOTES_BPS_UPPER_BOUND = 6_000; // 4,000 basis points or 60%
+   uint256 public constant MAX_QUORUM_VOTES_BPS_UPPER_BOUND = 6_000; // 6,000 basis points or 60%

Excessive storage reads in configuration variables setters

Proof of Concept

Config variable is read from storage extra time for events emission in 3 cases:

https://github.com/code-423n4/2022-08-nounsdao/blob/452695d4764ba9d5e1d3eef0d5ecca3d004f215a/contracts/governance/NounsDAOLogicV2.sol#L627-L630

        uint256 oldVotingDelay = votingDelay;
        votingDelay = newVotingDelay;

        emit VotingDelaySet(oldVotingDelay, votingDelay);

https://github.com/code-423n4/2022-08-nounsdao/blob/452695d4764ba9d5e1d3eef0d5ecca3d004f215a/contracts/governance/NounsDAOLogicV2.sol#L643-L646

        uint256 oldVotingPeriod = votingPeriod;
        votingPeriod = newVotingPeriod;

        emit VotingPeriodSet(oldVotingPeriod, votingPeriod);

https://github.com/code-423n4/2022-08-nounsdao/blob/452695d4764ba9d5e1d3eef0d5ecca3d004f215a/contracts/governance/NounsDAOLogicV2.sol#L661-L664

        uint256 oldProposalThresholdBPS = proposalThresholdBPS;
        proposalThresholdBPS = newProposalThresholdBPS;

        emit ProposalThresholdBPSSet(oldProposalThresholdBPS, proposalThresholdBPS);

Consider using memory variable with the same value each time:

https://github.com/code-423n4/2022-08-nounsdao/blob/452695d4764ba9d5e1d3eef0d5ecca3d004f215a/contracts/governance/NounsDAOLogicV2.sol#L627-L630

        uint256 oldVotingDelay = votingDelay;
        votingDelay = newVotingDelay;

-       emit VotingDelaySet(oldVotingDelay, votingDelay);
+       emit VotingDelaySet(oldVotingDelay, newVotingDelay);

https://github.com/code-423n4/2022-08-nounsdao/blob/452695d4764ba9d5e1d3eef0d5ecca3d004f215a/contracts/governance/NounsDAOLogicV2.sol#L643-L646

        uint256 oldVotingPeriod = votingPeriod;
        votingPeriod = newVotingPeriod;

-       emit VotingPeriodSet(oldVotingPeriod, votingPeriod);
+       emit VotingPeriodSet(oldVotingPeriod, newVotingPeriod);

https://github.com/code-423n4/2022-08-nounsdao/blob/452695d4764ba9d5e1d3eef0d5ecca3d004f215a/contracts/governance/NounsDAOLogicV2.sol#L661-L664

        uint256 oldProposalThresholdBPS = proposalThresholdBPS;
        proposalThresholdBPS = newProposalThresholdBPS;

-       emit ProposalThresholdBPSSet(oldProposalThresholdBPS, proposalThresholdBPS);
+       emit ProposalThresholdBPSSet(oldProposalThresholdBPS, newProposalThresholdBPS);
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