mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 05:25:19 +00:00
New PerformanceBaselineTests measure the hot paths (Nostr inbound, BLE packet pipeline, GCS filters, delivery index, message formatting) with deterministic fixtures and logged PERF metrics - baselines, not assertions, so they cannot flake CI. The suite immediately exposed that every inbound handler ran Schnorr verification before the dedup lookup, so duplicate events - which dominate real multi-relay traffic - each paid ~0.5ms of main-actor crypto for nothing. All five handlers now do cheap rejects (kind, dedup lookup) first and only record an event as processed AFTER its signature verifies, so a forged-signature copy can never poison the dedup set and suppress the genuine event. Gift-wrap verification also moves entirely off the main actor with an atomic main-actor check-and-record. Measured: duplicate-event handling 2.2k -> 1.39M events/sec (~640x); fresh events unchanged (crypto-bound). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>