-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from liquity/fix-audit-and-invariants
Fix audit and invariants
- Loading branch information
Showing
32 changed files
with
2,168 additions
and
808 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Snapshot Solvency | ||
|
||
uint256 claim = _votesForInitiativeSnapshot.votes * boldAccrued / _votesSnapshot.votes; | ||
For each initiative this is what the value is | ||
If the initiative is "Claimable" this is what it receives | ||
The call never reverts | ||
The sum of claims is less than the boldAccrued | ||
|
||
Veto consistency | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
- Add properties check to ensure that the math is sound <- HUGE, let's add it now | ||
|
||
A vote is: User TS * Votes | ||
So an allocation should use that | ||
We need to remove the data from the valid allocation | ||
And not from a random one | ||
|
||
I think the best test is to simply store the contribution done | ||
And see whether removing it is idempotent | ||
|
||
We would need a ton of work to make it even better | ||
|
||
|
||
Specifically, if a user removes their votes, we need to see that reflect correctly | ||
Because that's key | ||
|
||
- From there, try fixing with a reset on deposit and withdraw | ||
|
||
- Add a test that checks every: initiative, user allocation, ensure they are zero after a deposit and a withdrawal | ||
- Add a test that checks every: X, ensure they use the correct TS | ||
|
||
- From there, reason around the deeper rounding errors | ||
|
||
|
||
|
||
Optimizations | ||
Put the data in the storage | ||
Remove all castings that are not safe | ||
Invariant test it | ||
|
||
-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
testMode: "assertion" | ||
prefix: "crytic_" | ||
testMode: "property" | ||
prefix: "optimize_" | ||
coverage: true | ||
corpusDir: "echidna" | ||
balanceAddr: 0x1043561a8829300000 | ||
balanceContract: 0x1043561a8829300000 | ||
filterFunctions: [] | ||
cryticArgs: ["--foundry-compile-all"] | ||
cryticArgs: ["--foundry-compile-all"] | ||
|
||
shrinkLimit: 100000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.