-
Notifications
You must be signed in to change notification settings - Fork 7
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
feat: support whitelisted proposers #116
base: develop
Are you sure you want to change the base?
Conversation
87a1dda
to
753a5a5
Compare
9754981
to
d674786
Compare
This reverts commit 5fc0e65.
|
||
uint latestProposalId = latestProposalIds[msg.sender]; | ||
if ( | ||
whitelistedProposers[msg.sender] != address(0) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to check this condition again, as we are already ensuring it in previous condition?
_; | ||
} | ||
|
||
modifier onlyGuardianOrAdmin() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we remove it as we are using ACM for authorisation?
* @param proposer The address of the proposer to whitelist | ||
*/ | ||
function whitelistProposer(address proposer, ProposalType proposalType) external { | ||
_checkAccessAllowed("whitelistProposer(address,ProposalType)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_checkAccessAllowed("whitelistProposer(address,ProposalType)"); | |
_checkAccessAllowed("whitelistProposer(address,ProposalType)"); | |
ensureNonzeroAddress(proposer) |
@@ -280,35 +364,61 @@ contract GovernorBravoDelegate is GovernorBravoDelegateStorageV2, GovernorBravoE | |||
emit ProposalQueued(proposalId, eta); | |||
} | |||
|
|||
/** | |||
* @notice Whitelists a proposer | |||
* @param proposer The address of the proposer to whitelist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
natspec is missing for event and access
require(c >= a, "addition overflow"); | ||
return c; | ||
} | ||
|
||
function sub256(uint256 a, uint256 b) internal pure returns (uint) { | ||
function sub256(uint256 a, uint256 b) internal pure returns (uint256) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don;t these functionalities to check overflows in 0.8.25 version of solidity.
d674786
to
d8b8274
Compare
@@ -70,30 +73,30 @@ import "./GovernorBravoInterfaces.sol"; | |||
* The delegation of votes happens through the `XVSVault` contract by calling the `delegate` or `delegateBySig` functions. These same functions can revert | |||
* vote delegation by calling the same function with a value of `0`. | |||
*/ | |||
contract GovernorBravoDelegate is GovernorBravoDelegateStorageV2, GovernorBravoEvents { | |||
contract GovernorBravoDelegate is GovernorBravoDelegateStorageV2, GovernorBravoEvents, AccessControlledV8 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest inheriting from GovernorBravoDelegateStorageV2 and creating an additional storage contract. This will allow us to add new storage elements as needed, particularly for syncing votes. Additionally, we should consider moving the custom errors into GovernorBravoEvents or creating a separate file for them to help clean up the code.
@@ -102,67 +105,145 @@ contract GovernorBravoDelegate is GovernorBravoDelegateStorageV2, GovernorBravoE | |||
/// @notice The EIP-712 typehash for the ballot struct used by the contract | |||
bytes32 public constant BALLOT_TYPEHASH = keccak256("Ballot(uint256 proposalId,uint8 support)"); | |||
|
|||
/// @notice Mapping to store whitelisted proposers and the timelock they are authorized to use | |||
mapping(address => address) public whitelistedProposers; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is one proposer is authorized for multiple timelocks? Correct me if I am wrong.
mapping(address => address) public whitelistedProposers; | |
mapping(address => address[]) public whitelistedProposers; |
Description
This PR is to support whitelisted proposers that can be set and removed with a timelock. The idea is to allow programmatically creating proposals.