Skip to content

Add property-based test for byte-identical replay determinism #67

@joaquinbejar

Description

@joaquinbejar

Overview

Add property-based test ensuring byte-identical replay determinism: given the same ordered input stream, the engine produces identical execution reports and market-data messages, including sequence numbers, reject codes, and prices. Use proptest to generate random order sequences.

Context

  • Files: tests/unit/, src/orderbook/sequencer/
  • Related issue: global engine_seq monotonic across streams
  • Sequencer already supports journal + replay; this test validates round-trip correctness
  • Invariant: replay(snapshot, journal) ≡ live(snapshot, orders)

Acceptance criteria

  • cargo clippy --all-targets --all-features -- -D warnings clean
  • cargo fmt --all --check clean
  • cargo test --all-features clean (including property tests)
  • cargo build --release clean
  • Property test: prop_replay_determinism runs 50 cases, all pass
  • Test emits one failure example (seed, sequence) on first fail for debugging
  • Invariant check: no seq gaps, maker price == trade price
  • snapshots_match oracle confirms snapshot + replayed journal match initial state

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestperformanceHot-path optimization, benchmarks, tail latency

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions