21 Commits

Author SHA1 Message Date
Github Actions
fefa3c13f6 Publish
- @0x/contracts-erc20@4.0.7
 - @0x/governance@1.0.5
 - @0x/contracts-test-utils@5.4.53
 - @0x/contracts-treasury@1.4.47
 - @0x/contracts-utils@4.8.45
 - @0x/contracts-zero-ex@0.43.0
 - @0x/contract-addresses@8.6.0
 - @0x/contract-wrappers@13.23.1
 - @0x/protocol-utils@11.22.1
2023-05-01 21:25:50 +00:00
Github Actions
f1d096a8af Updated CHANGELOGS & MD docs 2023-05-01 21:25:47 +00:00
Savarn Dontamsetti (Sav)
5a47f04ffc
fix: remove vm.stopPrank if vm.startPrank not present (#719)
* remove vm.stopPrank if vm.startPrank not present

* remove unnecessary vm.stopPrank from governance tests
2023-05-01 14:13:56 -04:00
Github Actions
ad2d41fd90 Publish
- @0x/contracts-erc20@4.0.5
 - @0x/governance@1.0.4
 - @0x/contracts-test-utils@5.4.51
 - @0x/contracts-treasury@1.4.44
 - @0x/contracts-utils@4.8.43
 - @0x/contracts-zero-ex@0.41.0
 - @0x/contract-addresses@8.4.0
 - @0x/contract-wrappers@13.22.20
 - @0x/protocol-utils@11.20.0
2023-04-17 18:29:25 +00:00
Github Actions
721b984bbc Updated CHANGELOGS & MD docs 2023-04-17 18:29:22 +00:00
Github Actions
484d9cafc4 Publish
- @0x/governance@1.0.3
2023-04-17 01:24:55 +00:00
Github Actions
e73885c9a0 Updated CHANGELOGS & MD docs 2023-04-17 01:24:52 +00:00
Kyu
948b17e2ed Add publishConfig in governance/package.json (#707)
* publishConfig is needed for lerna to publish governance as a public
  package
2023-04-16 18:03:23 -07:00
Github Actions
2b13dcfc14 Publish
- @0x/contracts-erc20@4.0.4
 - @0x/governance@1.0.2
 - @0x/contracts-test-utils@5.4.51
 - @0x/contracts-treasury@1.4.44
 - @0x/contracts-utils@4.8.42
 - @0x/contracts-zero-ex@0.40.0
 - @0x/contract-addresses@8.3.0
 - @0x/contract-wrappers@13.22.20
 - @0x/protocol-utils@11.19.0
2023-04-16 23:30:53 +00:00
Github Actions
d2bea4aa46 Updated CHANGELOGS & MD docs 2023-04-16 23:30:50 +00:00
wonge97
57ca2c07bb
Correct final audit document (#702) 2023-04-11 15:08:22 -04:00
Github Actions
b0d2dee84d Publish
- @0x/contracts-erc20@4.0.3
 - @0x/governance@1.0.1
 - @0x/contracts-test-utils@5.4.50
 - @0x/contracts-treasury@1.4.43
 - @0x/contracts-utils@4.8.41
 - @0x/contracts-zero-ex@0.39.2
 - @0x/contract-wrappers@13.22.19
 - @0x/protocol-utils@11.18.2
2023-04-10 20:05:52 +00:00
Github Actions
1422ad756d Updated CHANGELOGS & MD docs 2023-04-10 20:05:48 +00:00
Elena
356e74a645
Integration test for migrating 0x stake (#697)
* Add integration test for withdrawing 0x stake in catastrophic mode

* Add a test for delegating to an external account

* Use startPrank for all calls as all from delegator

* Better use of prank

Co-authored-by: duncancmt <1207590+duncancmt@users.noreply.github.com>

* Add the delegation test under normal operation mode'

---------

Co-authored-by: duncancmt <1207590+duncancmt@users.noreply.github.com>
2023-04-07 15:59:49 +03:00
duncancmt
70590e3e56
Actual script for governance deployment (#696)
* Renounce deployer timelock roles

* Add readme

* Remove obsoleted import

---------

Co-authored-by: elenadimitrova <elena@arenabg.com>
2023-04-06 19:01:43 +03:00
Elena
4e0b671bd8
Integration test catastrophic mode in staking v3 (#691)
* Integration test catastrophic mode

* Update test for withdrawals in catastrophic mode

* Test withdrawing delegator rewards work in catastrophic mode

* Test top stakers can withdraw

* Test more delegators rewards withdrawals

* Add claiming rewards for a pool owner

* Fix for forge coverage
2023-04-06 16:21:01 +03:00
Elena
ea2ca700c3
Add final report (#695) 2023-04-06 16:20:01 +03:00
Elena
3574ea5b27
Governance deployment scripts (#684)
* Add foundry deployment script and config

* Add generated by foundry build artifact for Treasury

* Add shortcut commands for goerli deployment

* Switch to a production version of predicting a deployment address

* Lower gas price

* Fix a copy-paste error

* Productionise and final test
2023-04-05 10:06:07 +03:00
Elena
b7bf5b5dfe
Governance integration testing (#683)
* Segregate tests and mocks and wire up integration test base

* Switch to a production version of predicting a deployment address

* Add integration test for exchange governor migration

* Add integration test for treassury migration

* Add integration test for migrating the treasury

* Add governance upgrade action to transfer ZRX tokens to new governor

* Add governance upgrade action to transfer wCELO tokens to new governor

* Add governance upgrade action to transfer WYV tokens to new governor

* Turn on verbose logging
2023-04-05 09:35:08 +03:00
Elena
cfbb9c6f6c
Governance audit and fixes (#690)
* Fix F-3: Explicit Variable Return audit report

* Reuse onlySecurityCouncil modifier and update its revert message

* Fix F-5: modifier Optimization audit report

* Fix F-7: Input Sanity Check audit report

* Add audit report

* Further gas optimise getting a checkpoint function by up to 100 gas

* Fix F-6: return Statement Optimization audit report

* Wrap logic in unchecked block to save 24 gas
in getVotes and getQuadraticVotes each

* Move audit doc into a dedicated folder
2023-04-04 18:06:38 +03:00
Elena
bcbfbfa16c
Decentralised governance of 0x protocol and treasury (#641)
* Install open zeppelin contracts

* Init foundry in governance

* Add wrapped ZRX token

* Add governance contracts testing to CI

* Set optimizer runs to default

* Upgrade to patched version of openzeppelin/contracts

* Test stakingakng / unwrapping ZRX

* Init npm package

* Lint fix, removing lib from gitignore

* Add openzeppelin contracts git submodule for foundry

* Add vanilla governor contract

* Fix reference paths to imported packages

* Temporarily switch to using a mocked version of ZRX

* Ignore foundry's lib in link checker

* Fix a conflict in gitignore between forge lib adn built lib

* Upload governance code coverage report to coveralls

* Flesh out test scenarios for wrapping/unwrapping

* Add basic ERC20 name and symbol tests

* Wire in basic timelock controller and governor test setup

* Test basic governor properties

* Add basic voting power delegation tests

* Add proposal execution happy path test

* Split ERC20Votes logic between wrapped token
and ZeroExVotes contracts

* Exclude BaseTest from coverage in coveralls

* Add protocol specific governor with produciton governance settings

* Add a dedicated instance for the treasury governor
This is currently using the default 1 token 1 vote mechanism but will be migrated

* Add test for updating governance settings
for voting delay, voting period and proposal threshold

* Create seperate timelock contract instance for treasury and protocol

* Test updating the timlock min delay

* Set timelock delay to 2 days for protocol and 1 sec for treasury

* Remove timelock from treasury governor

* Refactor _checkpointsLookup to return entire Checkpoint
instad of just number of votes

* Update the totalSupply checkpoints updating logic

* Quadratic voting power transfers and delegations

* Fix workflow yaml

* Initialise ZeroExVotes behind a ERC1967Proxy
Test it cannot be reinitialised

* Remove obsoleted console.logs from test

* Storage pack Checkpoint enum

* Remove keeping track of total balances for voting

* Switch to using the foundry artifact in test

* Fix rebase issue

* Add timelock control over the treasury governor

* Add test for wrapped token transfer

* Emit separate events for changing linear and quadratic voting power

* Add the ability to cancel a proposal

* Limit the governors' cancel function to security council only

* Eject security council after a proposal is cancelled

* Add ability for governance to set the security council

* Merge the governors test suites into one reusable set of tests

* Add an empty test function to base test contract
to remove it from coverage reports. Fudge but no other way to ignore it in report

* Security council can rollback protocol upgrades

* Upgrade to solidity 0.8.19

* Move IZeroExGovernor to src

* Abstract Security council interface into its own

* Emit events when assigning and ejecting the security council

* Use a cast to bytes4 instead of LibBytes

Co-authored-by: duncancmt <1207590+duncancmt@users.noreply.github.com>

* Writing total supply checkpoints and setup of
quorum percentage of quadratic total supply for treasure governor

* Add test for transferring tokens when delegating

* Rename IZeroExSecurityCouncil to ISecurityCouncil

* Add security council restrictions to governors

* Remove obsolete overflow check

* Improve test coverage

* Upgrade open-zeppelin contracts to 4.8.2

* Test delegation by signature

* Test non security council requests
to rollback protocol changes cannot be executed

* Better revert messages

* Test correct interfaces are supported

* Remove obsoleted funciton

* Further test delegation by signature scenario

* Split the delegation functionality tests

* Add test for initialisation of voting contract

* Add test for reading checkpoints

* Update code comments

* Fix compilation warnings

* Run smt checker

* Add checkpoint tests

* Rename parameter in moveEntireVotingPower to match the one in movePartialVotingPower

* Switch moveEntireVotingPower to a more generic moveVotingPower implementation
as in the open-zeppelin contracts

* Install foundry earlier in CI

* Switch movePartialVotingPower to the generic moveVotingPower implementation

* Write totalSupplyCheckpoints via the generic _writeCheckpoint

* Add threshold for quadratic voting power

* Remove autoinserted code by OZ

* Add openzeppelin/contracts-upgradable

* Add initializable base to Voting contract

* Fix terminogy error in natspec

* Fix code comment

* Remove obsoleted overrides and add a missing modifier to moveVotingPower

* Remove amount check

Co-authored-by: duncancmt <1207590+duncancmt@users.noreply.github.com>

* Fix a calculation error and clean tests

* Update thresholds for treasury governor

* Fix testShouldNotBeAbleToDelegateWithSignatureAfterExpiry

* Update from @duncancmt

without "memory-safe" the IR optimizer produces significantly worse code and it disables the stack limit evader

Co-authored-by: duncancmt <1207590+duncancmt@users.noreply.github.com>

* Add onlyProxy to initializer

* Fix quadratic voting weight base

* Rename voting parameter for clarity

* Make addresses immutable (#680)

* Make addresses immutable

* Fix linting issues

---------

Co-authored-by: elenadimitrova <elena@arenabg.com>

* Prevent griefing by a malicious ZeroExVotes upgrade (#681)

* Gas optimization

* Minimal change to prevent malicious ZeroExVotes from griefing

* Add demonstration of griefing upgrade

* Fix rebase issues with tests

* Fix prettier issues

* Add checks to test

---------

Co-authored-by: elenadimitrova <elena@arenabg.com>

* Rename SecurityCouncil contract

* Add timestamp to delegator balance updates

* Make quadraticThreshold `immutable` for gas efficiency

* Remove the logic for ejecting security council

* Switch balance timestamp to be a block number

* Test votes migration for adding a new vote weight mechanism (#674)

* Add Emacs files to .gitignore

* Make some functions unproected to demonstrate a migration

* Add example (broken) migration

* Add migration test for voting logic

* Try to simplify tests

* Fix compilation errors

* Fix underflow test with new logic

* Flesh out migration test for voting

* Replace cube root library

* Fix stack too deep in coverage

---------

Co-authored-by: elenadimitrova <elena@arenabg.com>

* Change test case to testFail

* Update contracts/governance/test/ZeroExVotesMigration.sol

Co-authored-by: duncancmt <1207590+duncancmt@users.noreply.github.com>

---------

Co-authored-by: duncancmt <1207590+duncancmt@users.noreply.github.com>
Co-authored-by: Duncan Townsend <git@duncancmt.com>
2023-03-22 15:03:05 +02:00