mirror of
https://github.com/logos-blockchain/research.git
synced 2026-08-07 19:53:10 +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>
40 lines
1.6 KiB
Python
40 lines
1.6 KiB
Python
from blend.config import SimConfig
|
|
from blend.rng import (
|
|
graph_seedseq,
|
|
responsive_seedseq,
|
|
rng_for,
|
|
round_seedseq,
|
|
seedseq_for,
|
|
)
|
|
|
|
|
|
def test_deterministic():
|
|
c = SimConfig(n_nodes=1000, degree=8, graph_seed=3)
|
|
assert seedseq_for(c).entropy == seedseq_for(c).entropy
|
|
a = rng_for(c).integers(0, 10**9, size=5)
|
|
b = rng_for(c).integers(0, 10**9, size=5)
|
|
assert list(a) == list(b)
|
|
|
|
|
|
def test_graph_seed_is_topology_only():
|
|
base = SimConfig(n_nodes=1000, degree=8, graph_seed=3, f_adv=0.0, blend_hops=2)
|
|
same_topo = SimConfig(n_nodes=1000, degree=8, graph_seed=3, f_adv=0.4, blend_hops=5,
|
|
adversary_mode="worstcase_coverage", n_rounds=999)
|
|
assert graph_seedseq(base).entropy == graph_seedseq(same_topo).entropy
|
|
diff_topo = SimConfig(n_nodes=1000, degree=8, graph_seed=4)
|
|
assert graph_seedseq(base).entropy != graph_seedseq(diff_topo).entropy
|
|
|
|
|
|
def test_responsive_seed_depends_on_frac_only():
|
|
c = SimConfig(n_nodes=1000, degree=8, graph_seed=3)
|
|
# fixed per (topology, unresponsive_frac); different frac -> different responsive draw
|
|
assert responsive_seedseq(c, 0.1).entropy == responsive_seedseq(c, 0.1).entropy
|
|
assert responsive_seedseq(c, 0.1).entropy != responsive_seedseq(c, 0.2).entropy
|
|
|
|
|
|
def test_round_seed_includes_unresponsive_frac():
|
|
c = SimConfig(n_nodes=1000, degree=8, graph_seed=3)
|
|
a = round_seedseq(c, blend_hops=3, max_blend_delay=3, unresponsive_frac=0.0)
|
|
b = round_seedseq(c, blend_hops=3, max_blend_delay=3, unresponsive_frac=0.2)
|
|
assert a.entropy != b.entropy
|