-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Revert with supplied proposalId for unknown proposals in GovernorStorage #6160
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
Revert with supplied proposalId for unknown proposals in GovernorStorage #6160
Conversation
|
WalkthroughThe changes add runtime validation checks to the queue, execute, and cancel functions in the Governor storage extension. These checks verify that a proposal exists by examining the descriptionHash field in proposal details. When a proposal is not found (descriptionHash equals 0), the functions revert with a GovernorNonexistentProposal error. The validation is performed before delegating to existing logic and replaces implicit assumptions about proposal existence with explicit guard clauses. Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
If any of these functions is called with a non-existing proposalId, the corresponding structure will be empty. This will correspond to queuing/executing/cancelling an empty proposal. That empty proposal will be hashed to id Since that (empty) proposal cannot be proposed (blocked by the targets.length not being 0 check), we get the expected revert This PR improves the produced error, and might help with debugging. |
|
I'm not sure we need a changeset here. @ernestognw, would you add one ? |
No I don't think it's needed since the only change would be the argument to the |
|
LGTM, but perhaps there are a couple of things to discuss @Amxx:
|
|

The queue/execute/cancel id-only wrappers in GovernorStorage delegated with empty details for unknown proposal IDs, causing GovernorNonexistentProposal to be raised with a computed id that doesn’t match the caller-supplied proposalId. Add an existence check using descriptionHash == 0 and revert with GovernorNonexistentProposal(proposalId) before delegating. This keeps the storage access pattern and aligns revert parameters with the input id for better UX and tooling.