openzeppelin-contracts
openzeppelin-contracts copied to clipboard
Timestamp based governor with EIP-5805
Fixes #3081
WIP
This includes a lot of retypes that should be safe, but that must be double-checked, and that the plugin needs to understand.
PR Checklist
- [x] Update IVotes to include
clock() - [x] Refactor
Votes&ERC20Votesto use the value returned byclock()- [ ] Check upgradeability
- [x] Refactor
Governorto use aclock()function- [x] Extract the
clock()value from the token contract - [x] Include a fallback for pre-EIP-5805 tokens
- [ ] Check upgradeability
- [x] Extract the
- [x] Refactor the governance helper to support the two mode (blockNumber/timestamp)
- [x] Test the new governor in both modes
- [x] Including the comp compatibility layer
- [x] Including the NFT voting
- [x] Test the new governor with legacy tokens
- [ ] Documentation
- [ ] Changelog entry
FYI I removed this PR from the milestone because the corresponding issue is already in it.
🦋 Changeset detected
Latest commit: 8397ce732ccc9dd529798aa179c5f349cf33d204
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| openzeppelin-solidity | Minor |
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
The event ProposalCreated has parameters startBlock and endBlock. I think we should rename these even if it's soft-breaking, the ABI-encoding is not changed. This also raises an interesting question that the event doesn't say whether the timepoints are blocks or timestamps. But I suppose it just means you need to consult the clock mode with the Governor contract.
The storage layout errors we are seeing, which say "Layout could have changed...", are because the compiler is not producing storage layout information so the Upgrades plugin conservatively reports that there could be some error. I've added the layout in the config in https://github.com/OpenZeppelin/openzeppelin-contracts/commit/3b591a48acaab78008ed39d60fbcf429a83155ca. After that finishes producing the new layout artifact, we should merge and run it in this PR.
The diff test coverage is not looking super good. See on Codecov. It seems to be in large parte because CLOCK_MODE is never tested. What do you think about adding an EIP-6372 behavior test file?
What do you think about adding an EIP-6372 behavior test file?
done
When is this getting released?
@jonwalch in the next minor (4.9) in a few weeks.
@jonwalch in the next minor (4.9) in a few weeks.
Hey @Amxx, any update on when 4.9 comes out? Thanks!
Next week. Sorry for the delays, we've taken a lot of time to test and audit.
All good. Thanks for the update!