-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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 a governor extension that implements a proposal guardian #5303
Add a governor extension that implements a proposal guardian #5303
Conversation
🦋 Changeset detectedLatest commit: 276185d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Looks good other than some comments. Would it make sense to call it something like |
Compound Governance already has a feature like this where the council is called the |
9bc440d
to
d613cc8
Compare
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's the rationale to allow a proposer to cancel a proposal at any time?
I think the contract would be simpler if it just focus on allowing the guardian to cancel at any time and otherwise fallback to their original behavior with super
.
The inspiration for this PR is in #5260 which was then replaced by #5301. There is some context missing but will try to give a TLDR.
|
Co-authored-by: Ernesto García <[email protected]>
Co-authored-by: Ernesto García <[email protected]>
Right, this was my interpretation as well. I also don't have any concrete example of such an exploit. Getting back to the whole idea of enhancing cancellation capabilities, one concern I have with this design is the pattern: if (...) {
...
_cancel(...);
} else if (...) {
...
_cancel(...);
} else {
super.cancel();
} The reasoning is that we're allowing to bypass Consider a contract that inherits from contract GovernorCancellationCounter {
uint256 cancellations;
function cancel(...) public override virtual returns (uint256) {
cancellations++;
super.cancel(...);
}
}
contract MyGovernor is ..., GovernorCancellationCounter, GovernorProposalGuardian { ... } // Order is important In this case, the count would be missing the internal branches that don't call I'd feel more comfortable if function _validateCancel(...) internal virtual {
// Current logic
uint256 proposalId = hashProposal(targets, values, calldatas, descriptionHash);
_validateStateBitmap(proposalId, _encodeStateBitmap(ProposalState.Pending));
if (_msgSender() != proposalProposer(proposalId)) {
revert GovernorOnlyProposer(_msgSender());
}
}
...
function cancel(...) public virtual returns (uint256) {
_validateCancel();
return _cancel(targets, values, calldatas, descriptionHash);
} I think this way users can override |
use `_validateCancel` instead of overriding `cancel`
Co-authored-by: Hadrien Croubois <[email protected]>
Co-authored-by: Hadrien Croubois <[email protected]>
Co-authored-by: Hadrien Croubois <[email protected]>
Should the proposal guardian have the ability to give up this role? I could see an argument in either direction but think it's worth a brief discussion before merging. For: Against: I think I lean towards for since the frequency of broken proposals out in the wild is quite high. If the proposal guardian isn't able to act effectively, the DAO needs the proposers to have this ability. |
When there is a guardian, proposer still have the ability to cancel "early". IMO:
function transferProposalGuardian(address newProposalGuardian) public {
require(_msgSender == proposalGuardian());
_setProposalGuardian(newProposalGuardian);
} When in doubts, or when we think not everyone needs something, I'm always in favor of not forving the feature. In that particular case, the Governor is already close to the limit en terms of bytecode size, so I would avoid increassing it for something users may not want/need. |
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.
LGTM
Fixes #5301
PR Checklist
npx changeset add
)