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

FEATURE: ElectionModule #696

Merged
merged 33 commits into from Feb 18, 2022
Merged

FEATURE: ElectionModule #696

merged 33 commits into from Feb 18, 2022

Conversation

theethernaut
Copy link
Contributor

@theethernaut theethernaut commented Jan 10, 2022

ElectionModule implementation feature branch.

Spec: https://hackmd.io/@wDuYijTaRY6GbPExcc1gWw/HkNyRskjK
Reference implementation: #632

@codecov
Copy link

codecov bot commented Jan 10, 2022

Codecov Report

Merging #696 (38e7495) into main (5f6b998) will increase coverage by 0.08%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #696      +/-   ##
==========================================
+ Coverage   97.16%   97.24%   +0.08%     
==========================================
  Files          71       77       +6     
  Lines        1233     1271      +38     
  Branches       62       98      +36     
==========================================
+ Hits         1198     1236      +38     
  Misses         35       35              
Flag Coverage Δ
core-contracts 100.00% <ø> (ø)
core-js 99.26% <100.00%> (+<0.01%) ⬆️
core-modules 100.00% <100.00%> (ø)
deployer 96.34% <100.00%> (ø)
synthetix-main 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/core-js/utils/ethers/events.js 100.00% <100.00%> (ø)
packages/core-js/utils/misc/dates.js 100.00% <100.00%> (ø)
.../core-modules/contracts/modules/ElectionModule.sol 100.00% <100.00%> (ø)
...tracts/submodules/election/ElectionCredentials.sol 100.00% <100.00%> (ø)
...contracts/submodules/election/ElectionSchedule.sol 100.00% <100.00%> (ø)
...es/contracts/submodules/election/ElectionTally.sol 100.00% <100.00%> (ø)
...es/contracts/submodules/election/ElectionVotes.sol 100.00% <100.00%> (ø)
...les/election/strategies/ElectionTallyPlurality.sol 100.00% <100.00%> (ø)
packages/deployer/subtasks/create-deployment.js 89.74% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5f6b998...38e7495. Read the comment docs.

@theethernaut theethernaut marked this pull request as draft January 10, 2022 12:02
@theethernaut theethernaut self-assigned this Jan 10, 2022
* WIP ElectionModule init

* Linter fixes

* Fix

* Linter fixes

* ElectionModule reporting getEpochStatus()

* Increase test coverage

* ElectionSchedule modifiers

* Comment unused modifiers

* More ElectionModule status checks

* Interoduce ElectionBase

* Progress with ElectionModule period management

* Simplified ElectionSchedule modifiers

* Using IElectionModule

* Fix

* TIdy ups

* Fix

* Fix

* Undo changes to InitError

* Minor rename

* Processing PR feedback

* Renames

* Implemented PR feedback

* Better time checks

* Linter fix
* Bootstrap sets functionality

* Basic SetUtil tests

* Implemented AddressSet
* WIP ElectionModule init

* Linter fixes

* Fix

* Linter fixes

* ElectionModule reporting getEpochStatus()

* Increase test coverage

* ElectionSchedule modifiers

* Comment unused modifiers

* More ElectionModule status checks

* Interoduce ElectionBase

* Progress with ElectionModule period management

* Simplified ElectionSchedule modifiers

* Using IElectionModule

* Fix

* TIdy ups

* Fix

* Fix

* Undo changes to InitError

* Minor rename

* Processing PR feedback

* Renames

* Implemented PR feedback

* Preparing feature

* Implemented nominations
* WIP ElectionModule init

* Linter fixes

* Fix

* Linter fixes

* ElectionModule reporting getEpochStatus()

* Increase test coverage

* ElectionSchedule modifiers

* Comment unused modifiers

* More ElectionModule status checks

* Interoduce ElectionBase

* Progress with ElectionModule period management

* Simplified ElectionSchedule modifiers

* Using IElectionModule

* Fix

* TIdy ups

* Fix

* Fix

* Undo changes to InitError

* Minor rename

* Processing PR feedback

* Renames

* Implemented PR feedback

* Start voting ability

* Added ElectionModule vote tests

* WIP ability to vote

* Update election tests

* Tidy ups

* Move check to save gas

* Have a ballot with multiple candidates in tests

* Lint fix
@mjlescano mjlescano mentioned this pull request Jan 20, 2022
theethernaut and others added 20 commits January 20, 2022 12:30
* WIP ElectionModule init

* Linter fixes

* Fix

* Linter fixes

* ElectionModule reporting getEpochStatus()

* Increase test coverage

* ElectionSchedule modifiers

* Comment unused modifiers

* More ElectionModule status checks

* Interoduce ElectionBase

* Progress with ElectionModule period management

* Simplified ElectionSchedule modifiers

* Using IElectionModule

* Fix

* TIdy ups

* Fix

* Fix

* Undo changes to InitError

* Minor rename

* Processing PR feedback

* Renames

* Implemented PR feedback

* Start voting ability

* Added ElectionModule vote tests

* WIP ability to vote

* Update election tests

* Tidy ups

* Move check to save gas

* Progress with dates review

* WIP adjustEpoch refactor

* Linter fixes

* Cleanups

* Fixes

* Minor improvements

* Refactor to always use dates
* Update to latest feature branch

* Minor tidy up

* Fixes

* WIP initializable implementation in ElectionModule

* Disabling initializables checks until fixed

* Add comments to fix

* Commented out initialzable tests
* Update to latest feature branch

* Minor tidy up

* Fixes

* WIP initializable implementation in ElectionModule

* Disabling initializables checks until fixed

* Add comments to fix

* Commented out initialzable tests

* WIP

* WIP

* WIP

* Basic evaluation working

* Rename

* Add tests

* Linter fixes

* Update packages/core-modules/contracts/submodules/election/ElectionTally.sol

Co-authored-by: Matías Lescano <mjlescano@users.noreply.github.com>

* Move logic that determines when election evaluation ends

* More compact reversions

* Update packages/core-modules/contracts/modules/ElectionModule.sol

Co-authored-by: Leonardo Massazza <leo@synthetix.io>

* Update packages/core-modules/contracts/modules/ElectionModule.sol

Co-authored-by: Leonardo Massazza <leo@synthetix.io>

* Update packages/core-modules/contracts/modules/ElectionModule.sol

Co-authored-by: Leonardo Massazza <leo@synthetix.io>

* Fix ballot counting algo

Co-authored-by: Matías Lescano <mjlescano@users.noreply.github.com>
Co-authored-by: Leonardo Massazza <leo@synthetix.io>
* check initializable modules only

* fix tests
* Add ERC20HistoricalBalance

* test skeleton

* add block helper

* fix tests
* Create council token

* Contracts for create council token

* Record first council members

* Preparing for nft shuffle

* WIP

* Working NFTs

* Renames

* Update Solidity version

* Minor tweaks

* More minor tewaks

* Addded comment
* Create council token

* Contracts for create council token

* Record first council members

* Preparing for nft shuffle

* WIP

* Working NFTs

* Renames

* Update Solidity version

* Minor tweaks

* More minor tewaks

* Fn renames in ElectionModule

* Add tests

* WIP events

* Moar events

* WIP even moar

* VoteRecorded event

* Election evaluation events

* Election resolution events
* Create council token

* Contracts for create council token

* Record first council members

* Preparing for nft shuffle

* WIP

* Working NFTs

* Renames

* Update Solidity version

* Minor tweaks

* More minor tewaks

* Fn renames in ElectionModule

* Add tests

* Fix assertBn.eq(

Co-authored-by: Matías <mjlescano@protonmail.com>
* Idea for more consistent election module storage

* WIP cleanups

* WIP cleanups

* WIP tidy ups

* WIP docs

* More docs

* Simplify ElectionSchedule

* Move tests

* Make some fns external

* Rename fn

* Linter fix

* Update comments

* More docs

* Linter fixes

* Move enum
leomassazza and others added 7 commits February 2, 2022 14:02
* Revert "Rename _moveVotingPower to non election related (#789)"

This reverts commit 4dd32d3.

* Revert "Add ERC20HistoricalBalance (#751)"

This reverts commit 971bee5.
* Moved helper

* Remove old helper

* Fix
@theethernaut theethernaut marked this pull request as ready for review February 3, 2022 17:37
Copy link
Contributor

@leomassazza leomassazza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super!

@theethernaut theethernaut merged commit 780431c into main Feb 18, 2022
@theethernaut theethernaut deleted the feature/election-module branch February 18, 2022 22:16
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.

None yet

3 participants