mirror of
https://github.com/logos-blockchain/research.git
synced 2026-08-07 03:33:33 +00:00
The study started as a peering-degree question and grew well past it: propagation, adversary exposure, deanonymization and time-to-link, reliability under uniform and correlated churn, messaging redundancy, and cover traffic. The pd name no longer describes it. tools/simulators/blend/pd/ -> tools/simulators/blend/, package src/pd -> src/blend, and reports/blend/pd/ -> reports/blend/. Moved with git mv so history follows. The text substitutions are deliberately narrow. pd is also the conventional pandas alias, and pandas genuinely has a pd.plotting submodule, so a blanket pd. -> blend. rewrite would have corrupted four files. Only package-unambiguous forms were changed: from pd.X, -m pd.X, pd.<our module>, PD_BYTES_BUDGET, src/pd, and the pyproject name. All four import pandas as pd lines are untouched and verified. Both READMEs reframed: peering degree is now presented as the primary axis that ties the others together rather than as the subject, and the relative links, which lost a directory level in the move, are corrected. Verified after the move: ruff clean, 101 tests, 45 verify anchors, make targets, the script shims, an end-to-end smoke run, and data/report_numbers.py still reproducing the report tables from the checked-in evidence. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
25 lines
652 B
Python
25 lines
652 B
Python
import numpy as np
|
|
|
|
from blend.mixclock import mean_residual_ms, mix_wait
|
|
|
|
|
|
def test_zero_max_delay_is_zero():
|
|
rng = np.random.default_rng(0)
|
|
w = mix_wait(rng, 0, 1000)
|
|
assert np.all(w == 0.0)
|
|
|
|
|
|
def test_residual_within_bounds():
|
|
rng = np.random.default_rng(1)
|
|
m = 5
|
|
w = mix_wait(rng, m, 100000)
|
|
assert w.min() >= 0.0
|
|
assert w.max() <= m * 1000.0 + 1e-6 # residual within a covering interval (<= M seconds)
|
|
|
|
|
|
def test_mean_matches_analytic():
|
|
rng = np.random.default_rng(2)
|
|
for m in (1, 3, 8):
|
|
w = mix_wait(rng, m, 400000)
|
|
assert abs(w.mean() - mean_residual_ms(m)) < 0.03 * mean_residual_ms(m)
|