-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
Pack Governor's ProposalCore into a single slot #4268
Pack Governor's ProposalCore into a single slot #4268
Conversation
🦋 Changeset detectedLatest commit: 802d4d8 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 |
contracts/governance/Governor.sol
Outdated
@@ -161,7 +156,8 @@ abstract contract Governor is Context, ERC165, EIP712, IGovernor, IERC721Receive | |||
* @dev See {IGovernor-state}. | |||
*/ | |||
function state(uint256 proposalId) public view virtual override returns (ProposalState) { | |||
ProposalCore storage proposal = _proposals[proposalId]; | |||
// ProposalCore is just one slot |
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 intention with this comment? Is it that we're reading it into memory because it's one slot and that will be more efficient? If so, let's write that explicitly.
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.
Yes, that is the intention.
voteStart: SafeCast.toUint48(snapshot), | ||
voteDuration: SafeCast.toUint32(duration), |
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.
Are we documenting these bounds anywhere?
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.
Not yet.
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.
Documentation added in IGovernor (in the natspec for votingDelay
and votingPeriod
)
Let's change GovernorSettings in here as well. |
Co-authored-by: Ernesto García <ernestognw@gmail.com>
LGTM except for the comments above. |
Co-authored-by: Francisco <fg@frang.io>
Co-authored-by: Ernesto García <ernestognw@gmail.com> Co-authored-by: Francisco <fg@frang.io>
Fixes #3208
Fixes LIB-803
Note: we could merge
canceled
andexecuted
into a single byte using an enum. That would increase the space for duration touint40
.This is purely internal, no interface change:
PR Checklist
npx changeset add
)