nigig-org/crates/nigig-pay-domain/benches/BASELINE.md
andodeki 01bc055d1e
Some checks failed
Payment domain and storage / isolated-payment-tests (push) Has been cancelled
feat(pay): complete the partially-done review phases
No new phase was started. This finishes every item tranches 1-2 left
partial, so Phases 1, 3, 7 and 8 are complete for the two pure crates or
explicitly blocked on crates that cannot be built here.

Phase 1 (build governance):
- Check in Cargo.lock for both payment crates and build with --locked.
  .gitignore excluded them, which would have made item 1.1 a false claim.
- tools/test-rust-clean.sh now reads the channel from rust-toolchain.toml
  instead of a hardcoded default that had already drifted, and gates on
  fmt, clippy -D warnings, the sqlcipher feature and the benchmarks.
- CI enforces lockfile presence/freshness and a Makepad-boundary check that
  inspects manifests and use/extern lines rather than prose (1.4).

Building on the declared 1.97.1 toolchain surfaced five lints 1.85 missed;
all are fixed. The two Default impls are annotated rather than derived
because each encodes a security or state-machine decision.

Phase 3 (secure repository):
- 3.1 encryption at rest: new encryption.rs and an opt-in sqlcipher feature.
  PRAGMA key is applied first and verified by a forced read, so a wrong key
  fails as KeyRejected rather than as corruption. DatabaseKey redacts its
  Debug and zeroes on drop. No key is ever derived or persisted here, and
  there is no unencrypted fallback. A test asserts the recipient MSISDN is
  absent from the raw database bytes.
- 3.5: preferences.rs replaces the ANDROID_DATA marker file whose existence
  was the value; every field fails safe.
- 3.6: redact.rs. PaymentIntent's derived Debug leaked a customer MSISDN
  into any log line; it now masks phone, name and ids, with a regression
  test. StorageError no longer prints a full intent id.

Phase 7:
- 7.7 benchmarks over money, validation, fees, the intent lifecycle and
  evidence handling, using the stable harness so they run on the pinned
  toolchain. BASELINE.md records measured output.
- 7.1/7.2/7.3 verified already satisfied; the review text is stale.

Phase 8:
- 8.1 simulator.rs with a scripted gateway and biometric, no clock or I/O.
- 8.2 property tests over every permutation of a representative event set:
  no ordering dispatches twice, untrusted events never settle a payment,
  ambiguity never becomes failure, Confirmed is terminal, duplicate
  confirmations are idempotent, and replayed SMS cannot fake a conflict.

Validated on rustc 1.97.1 outside the incomplete workspace graph:
domain 66 tests, storage 20 tests, storage+sqlcipher 25 tests, fmt clean,
clippy -D warnings clean on both crates and both feature sets, benches run.
49 manifests parse; git diff --check clean.

Still unclaimed and blocked on uncompilable crates: UI wiring, Keystore key
provisioning, Phase 4 draw_walk I/O, Phase 5 adapters and legal review, the
Java PIN scrub, and B1/B4/B6 in nigig-core.
2026-07-27 15:07:28 +00:00

1.2 KiB

nigig-pay-domain benchmark baseline

Recorded to satisfy review item 7.7, which requires benchmarks to exist and to have checked-in output rather than an untested harness.

toolchain: rustc 1.97.1 (8bab26f4f 2026-07-14)
profile:   release (cargo bench)
host:      x86_64-unknown-linux-gnu, shared CI-class container

Absolute numbers depend on the machine; treat them as a regression tripwire on the same host, not a cross-machine target.

nigig-pay-domain benchmarks (pure domain, no I/O)
------------------------------------------------------------------------------------------------
money_format_ksh                              100000 iters       3.927ms total    39.000ns/op
validate_100_phone_numbers                      1000 iters       8.338ms total     8.337µs/op
compute_100_fee_quotes                          1000 iters       1.001ms total     1.001µs/op
drive_1000_intents_through_lifecycle             100 iters      57.460ms total   574.601µs/op
digest_1000_sms_bodies                           100 iters      41.924ms total   419.235µs/op
record_200_evidence_entries                      500 iters      46.952ms total    93.903µs/op
------------------------------------------------------------------------------------------------
done