#!/usr/bin/env bash # Runs scenario 6 (reorg under execution) for several partition durations, restarting the split network each time so # each cycle forces a reorg of a different depth. Results accumulate in results/scenario6.json. set -u HERE="$(cd "$(dirname "$0")" && pwd)" cd "$HERE" rm -f results/scenario6.json DURS="${DURS:-1 3 5 8}" for secs in $DURS; do ./net.sh stop >/dev/null 2>&1 ./net.sh start-split >/dev/null 2>&1 # Wait for both partitions to produce a block. t=0 until [ "$(curl -s -m2 -X POST http://127.0.0.1:27691 -H 'content-type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}' | grep -o '0x[0-9a-f]*' | head -1)" != "0x0" ] 2>/dev/null || [ $t -ge 40 ]; do sleep 2; t=$((t+2)); done echo "=== cycle: partition ${secs}s ===" PARTITION_SECS=$secs node scenario6_reorg.mjs done ./net.sh stop >/dev/null 2>&1 echo "=== scenario 6 depths ===" node -e "const r=require('./results/scenario6.json'); console.log('cycles:', r.cycles.map(c=>({secs:c.partitionSecs, depth:c.maxReorgDepth, pass:c.summary.pass, fail:c.summary.fail}))); console.log('totals', r.checks, 'maxDepth', r.maxReorgDepthSeen)"