Skip to content

feat: add comprehensive invariant tests for Zenith contracts#94

Open
init4samwise wants to merge 1 commit intomainfrom
samwise/eng-1533-invariant-tests
Open

feat: add comprehensive invariant tests for Zenith contracts#94
init4samwise wants to merge 1 commit intomainfrom
samwise/eng-1533-invariant-tests

Conversation

@init4samwise
Copy link

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/:

File Coverage
ZenithInvariant.t.sol Sequencing contract - block submission bounds, chain uniqueness
PassageInvariant.t.sol Host-side passage - ETH/token entry accounting
RollupPassageInvariant.t.sol Rollup-side passage - exits/burns accounting
OrdersInvariant.t.sol Order handling - RollupOrders/HostOrders fund tracking
TransactorInvariant.t.sol L1→L2 transactions - gas tracking, forwarding

Invariants Tested (35 total)

Fund Safety:

  • ETH/token balance accounting matches entered minus withdrawn
  • Token exits equal tokens burned
  • Orders balances match initiated minus swept
  • HostOrders/Transactor hold no funds (pass-through design)

Liveness:

  • Can always receive ETH, exit tokens, initiate/fill orders
  • System can make progress

Sequencing & Settlement:

  • Only one rollup block per host block per chain
  • Block submissions bounded by block progression
  • Gas limits enforced

Access Control:

  • Admin addresses immutable

Testing

All 35 invariants pass with 50 runs × 20 call depth per invariant (5,000 fuzzing calls each).

Closes ENG-1533

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant