Chaos Testing & Devnet Scenarios
Overview
Section titled “Overview”Ashen ships two complementary chaos tools:
devnetbinary: quick deterministic simulations with latency/loss knobs.devnet_replaytests: scripted scenarios with golden-state checks.
Use devnet for fast iteration and devnet_replay for regression coverage and
state-root determinism.
Quick Chaos Runs (devnet binary)
Section titled “Quick Chaos Runs (devnet binary)”just devnet-smalljust devnet-chaosdevnet-chaos injects packet loss and latency via env vars:
DEVNET_SUCCESS_RATE=0.9 \DEVNET_LINK_LATENCY_MS=25 \DEVNET_LINK_JITTER_MS=10 \just devnet-chaosSee /guides/devnet/ for the full parameter list.
Deterministic Scenario Suite (devnet_replay)
Section titled “Deterministic Scenario Suite (devnet_replay)”Run the full suite:
cargo test --test devnet_replayRegenerate goldens:
REGENERATE_GOLDENS=1 cargo test --test devnet_replayRun a single scenario by test name:
cargo test --test devnet_replay baseline_4_validators_happy_pathcargo test --test devnet_replay network_partition_and_healGolden files live under tests/goldens/ and assert state-root stability across
nodes and runs.
Scenario Catalog (Common)
Section titled “Scenario Catalog (Common)”These scenarios are defined in tests/devnet_replay.rs:
| Scenario | What it stresses |
|---|---|
baseline_4v_happy | 4 validators, happy path |
baseline_2v_happy | 2 validators, happy path |
partition_heal | network split + heal |
high_latency | sustained high latency |
lossy_network | packet loss |
high_jitter | reordering and jitter |
delayed_link_0_to_1 | targeted slow link |
node_crash_recovery | node isolate + restore |
silent_byzantine | node receives but stops sending |
leader_isolation | isolate leader and observe handoff |
cascading_failures | sequential node isolation |
txpool_burst | burst transaction load |
sustained_tx_load | continuous tx pressure |
combined_stress | mixed network + tx stress |
soak_* | long-running soak variants |
replay_* | record/replay determinism |
See the test file for the complete list and parameters.
Network Events Used by Scenarios
Section titled “Network Events Used by Scenarios”The scenario harness supports these events:
Partition { at_step, partitioned_nodes }HealPartition { at_step }ModifyLink { at_step, from_node, to_node, latency_ms, jitter_ms, success_rate }IsolateNode { at_step, node_idx }RestoreNode { at_step, node_idx }SilenceNode { at_step, node_idx }
These events are applied at deterministic steps, making failures reproducible under a fixed seed.
- Use a fixed
seedfor reproducibility. - Keep
stepssmall when iterating; increase for soak tests. - Use
-- --nocaptureto see detailed logs from the test runner.
Related
Section titled “Related”/guides/devnet/for devnet binary usagetests/devnet_replay.rsfor scenario definitionstests/goldens/for golden outputs