-
Notifications
You must be signed in to change notification settings - Fork 11.7k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include missing _cancel(uint256 proposal_id) in GovernorTimelockControl #4052
Comments
Hello @sebsylvester, and thank you for raising that issue ! Currently we have two different signatures for the internal function _cancel(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash);
function _cancel(uint256 proposalId) We can see that the first one is "just" an alias to the second one. The second one was introduced in #3983 when we wanted to introduce a public We missed something important when doing so! Right now, in master, we have flowchart LR
id1{{"cancel(uint256)"}}
id2{{"_cancel(uint256)"}}
id3{{"_cancel(address[],uint256[],bytes[],bytes32)"}}
id1 --> id2
id3 --> id2
This is good, except the public function completely skips the "full params" internal one. On the other hand, we have 2 other contracts (beside the core
In both cases we override the "full params" internal one, which means that in both cases the custom logic (that cancels on the timelock) is NOT executed when calling the public function. In the case of In the case of TLDR: the current implementation of the public cancel is not good. Fortunatelly it was never released but we need to fix that for 4.9 |
Also, its worrying (but logic) that the tests did not catch that:
|
I see 2 viable options:
We discussed how to implement option 2 without having redundant storage with Our best option might be option 1, with a roadmap to having |
Thank you again for raising that issue. As a small token of appreciation we would like to award you a contributor gitpoap! @gitpoap-bot @sebsylvester |
Congrats, @sebsylvester ! You've earned a GitPOAP for your contribution! GitPOAP: 2023 OpenZeppelin Contracts Contributor: Head to gitpoap.io & connect your GitHub account to mint! Learn more about GitPOAPs here. |
馃 Motivation
When using the Governor contract with the GovernorTimelockControl, one needs to override
cancel(uint256 proposalId)
because both Pending and Queued proposals must be cancellable. The problem is that it's not possible to invoke the inherited function_cancel(address[] memory targets, uint256[] memory values, bytes[] memory calldatas, bytes32 descriptionHash
from inside the overidden public cancel function.)
馃摑 Details
A solution would be to let the GovernorTimelockControl override both the internal _cancel functions it inherits from Governor, in which case the four-argument function simply forwards to the single-argument function (as is the case in the Governor contract). The logic currently inside _cancel would move to the new single-argument function.
The downside is that it's a breaking change for anyone using the GovernorTimelockControl.
I will submit a PR with a link to this issue.
The text was updated successfully, but these errors were encountered: