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

Invariant Tests #20

Open
GalloDaSballo opened this issue Oct 11, 2024 · 0 comments
Open

Invariant Tests #20

GalloDaSballo opened this issue Oct 11, 2024 · 0 comments

Comments

@GalloDaSballo
Copy link
Collaborator

GalloDaSballo commented Oct 11, 2024

Initiatives Tracking

  • Track initiatives
  • Was initiative removed
  • Was initiative added

allocateLQTY FSM:

  • Can vote if active
  • Can remove votes if inactive
  • Cannot vote if inactive
  • Cannot vote more than power
  • The sum of votes is equal to the total votes at most
  • The contributions are linear (no rounding error) (Need to sum up all contributions individually)
  • TODO: Can we save a initiative that should be removed? Prob not

Removal of chunks

    /// Find some random amount
    /// Divide into chunks
    /// Ensure chunks above 1 wei
    /// Go ahead and remove
    /// Ensure that at the end you remove 100%
    function test_fuzz_canRemoveExtact() public {

    }

Prob best done as invariant

Inductive removal of chunks

If I have X votes and remove Y votes, I always have X - Y votes left
If I withdraw Y and then X - Y I have 0 left

For a unregistered initiative

  • Registering reverts
  • Unregistering reverts
  • Claiming Rewards reverts
  • AllocateLQTY can only Reduce Votes or Reduce Vetoes

Lifecycle tests

    enum InitiativeStatus {
        SKIP, /// This epoch will result in no rewards and no unregistering
        CLAIMABLE, /// This epoch will result in claiming rewards
        CLAIMED, /// The rewards for this epoch have been claimed
        UNREGISTERABLE, /// Can be unregistered
        DISABLED // It was already Unregistered
    }

A newly created Initiative should be SKIP
A initiative that didn't meet the threshold should be SKIP
A initiative that has sufficiently high vetoes in the next epoch should be UNREGISTERABLE
A initiative that has reached sufficient votes in the previous epoch should become CLAIMABLE in this epoch
A CLAIMABLE initiative can remain CLAIMABLE in the epoch, or can become CLAIMED once someone claims the rewards

Register and award Flow

0 -> 1 -> 1
SKIP -> CLAIMABLE -> CLAIMED

0 -> X
SKIP -> SKIP -> UNREGISTERABLE -> [UNREGISTERABLE | DISABLED]

0 -> 1
SKIP -> UNREGISTERABLE -> [UNREGISTERABLE | DISABLED]

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

No branches or pull requests

1 participant