@heueristik brought up the following points while reviewing #235 :
- Reduce the number of fuzzed variables. Constrain them only at the beginning of tests and don’t reset/replace/overwrite them in deeper levels of the test.
- Split delta generation code from tests into a separate contract (and later into a library containing only internal pure functions). The delta generation library code can check inputs and throw custom errors but can not contain fuzzing variable constraints.
- Remove the dependency of the delta proof generation code on vm (tests can and should still use vm)
- Move vm.assume(...) and bound(...) statements to the beginning of the fuzzing tests and deduplicate them. If they repeat, encapsulate them into functions with a meaningful names.
- Try to use elliptic curve library functions instead of vm.createWallet or vm.sign. Note that we can bring more functions from import {EllipticCurve} from "@elliptic-curve-solidity/contracts/EllipticCurve.sol"; into library EllipticCurveK256 if this is needed.
- Encapsulate repeated test code into functions.
- Rework the instance struct and replace int256 quantity by uint128 quantity and bool consumed
- This should also simplify the transformations that need to be done
@heueristik brought up the following points while reviewing #235 :