openzeppelin-contracts icon indicating copy to clipboard operation
openzeppelin-contracts copied to clipboard

Timestamp based governor with EIP-5805

Open Amxx opened this issue 2 years ago • 2 comments

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 & ERC20Votes to use the value returned by clock()
    • [ ] Check upgradeability
  • [x] Refactor Governor to use a clock() function
    • [x] Extract the clock() value from the token contract
    • [x] Include a fallback for pre-EIP-5805 tokens
    • [ ] Check upgradeability
  • [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

Amxx avatar Jan 06 '23 14:01 Amxx

FYI I removed this PR from the milestone because the corresponding issue is already in it.

frangio avatar Jan 20 '23 02:01 frangio

🦋 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

changeset-bot[bot] avatar Jan 20 '23 10:01 changeset-bot[bot]

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.

frangio avatar Feb 04 '23 00:02 frangio

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.

frangio avatar Feb 04 '23 00:02 frangio

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?

frangio avatar Feb 04 '23 00:02 frangio

What do you think about adding an EIP-6372 behavior test file?

done

Amxx avatar Feb 06 '23 12:02 Amxx

When is this getting released?

jonwalch avatar Mar 06 '23 19:03 jonwalch

@jonwalch in the next minor (4.9) in a few weeks.

Amxx avatar Mar 07 '23 09:03 Amxx

@jonwalch in the next minor (4.9) in a few weeks.

Hey @Amxx, any update on when 4.9 comes out? Thanks!

jonwalch avatar May 01 '23 16:05 jonwalch

Next week. Sorry for the delays, we've taken a lot of time to test and audit.

frangio avatar May 03 '23 14:05 frangio

All good. Thanks for the update!

jonwalch avatar May 03 '23 14:05 jonwalch