liquity / V2-gov

MIT License
3 stars 4 forks source link

Invariant Tests #20

Open GalloDaSballo opened 21 hours ago

GalloDaSballo commented 21 hours ago

Initiatives Tracking

allocateLQTY FSM:

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

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]