Ongoing work to refactor the Governance contract to address the various concerns
[x] Introduces getInitiativeState to better test race conditions and to move towards a fully enforced flow that forces to either claim rewards or unregister on an epoch
[x] Introduces lastEpochClaim to keep view functions working (as well as hold the one epoch = one claim invariant)
[x] Fixes an issue in which a delete proposals could be readded
[x] Tests test_crit_accounting_mismatch - test_canAlwaysRemoveAllocation - These must be re-reviewed once mitigations are in place
[X] Force linearization of claim vs unregister
[X] Prevent Initiatives that were unregistered from being reregistered
[x] Fixes to issues that would prevent a deleted proposals to have votes removed, permanently bricking a user voting power
[x] Reorder functions to better show the flow
[x] Bring back logic that causes multiple claims to work
[x] Expand the FSM tracking to use Enums - BONUS - @nican0r (if you have time do this | then test it invariants)
[ ] Plan out Invariant Tests for Lifecycle to enforce one state per epoch (except Claim -> Claimed) @nican0r
See: https://github.com/liquity/V2-gov/issues/20 ->Lifecycle tests
[x] Fix Counted vs not Counted | Insolvency
[x] Remove Counted
[x] Simplify Code to Remove Counted
InitiativeVoteSnapshot should contain all view values at all time, these values should not "have an opinion"
The flows can be enforced in other functions
[ ] Figure out actual maximum size require (hint prob 88 + 32 = uint120)
[ ] If that works, refactor all logic to use the same size
[ ] From there, store votes and vetos at snapshot (TODO: Can later merge the two into one "vote - vetos"
[ ] Track all status from InitiativeVoteSnapshot
[ ] Simplify threshold logic (ideally remove it)
[ ] Add logic for Veto vs Votes in the relevant functions (claim and unregister)
[ ] Change all the types to their adequate size, reduce all castings that are not necessary
[ ] Rewrite allocateLQTY to use uint88
[ ] Simplify the conditions for allocateLQTY - Only one op per insertion
[ ] Change logic around view variables (votes, vetos, all snapshotted values, store those)
[ ] Use logic to determine behaviour, do not use logic to alter view variables
[ ] Fix tests and document more tests that we need
[ ] Test and document dust amounts
[ ] Test and document vote vs veto issue, determine how to solve
Ongoing work to refactor the
Governance
contract to address the various concernsgetInitiativeState
to better test race conditions and to move towards a fully enforced flow that forces to either claim rewards or unregister on an epochlastEpochClaim
to keep view functions working (as well as hold the one epoch = one claim invariant)test_crit_accounting_mismatch
-test_canAlwaysRemoveAllocation
- These must be re-reviewed once mitigations are in placeLifecycle tests
InitiativeVoteSnapshot
should contain all view values at all time, these values should not "have an opinion"The flows can be enforced in other functions
InitiativeVoteSnapshot
[ ] Change all the types to their adequate size, reduce all castings that are not necessary
[ ] Rewrite
allocateLQTY
to use uint88[ ] Simplify the conditions for
allocateLQTY
- Only one op per insertion[ ] Change logic around view variables (votes, vetos, all snapshotted values, store those)
[ ] Use logic to determine behaviour, do not use logic to alter view variables
test_crit_accounting_mismatch
-test_canAlwaysRemoveAllocation