Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix H-01: Allow whitelisted accounts below threshold to propose #89

Merged
merged 8 commits into from
Dec 16, 2024

Conversation

garyghayrat
Copy link
Member

@garyghayrat garyghayrat commented Dec 13, 2024

closes #77

Copy link
Collaborator

@jferas jferas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small change request.

contracts/CompoundGovernor.sol Outdated Show resolved Hide resolved
@garyghayrat garyghayrat requested a review from jferas December 16, 2024 16:10
@@ -135,32 +135,74 @@ contract CompoundGovernor is
return GovernorSequentialProposalIdUpgradeable.hashProposal(_targets, _values, _calldatas, _descriptionHash);
}

/// @notice Creates a new proposal.
/// @dev This is an override of the function that skips proposal threshold check for whitelisted accounts.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sounds like it's referring to some other function (in GovernorUpgradeable) that skips the proposal threshold check. but in fact, THIS is the function doing that.

i think i'd recommend expanding the @notice to include details on how the whitelisting works as well, otherwise that'll be undocumented afaik

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in: f6bb8a8 and added to the whitelisting related docs above setWhitelistAccountExpiration.

@@ -74,6 +74,15 @@ contract Propose is CompoundGovernorTest {
vm.assertEq(uint8(governor.state(_proposalId)), uint8(IGovernor.ProposalState.Active));
}

function test_AWhitelistedAccountCanProposeWhileBelowThreshold(address _proposer) public {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function test_AWhitelistedAccountCanProposeWhileBelowThreshold(address _proposer) public {
function test_WhitelistedAccountCanProposeBelowThreshold(address _proposer) public {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -93,6 +102,21 @@ contract Propose is CompoundGovernorTest {
);
_submitProposal(_proposer, _proposal);
}

function test_RevertIf_ProposerIsBelowThreshold(address _proposer) public {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
function test_RevertIf_ProposerIsBelowThreshold(address _proposer) public {
function test_RevertIf_NonWhitelistedProposerIsBelowThreshold(address _proposer) public {

@@ -93,6 +102,21 @@ contract Propose is CompoundGovernorTest {
);
_submitProposal(_proposer, _proposal);
}

function test_RevertIf_ProposerIsBelowThreshold(address _proposer) public {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could also use a... test_RevertIf_ExpiredWhitelistedAccountIsBelowThreshold just to make sure we're covering the breadth of the feature

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added 7a94bff

Copy link
Collaborator

@jferas jferas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@wildmolasses wildmolasses merged commit f47c158 into main Dec 16, 2024
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

H-01 Whitelisted Users Cannot Propose with Less Than proposalThreshold Delegate Votes
3 participants