# BFT codebase map (generated from the tree at 922fb7bb7d)

- Consensus-related files found: 143 (non-test). Byte-identical duplicate groups: 22.
  The core engine exists three times (platform-gateway/, cain/substrate/, build/lib/cain/substrate/).
- **Real engine**: `platform-gateway/cain_pbft_engine_33.py` (`HardenedPBFTEngine`). It is mounted by
  `cluster_api.py` in every gateway/replica process and used by `cain_mr_client.py` to verify certificates.
- **Replica process**: the full gateway (`uvicorn main:app`) runs on each replica, bound to its WireGuard overlay address.
- **Hosted decision path**: `fabric_control_plane.py` -> `cain_mr_client.py` -> replicas; snapshot plane
  `governance_snapshot.py` + `governance_runtime.py`.
- **Library-only / not on the hosted path**: `cain_pbft_dag.py` (DAG), hybrid QC (opt-in), the fast path (OFF),
  `cain/substrate/cain_bft_consensus.py`, and the legacy `scripts/cluster*/` engines.
- **Deployed versions**: {"cain-mr-01": "81bdf841", "cain-mr-02": "948b1895", "sandbox (cain-sbx)": "15d12dab"}
  -- NONE is HEAD; HEAD includes 40b08356 (lost-send keep-alive race fix) and later changes.
