Fix: Enforce proposal status when calling Governor.execute depending on proposalNeedsQueuing#6386
Fix: Enforce proposal status when calling Governor.execute depending on proposalNeedsQueuing#6386
proposalNeedsQueuing#6386Conversation
`proposalNeedsQueuing`
🦋 Changeset detectedLatest commit: 73ee8d5 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 |
| if (etaSeconds == 0) { | ||
| revert GovernorNotQueuedProposal(proposalId); | ||
| } |
There was a problem hiding this comment.
This is no longer necessary because Governor.execute enforces status = Queued
| await this.helper.connect(this.voter1).vote({ support: VoteType.For }); | ||
| await this.helper.waitForDeadline(); | ||
| // Not queueud, so it should revert | ||
| await expect(this.helper.execute()).to.be.reverted; |
There was a problem hiding this comment.
Before this change, this would not have reverted
WalkthroughThe changes introduce dynamic queuing logic to the Governor contract. The 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.changeset/silver-falcons-lay.md:
- Line 5: Fix the typo in the changeset note by replacing the word "Scrict" with
"Strict" in the backtick-quoted entry for `Governor` so the line reads:
"`Governor`: Strict enforcement of the expected proposal state depending on
`proposalNeedsQueuing` when calling `execute`."
In `@test/governance/extensions/GovernorTimelockAccess.test.js`:
- Around line 265-266: Fix the typo in the comment ("queueud" → "queued") and
make the revert assertion specific by expecting the
GovernorUnexpectedProposalState error when calling this.helper.execute();
replace the generic await expect(this.helper.execute()).to.be.reverted with an
assertion that the call is reverted with the GovernorUnexpectedProposalState
(include the queued-only allowed states message/args if applicable) so the test
verifies the exact failure mode for this.helper.execute().
In `@test/governance/extensions/GovernorTimelockCompound.test.js`:
- Around line 159-164: The revert assertion is checking the wrong proposal id:
update the .withArgs(...) call used with
.to.be.revertedWithCustomError(this.mock, 'GovernorUnexpectedProposalState') to
pass the local duplicate proposal identifier id (the one passed to
this.helper.execute()) instead of this.proposal.id; keep the other args
(ProposalState.Succeeded and
GovernorHelper.proposalStatesToBitMap([ProposalState.Queued])) unchanged so the
assertion targets the duplicate proposal created in this test.
ℹ️ Review info
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
.changeset/silver-falcons-lay.mdcontracts/governance/Governor.solcontracts/governance/IGovernor.solcontracts/governance/extensions/GovernorTimelockCompound.soltest/governance/Governor.test.jstest/governance/extensions/GovernorTimelockAccess.test.jstest/governance/extensions/GovernorTimelockCompound.test.jstest/governance/extensions/GovernorTimelockControl.test.jstest/governance/extensions/GovernorVotesQuorumFraction.test.js
💤 Files with no reviewable changes (2)
- contracts/governance/extensions/GovernorTimelockCompound.sol
- contracts/governance/IGovernor.sol
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Fixes H-03
PR Checklist
npx changeset add)