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

CompoundGovernor Upgrade #20

Draft
wants to merge 39 commits into
base: main
Choose a base branch
from
Draft

Conversation

jferas and others added 30 commits November 1, 2024 14:16
* Configured foundry/hardhat compatibility

* Add empty placeholder governor and test contract to verify forge install is working

* Added foundry.toml defaults for testing and formatting (original contracts not formatted)

* Add forge install to test.yml

* Updated hardhat plugin to latest to resolve coverage issue

* Switched proposer address in fork tests to one with some voting power

* prettier fix .. need for this triggered by previous commit ts file change
* forge install: openzeppelin-contracts-upgradeable

v5.0.2

* Create initial basic governor

* Line break fix

* Inheritance order fix

* Inheritdoc updates

* Fix eslint issue in lib directory

* Switch to using GovernorTimelockCompoundUpgradeable

* Fixed _executor function
* Added test framework with minimal deploy script

* forge fmt constant cleanup

* Added TODO about constants
* Added GovernorSettableFixedQuorumUpgradeable

* Changed foundry.toml optimizer_runs to 200 to shrink code size

* Now using 'upperLookupRecent' for checkpointed quorum values

* Use 'clock()' instead of 'block.timestamp' when setting checkpointed quorum

* Also use clock() for setQuorum emit

* Consistent use of uint256 for quorum publicly, uint208 internally

* Removed superflous cast

* Fixed test to use clock for quorum checkpoint

* Apply suggestions from code review

Notice and addition of "virtual" to functions where it was missing.

Co-authored-by: Ed Mazurek <[email protected]>

---------

Co-authored-by: Ed Mazurek <[email protected]>
* Removed previous OZ contracts library of 5.0.2

* forge install: openzeppelin-contracts-upgradeable

v5.1.0-rc.0

* Update governor to use GovernorCountingFractional from OZ 5.1 (which requires EVM version 'cancun')
* Add `CompoundGovernorVotesUpgradeable` and `IComp`

* Add tests and misc

* Make tests `view`

* Rename and inherit contract

* Update storage location

* Make test names descriptive

* Update natspec
)

* Added SetQuorum test via proposal test helper and refactored test files

* Remove unneeded casts

* Removed double-negative assert in test

* License changed for IComp.sol

* Changed ContructedProposal to Proposal

* Opened up range of values for setQuorum tests

* Added test testFuzz_RevertIf_CalledByNonTimelock

* Refactored tests

* Prevent proxy admin from invoking setQuorum in test
* Add whitelist accounts and whitelist guardian

* Add `proposalGuardian`

* Update natspec, function visibility, and test

* Assume caller is not proxy admin in tests

* Use `_checkGovernance`

* Use `@notice` in natspec

* Rename test and assume any caller

* Assume _caller is not PROXY_ADMIN_ADDRESS

* Move `PROPOSAL_GUARDIAN_EXPIRY` into test helper
* Accept `proxyAdmin` as constructor arg in deploy script

* Make timelock `proxyAdminOwner` and rename vars

* Remove proxyAdminOwner as an arg
* Add cancel logic and tests

* Use `_getProposalId` instead of `hashProposal` to prep for upcoming change

* Rename and cleanup test

* Use helpers to set whitelist accounts and remove voting weight

* Clean up test

* Update natspec

* docstring nit

---------

Co-authored-by: Ed Mazurek <[email protected]>
* WIP - GovernorSequentialProposalIdUpgradeable.sol

* Got tests working

* Used only slightly modified GovernorUpgradeable from oz lib

* Updated extension comment headers

* Format change for hashProposal function

* Additional format change
* WIP - GovernorBravo to CompoundGovernor upgrade script and tests

* Delete commented-out code

* Added tests for proper proposal operations after successful or failed upgrades

* Changed failure test name to include _RevertIf_

* Refactored upgrade/proposal tests

* Added TODO for upgrade proposal description

* Changed BravoToCompoundUpgradeBeforeDeployTest to PreUpgradeTest

* Move needed constants to central place in CompoundGovernorConstants

* Moved token assignment to common location in test setup

* New test helper orchestration

Co-authored-by: Gary Ghayrat <[email protected]>

* Rebase fixes

Co-authored-by: Gary Ghayrat <[email protected]>

* Changed to updated proxy admin address

---------

Co-authored-by: wildmolasses <[email protected]>
Co-authored-by: Gary Ghayrat <[email protected]>
* consolidate test files

* remove owner, add some natspec

* lint the js
* forge install: openzeppelin-contracts-upgradeable

v5.1.0

* Updated extensions to match OZ 5.1
* Add upgrade proposal description

* Remove TODO comment

* Update script/ProposeUpgradeBravoToCompoundGovernor.s.sol

---------

Co-authored-by: Ed Mazurek <[email protected]>
* Add natspec

* Update contracts/extensions/GovernorSequentialProposalIdUpgradeable.sol

---------

Co-authored-by: Ed Mazurek <[email protected]>
* Add some `propose` and `queue` tests

* Add `execute` tests and refactor `cancel` tests

* Apply suggestions from code review

---------

Co-authored-by: Ed Mazurek <[email protected]>
* Added a lot of proposal related tests

* Shortened invalid proposal ID tests

* Added more invalid proposal ID tests

* Switched to _getRandomProposer and unname parameter for proposal fuzz tests

* Changed names of zeroReturnIf test functions

* Fix typos

* Enhanced proposal threshold test

* Slight change to test names

* Remove underscores from test names

---------

Co-authored-by: garyghayrat <[email protected]>
* Fix inconsisten OZ version comment in IGovernor

* Restore oz formatting

---------

Co-authored-by: garyghayrat <[email protected]>
jferas and others added 9 commits December 15, 2024 11:20
* Changed _quorumReached to not include abstentions and added test verification

* Addressed code review comments
* Add in missing ERC7201 natspec tag

* Addressed review comment

* Corrected hash of GovernorSequentialProposalIdStorageLocation
* Fix to initialize next proposal ID to be GovernorBravo proposal count + 1

* Added explanatory comment to setNextProposalId
* Allow whitelisted accounts to propose even if they are below proposalThreshold

* Move proposal threshold check logic into governor

* Add line break

* Add natspec and rename vars

* Simplify propose logic

* Update `propose` and `setWhitelistAccountExpiration` natspec

* Update test names and add test

* Update contracts/CompoundGovernor.sol

---------

Co-authored-by: Ed Mazurek <[email protected]>
#88)

* Revert if proposalGuardian role is expired

* Instead of reverting, allow proposalGuaridan to cancel proposals below threshold like anyone else

* Simplify cancel logic

* Fix expiration check

* Add additional tests
* single proposal per proposer

* elapsedBlocks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants