Marcin Pawlowski bd2ac7b7be
Countable uncle model: spec counting rules, sweeps, figures
Implement the countable uncle model from the Cryptarchia spec's
counting-only reference rules, and make it the simulator default.

Counting rules (uncles.py, measure.py):
- Only the first block of a fork (parent on the producer's chain) is
  referenceable and countable, which makes every reference verifiable
  from chain data alone.
- The reference window is derived from a window-absorption parameter,
  w_u = W_abs/f slots (W_abs in expected block-intervals, default 10,
  bounded W_abs <= 0.6*k), replacing the free-standing uncle_window.
- Selection skips slots already occupied on the producer's chain and
  takes at most one uncle per slot.
- The measurement pass re-checks every rule per reference and tallies
  rejections as deep_ref_share.

The pre-redesign model is preserved behind --old on tsi-sweep and
tsi-verify. Its RNG key is byte-identical to the pre-uncle_model key,
so --old bit-reproduces the historical runs.

Supporting changes: uncle_model and window_absorption config surface
with validation (config.py, constants.py); accuracy closed form over
the effective q_u (theory.py); plumbing through tsi.py, epoch.py,
sweep.py, blocktree.py, metrics.py, verify.py, figures_pernode.py.

Studies and figures:
- configs/countable-vs-old.yaml -- delay x U grid, run under both
  models on the same grid.
- configs/absorption-window.yaml -- accuracy vs W_abs at U=1.
- scripts/plot_countable_vs_old.py renders fig30-fig33 into
  reports/tsi/report-figures/.

Tests: tests/test_countable_counting.py (7 cases) covering first-fork
eligibility, derived-window bounds, occupied-slot exclusion, and
per-reference re-checking; extensions to test_uncles.py,
test_config.py, test_slot_counting.py. Full fast suite: 202 passed.

Also adds CLAUDE.md (graphify project instructions) and ignores
editor/local-agent state plus the vendored Equi-X benchmark clone.

The reports/tsi/ prose describing this model is held back for a
separate editorial pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04 18:48:46 +02:00
..

Total-Stake-Inference parameter selection

Per-node network simulation of Cryptarchia Total Stake Inference (TSI). Simulator: tsi-sim-pernode. All runs at the true security parameter k = 2160 unless noted; latency is in slots and 1 slot = 1 s.

This report selects and justifies the TSI parameters for Cryptarchia from a per-node network simulation. It is split into four cohesive parts; section numbers (§1§9, AC) are stable identifiers preserved across the set.

Parts

  1. Overview and recommendations — the executive summary, the per-knob parameter reference (§7), and the safest selection with residual risks and the recommendation-vs-spec deltas (§8).
  2. Accuracy and design — the model and counting rule (§2), the seven findings and their evidence (§3), the design equations and selection algorithm (§4), and the caveats and regime of validity (§5).
  3. Robustness and incentives — jitter, grinding, withholding, selfish mining, the reward design, fork/reorg depth, and organic churn (§6).
  4. Reproducibility and appendices — how to re-run every study (§9), the residual f-rounding offset (App A), the per-epoch noise floor (App B), and consensus detail (App C).

Headline recommendation

Cryptarchia baseline f = 1/30. Two design choices are foundational: count uncles per occupied slot, not per block — the density-bug fix that lands the estimate at exactly D (§2.1, §8.5) — and make genesis a single protocol constant, identical at every node, never client-configurable, since a per-node divergence is never self-corrected (§8.1 row 7). The settings: security k = 2160, uncle window W = 300 slots, uncle cap U ≥ ⌈ρ⌉ + 1 (2 at the Blend target; the protocol's MAX_UNCLES = 4 sits safely above it), learning rate β = 1, on-chain f at 10⁻⁶ precision, peering degree ≥ 6 at scale, soft uncle rewards with w_u + w_n < 1, and operate at load ρ = f·D_vis < 1. The full recommended-configuration table and rationale are in Part 1 →.

Figures

Figures are embedded from report-figures/ via relative links and are versioned here alongside the report. They are produced by the simulator's plotting scripts (scripts/*.py and tsi_sim.plotting) in tsi-sim-pernode; that simulation folder does not commit its own generated figures — the copies checked in here are the report's figures of record.

Reproducing the results

The simulation code, configs, and run data live in tools/simulators/tsi/tsi-sim-pernode. Every study's exact command is listed in Part 4 — Reproducibility (§9). In short, from the simulator directory: make install, then make <config> to run a sweep (results land under runs/<timestamp>_<label>/), and the per-figure generators under scripts/ render the figures. Regenerated figures must be copied into report-figures/ to update this report.