db-16 — Execution

One-shot: prove the lab works

cd db-16-distributed-fundamentals
./scripts/verify.sh        # all unit tests in Rust, Go, C++
./scripts/cross_test.sh    # byte-identical event logs across all three

A green run of cross_test.sh ends with the literal line:

=== ALL OK ===

Per-language workflows

Rust

cd src/rust
cargo test                # 7 tests
cargo build --release     # produces target/release/simctl
./target/release/simctl --seed 42 --nodes 3 --rounds 20 > /tmp/log_rust.bin

Go

cd src/go
go test ./...             # 7 tests
go build -o /tmp/simctl_go ./cmd/simctl
/tmp/simctl_go --seed 42 --nodes 3 --rounds 20 > /tmp/log_go.bin

C++

cd src/cpp
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
ctest --test-dir build   # test_db16 → "db-16 C++ tests: 7 passed"
./build/simctl --seed 42 --nodes 3 --rounds 20 > /tmp/log_cpp.bin

CLI

All three binaries accept the same flags:

flagdefaultmeaning
--seed N0splitmix64 seed
--nodes K3number of nodes; must be ≥ 2
--rounds R20number of send-rounds (sim time runs for R + MAX_DELAY ticks)

The output is the binary wire format described in CONCEPTS.md. Pipe to a file; do not display on a terminal.

Canonical scenarios

scripts/cross_test.sh runs two scenarios; their sha256s are checked into the lab's verification path:

labelargssha256
A--seed 42 --nodes 3 --rounds 200d7e753cdc891e3a481977da372a4d97a6a0e0ab00b74f5a074dbc25791dc797
B--seed 7 --nodes 5 --rounds 50321221187709684afd59c55202f8d373dad33c8026e933b36740aeed23c8c2d4

If you change any of: PRNG, scheduler order, wire format, or VC entry ordering — these hashes will change and you must update both the script and this table in the same commit. That synchronization step is the forcing function that keeps the spec honest.

Sanity checks

# magic bytes
./target/release/simctl --seed 42 --nodes 3 --rounds 20 | xxd -l 8
# expect:  00000000: 4453 4536 7800 0000  DSE6x...
# 0x78 = 120 = events: 60 Sends + 60 Recvs for nodes=3 rounds=20

# event count
./target/release/simctl --seed 42 --nodes 3 --rounds 20 | \
  python3 -c 'import sys,struct; d=sys.stdin.buffer.read(); print(struct.unpack("<I", d[4:8])[0])'
# → 120