zeitgeist
zeitgeist copied to clipboard
Add fuzz tests that verify invariants
To guarantee that certain security-critical invariants are maintained, we should add tests that fuzz our pallets and check if certain invariants remain intact (for example, the total weight of a CPMM pool is always close to 1).
To elaborate: Testing something like "If a user join and exits a pool and exits it with the same amount, the balance should not change" (see p. 8 of https://github.com/balancer-labs/balancer-core/blob/master/Trail%20of%20Bits%20Full%20Audit.pdf) doesn't really make sense with a couple of singular values, which are unlikely to discover rounding errors or provide a reliable esimate for the (hopefully negligible) change in balance. But fuzzing these types of problems might be the correct approach.