closedhumanPR #311Coordination

Add Byzantine fault tolerance scenarios for grid frequency regulation

consensus.yaml only tolerates dropped acks (crash/omission); nandatown has no Byzantine model, and the README explicitly disclaims byzantine_agents as "not modeled." This adds one.

Author

Status
Closed without merging
Opened on
Oct 12
Branch
feat/grid-bft-byzantine-frequency-regulation

Description

The pitch.

## Summary

`consensus.yaml` only tolerates dropped acks (crash/omission); nandatown has no Byzantine model, and the README explicitly disclaims `byzantine_agents` as "not modeled." This adds one.

- New `grid_node` role implementing **Bracha reliable broadcast** (propose → echo → ready → deliver; quorum `n-f`; amplify at `f+1`), which tolerates a Byzantine *sender* and Byzantine *receivers* at once, unlike the existing single-proposer consensus scenario.
- A Byzantine node is defined purely by an `equivocation` config block (which peers get which value, at every broadcast it makes) — identical protocol timing to an honest node, only the content it sends differs.
- Three scenarios, framed as grid frequency regulation, `n=4`, tolerance `f=1`:
  - `grid_bft_byzantine_voter` — one substation lies to everyone; the honest nodes still agree on the controller's real proposed action.
  - `grid_bft_byzantine_controller` — the proposer itself lies, splitting the substations; honest nodes still converge via ready-amplification.
  - `grid_bft_double_fault` — two Byzantine nodes at once, deliberately past `f=1`; two honest nodes verifiably commit *different* actions. Its `agreement` stage is expected to fail — that failure is the evidence the `n>=3f+1` boundary was actually crossed, not a town malfunction.
- New `grid_bft` validator: checks agreement/validity among honest nodes only (Byzantine-ness is read from scenario config, never inferred from behavior).
- `tests/test_sim.py`'s closed-world `ALL_SCENARIOS`/`FAILING_SCENARIOS` lists updated accordingly.

## Test plan

- [x] `pytest tests/test_lab_grid_bft.py` — 12 new tests, all passing
- [x] `pytest tests/test_sim.py` — updated scenario-presence lists, passing
- [x] Full suite: 1743 passed, 26 skipped; the 19 remaining failures are pre-existing on `main` (Windows symlink/filesystem-permission tests), confirmed identical with this branch's changes stashed out
- [x] All three scenarios run end-to-end via `run_lab`, including bundle export and HMAC signature verification (`verify_bundle(...) == []`)

Try it

Open PR on GitHubView diff

Checkout locally

git fetch origin pull/311/head:pr-311
git checkout pr-311