Skip to content
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

Delay the Pending state until strictly after proposal.voteStart #2892

Merged
merged 10 commits into from Oct 6, 2021
3 changes: 2 additions & 1 deletion contracts/governance/Governor.sol
Expand Up @@ -115,7 +115,8 @@ abstract contract Governor is Context, ERC165, EIP712, IGovernor {
return ProposalState.Executed;
} else if (proposal.canceled) {
return ProposalState.Canceled;
} else if (proposal.voteStart.isPending()) {
} else if (proposal.voteStart.getDeadline() >= block.number) {
// prevent voting until voteStart is passed, so that getVotes never tries to get value for the current block.
return ProposalState.Pending;
} else if (proposal.voteEnd.isPending()) {
frangio marked this conversation as resolved.
Show resolved Hide resolved
return ProposalState.Active;
Expand Down
4 changes: 4 additions & 0 deletions test/governance/Governor.test.js
Expand Up @@ -559,6 +559,10 @@ contract('Governor', function (accounts) {

await time.advanceBlockTo(this.snapshot);

expect(await this.mock.state(this.id)).to.be.bignumber.equal(Enums.ProposalState.Pending);

await time.advanceBlock();

expect(await this.mock.state(this.id)).to.be.bignumber.equal(Enums.ProposalState.Active);
});
runGovernorWorkflow();
Expand Down