-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add whitelists and guardians roles #29
Conversation
Pull Request Test Coverage Report for Build 11447656675Details
💛 - Coveralls |
contracts/CompoundGovernor.sol
Outdated
/// @param _newWhitelistGuardian The address of the new whitelistGuardian. | ||
/// @dev Only the executor (timelock) can call this function. | ||
function setWhitelistGuardian(address _newWhitelistGuardian) public { | ||
if (msg.sender != _executor()) { |
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 I use the stricter _checkGovernance
instead which checks if a proposal has actually passed beyond checking the msg.sender
?
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.
@garyghayrat good call, that seems idiomatic. let me know if you want clarification on the implications.
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.
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.
Looks good.. 2 very small nits
event WhitelistGuardianSet(address oldGuardian, address newGuardian); | ||
|
||
/// @notice Emitted when the proposalGuardian is set | ||
/// @notice Emitted when the proposal guardian is set or updated. |
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.
Nit: duplicate line to above?
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.
removed in 42b14e9
|
||
/// @notice Account which has the ability to cancel proposals. This privilege expires at the given expiration | ||
/// timestamp. | ||
ProposalGuardian public proposalGuardian; |
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.
Nit: not that the compiler cares, but easier reading if a struct is defined before it is referenced.
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.
Moved it up in 42b14e9
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.
great start @garyghayrat -- i was imagining that the propose/cancel functionality would be changed here to work with the whitelist. were you thinking of adding it separately? I see you mention #28, but that issue looks like it's specifically for threshold-motivated cancellation
contracts/CompoundGovernor.sol
Outdated
/// @param _newWhitelistGuardian The address of the new whitelistGuardian. | ||
/// @dev Only the executor (timelock) can call this function. | ||
function setWhitelistGuardian(address _newWhitelistGuardian) public { | ||
if (msg.sender != _executor()) { |
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.
@garyghayrat good call, that seems idiomatic. let me know if you want clarification on the implications.
dad40b8
to
77964d3
Compare
contract CompoundGovernorSetWhitelistAccountExpirationTest is ProposalTest { | ||
function testFuzz_WhitelistAnAccountAsTimelock(address _account, uint256 _expiration) public { | ||
vm.prank(TIMELOCK_ADDRESS); | ||
governor.setWhitelistAccountExpiration(_account, _expiration); |
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.
just making sure i understand, we're not passing a proposal here because we don't use _checkGovernance
here, correct?
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.
you raise a good point actually. The current check we have is
if (msg.sender != _executor() && msg.sender != whitelistGuardian) {
revert Unauthorized("Not timelock or guardian", msg.sender);
}
I can change it to be like
if (msg.sender != whitelistGuardian) {
_checkGovernance();
}
But then we will only get the error GovernorOnlyExecutor
, instead one that indicates that the msg.sender can also be a whitelistGuardian. What do you think?
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'm fine leaving this as is
* Add whitelist accounts and whitelist guardian * Add `proposalGuardian` * Update natspec, function visibility, and test * Assume caller is not proxy admin in tests * Use `_checkGovernance` * Use `@notice` in natspec * Rename test and assume any caller * Assume _caller is not PROXY_ADMIN_ADDRESS * Move `PROPOSAL_GUARDIAN_EXPIRY` into test helper
closes #10. The rest of the logic will be addressed in #28.