feat: add comprehensive invariant tests for Zenith contracts#94
feat: add comprehensive invariant tests for Zenith contracts#94init4samwise wants to merge 2 commits intomainfrom
Conversation
Adds 35 invariant tests covering fund safety, liveness, and sequencing integrity across the contract suite: - ZenithInvariant.t.sol: sequencing contract invariants - PassageInvariant.t.sol: host-side passage (ETH/token entry) - RollupPassageInvariant.t.sol: rollup-side passage (exits/burns) - OrdersInvariant.t.sol: order handling (RollupOrders, HostOrders) - TransactorInvariant.t.sol: L1→L2 transaction handling All tests pass with 50 runs × 20 call depth per invariant. Closes ENG-1533
|
[Claude Code] CI Performance InvestigationThe
TransactorInvariant alone consumed ~2h 57m of the total run. All other suites finished within ~2 minutes each. Run Configuration MismatchThe PR description states "50 runs × 20 call depth" but CI actually ran with 256 runs × 500 call depth (128,000 calls per invariant). With 9 tests in TransactorInvariant, that's 1,152,000 total fuzz calls for this suite. The handler is likely much more expensive per call than the others. Consider setting a lighter CI profile (matching the intended 50 × 20) and reserving deep fuzzing for nightly/manual runs. Failing InvariantsTwo invariants failed: 1.
The fuzzer found a sequence where total withdrawals exceeded total entries. The counterexample shows a 2. This invariant asserts HostOrders holds no funds (pass-through design). The fuzzer found that after a Both failures look like test handler bugs (unbounded inputs, incorrect pass-through modeling) rather than contract bugs — but worth verifying. |
Summary
Adds comprehensive invariant tests covering fund safety, liveness, and sequencing integrity across the Signet/Zenith contract suite.
Changes
Created 5 new test files in
test/invariant/:ZenithInvariant.t.solPassageInvariant.t.solRollupPassageInvariant.t.solOrdersInvariant.t.solTransactorInvariant.t.solInvariants Tested (35 total)
Fund Safety:
Liveness:
Sequencing & Settlement:
Access Control:
Testing
All 35 invariants pass with 50 runs × 20 call depth per invariant (5,000 fuzzing calls each).
Closes ENG-1533