Skip to content

feat(vault): add fuzz harness for tag isolation and cross-contract escrow invariants (#199) - #323

Open
Dimank92 wants to merge 2 commits into
Zenith-options:mainfrom
Dimank92:feat/issue-199-vault-fuzz-harness
Open

Dimank92 wants to merge 2 commits into
Zenith-options:mainfrom
Dimank92:feat/issue-199-vault-fuzz-harness

Conversation

@Dimank92

Copy link
Copy Markdown

Summary

Closes #199

Adds a differential property and fuzz testing harness for the vault contract:

  • Randomized sequence generator over ordered operations: deposit, withdraw, transfer_tag, token allowlist toggles, integrator registration toggles, and cross-contract options settlement simulations.
  • Dual-ledger differential testing: maintains an in-harness reference ledger, asserted for strict equality against on-chain contract state after every step.
  • Tag Isolation Invariant: asserts that no operation on tag A modifies tag B's balance.
  • Total Conservation Invariant: asserts that contract total escrowed equals the sum of individual tag balances across all tokens.
  • Atomic Rollback Invariant: asserts that failing operations cause zero state changes (no partial balance mutations).
  • Deterministic seed set: runs across seeds 1337, 42, 9999, 0xcafebabe, 0xdeadbeef for predictable, fast CI execution (<6s) plus a high-iteration #[ignore] test for nightly/extended fuzzing.
  • Harness Soundness Test: includes negative test test_fuzz_harness_catches_tag_isolation_violation verifying that the harness reliably detects and fails closed on deliberate tag isolation tampering.

Test Verification

All 78 unit, adversarial, and fuzz tests in zenith-vault pass cleanly:

test result: ok. 78 passed; 0 failed; 11 ignored; 0 measured; 0 filtered out; finished in 5.88s

Payout Address

  • Wallet: 0xC345C07229307d4f1c7935aD2cAe48e390215808
  • Network: Polygon / Base / Arbitrum / Stellar

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.

Add a Fuzz Harness for vault Tag Isolation and Cross-Contract Escrow Invariants

1 participant