Marcin Pawlowski 0f125b40c6
pd: correlated AS/region churn, and two report caveats corrected
Uncorrelated churn alone was incomplete: real outages take out a datacentre, AS
or region as a unit. Adds failure domains and a correlated churn mode, plus the
metric needed to tell the two apart.

- n_regions / region_locality: nodes belong to equal-sized failure domains, and
  a configurable share of each node peers inside its own domain. Locality is what
  makes a failure domain a connectivity domain -- with region-blind peering,
  dropping whole regions removes a uniformly random set of nodes and is
  indistinguishable from uniform churn. The locality matchings keep the graph
  exactly d-regular (they change where peers are, never how many).
- churn_mode = uniform | regional, swept per topology so both modes are compared
  on the same graph at an identical dead-node count.
- frac_reached_live: coverage of the *responsive* network, alongside coverage of
  all nodes. The two move in opposite directions under correlated failure, so one
  number could not express the result.

Measured (degree 4, 20 domains, 75% locality, half the network dead): clustered
failure leaves the survivors fully connected -- live coverage 1.000 and delivery
equal to the live-relay rate, i.e. nothing lost to routing -- where the same
number of scattered failures gives 0.857 live coverage and loses delivery to
broken routes. Correlated outages are gentler on the survivors than uniform
churn, while stranding the dead domains. Verify check 8 anchors this.

Also, per review of the caveats: exact d-regularity is a protocol requirement
rather than a modelling simplification, and the timing-correlation adversary is
deferred because it is only meaningful once the network emits cover traffic,
which this simulator does not yet do.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-06 17:59:56 +02:00

55 lines
1.7 KiB
Makefile

VENV ?= .venv
PY := $(VENV)/bin/python
STAMP := $(VENV)/.installed
# Keep numpy/scipy BLAS single-threaded so joblib process parallelism doesn't oversubscribe.
export OMP_NUM_THREADS := 1
export OPENBLAS_NUM_THREADS := 1
export MKL_NUM_THREADS := 1
export NUMEXPR_NUM_THREADS := 1
.PHONY: install smoke sweep sweep-fullscale redundancy percolation correlated-churn figures verify test lint clean
# The stamp is the real install; targets below depend on it so `make sweep` (etc.) auto-installs
# on a fresh checkout and re-installs whenever pyproject.toml changes.
$(STAMP): pyproject.toml
python3 -m venv $(VENV)
$(PY) -m pip install -U pip
$(PY) -m pip install -e ".[dev]"
@touch $(STAMP)
install: $(STAMP)
smoke: $(STAMP) ## fast end-to-end (seconds): tiny N, few rounds/seeds
$(PY) -m pd.sweep --config configs/smoke.yaml
sweep: $(STAMP)
$(PY) -m pd.sweep --config configs/default.yaml
sweep-fullscale: $(STAMP)
$(PY) -m pd.sweep --config configs/fullscale.yaml
redundancy: $(STAMP) ## messaging redundancy R=1..4 (delivery vs deanonymization, time-to-link)
$(PY) -m pd.sweep --config configs/redundancy.yaml
percolation: $(STAMP) ## churn threshold: coverage collapse at u_c = 1 - 1/(degree-1)
$(PY) -m pd.sweep --config configs/percolation.yaml
correlated-churn: $(STAMP) ## correlated AS/region outages vs uniform churn, matched fractions
$(PY) -m pd.sweep --config configs/correlated-churn.yaml
figures: $(STAMP) ## make figures RUN=runs/<dir>
$(PY) -m pd.plotting.make_figures --run $(RUN)
verify: $(STAMP)
$(PY) -m pd.verify
test: $(STAMP)
$(PY) -m pytest
lint: $(STAMP)
$(VENV)/bin/ruff check src scripts tests
clean:
rm -rf runs/* figures/* .pytest_cache .ruff_cache .mypy_cache