42 lines
4.4 KiB
Bash
Executable file
42 lines
4.4 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Restarts the two hand-run devnet nodes on this Mac (the observer, then node 1) on the 2b6d23ef node binary with
|
|
# the override file given as ONE JSON argument, the exact object the update manifest's consensus.override carries
|
|
# (docs/plans/fee-switch-devnet.md). Both nodes must print the same consensus digest as every app node before the
|
|
# fee switch height, or the handshake splits the network (docs/plans/release-0.3.6.md section 7).
|
|
# infra/devnet/restart-hand-nodes.sh '{"difficulty_v2_activation_daa":33000,"proving_v0_activation_daa":84100,"fees_v1_activation_daa":210000}'
|
|
# Ends by printing the new pids with their start times and the fee and digest lines of each node (5 October 2026
|
|
# lesson: a restart script that does not print the new pids has not proven the restart).
|
|
set -euo pipefail
|
|
OVJSON="${1:?override JSON object}"
|
|
BIN="${IGNEUMD:-/Users/joshm/Projects/igneum/vendor/igneum-node/target-036/release/igneumd}"
|
|
# the fork commit the binary must carry (0.3.9: a24ab01a, release-0.3.6 with txgen-export; 2b6d23ef read the switch too)
|
|
COMMIT="${IGNEUMD_COMMIT:-a24ab01a}"
|
|
OV=/tmp/igneum-devnet/override-v3.json
|
|
# 6 October 2026 (the exec recovery after the 15:44Z reorg): IGNEUMD_EXEC_SNAPSHOT="<path>,<sha256>" adds --igneum-exec-snapshot
|
|
# to both nodes (the exec state to start from when the data dir's own file is bad or missing); IGNEUM_EXEC_RESET=1 deletes each
|
|
# node's persisted exec files (exec-snapshot.bin, the tip-0 file a genesis replay writes, and exec-snapshot.prev.bin) after the
|
|
# stop, so the start takes the flag's file and not the bad one. Both off by default.
|
|
SNAP="${IGNEUMD_EXEC_SNAPSHOT:-}"; SNAPARG=""; [ -n "$SNAP" ] && SNAPARG="--igneum-exec-snapshot=$SNAP"
|
|
reset_exec() { if [ "${IGNEUM_EXEC_RESET:-0}" = 1 ]; then rm -f "$1/igneum-devnet/datadir/evm/exec-snapshot.bin" "$1/igneum-devnet/datadir/evm/exec-snapshot.prev.bin"; echo "exec files reset under $1"; fi; }
|
|
echo "$OVJSON" | python3 -c 'import json,sys; o=json.load(sys.stdin); assert isinstance(o, dict) and "fees_v1_activation_daa" in o, "the object must carry fees_v1_activation_daa"; print("override:", json.dumps(o, sort_keys=True))'
|
|
# grep -c, not grep -q: -q closes the pipe early and pipefail turns strings' SIGPIPE into a refusal of a good binary (5 October 2026, 17:48Z)
|
|
[ "$(strings "$BIN" | grep -c "$COMMIT")" -gt 0 ] || { echo "$BIN is not the $COMMIT node (a 0.3.5 node refuses an override file with fees_v1_activation_daa)"; exit 1; }
|
|
cp -p "$OV" "$OV.prev-$(date -u +%Y%m%dT%H%M%SZ)" 2>/dev/null || true
|
|
printf '%s\n' "$OVJSON" > "$OV"
|
|
# the pid is an igneumd process, never a shell whose command line carries the pattern's text (6 October 2026: pgrep -f matched the
|
|
# caller's own zsh -c "..." and the stop waited 11 minutes on it)
|
|
stop() { local p; p=$( { for c in $(pgrep -f "$1" || true); do if [ "$(ps -o comm= -p "$c" 2>/dev/null | xargs basename 2>/dev/null)" = igneumd ]; then echo "$c"; fi; done; true; } | head -1 ); if [ -n "$p" ]; then kill -INT "$p"; while kill -0 "$p" 2>/dev/null; do sleep 1; done; fi; } # the filter never fails the pipeline (17:43Z: a trailing caffeinate pid made the loop exit 1 and set -e ended the script before node 1)
|
|
lines() { sleep 10; grep -E "Calibrated v1 fees from the override file|Fees on igneum-devnet|Consensus params digest" "$1" | tail -3 || true; }
|
|
# the observer first
|
|
stop "igneumd --devnet.*observer-v4"
|
|
reset_exec /tmp/igneum-devnet/observer-v4
|
|
nohup "$BIN" --devnet --nodnsseed --disable-upnp --appdir=/tmp/igneum-devnet/observer-v4 --rpclisten=127.0.0.1:26640 --rpclisten-json=127.0.0.1:28640 --listen=127.0.0.1:26641 \
|
|
--addpeer=127.0.0.1:26611 --addpeer=188.245.5.161:26611 --addpeer=192.168.68.67:26611 --override-params-file="$OV" $SNAPARG --nologfiles --yes >> /tmp/igneum-devnet/observer-v4.out 2>&1 &
|
|
lines /tmp/igneum-devnet/observer-v4.out
|
|
# node 1, under caffeinate as it runs today
|
|
stop "igneumd --devnet.*appdir=/tmp/igneum-devnet/node1 "
|
|
reset_exec /tmp/igneum-devnet/node1
|
|
nohup caffeinate -dims "$BIN" --devnet --nodnsseed --disable-upnp --enable-unsynced-mining --appdir=/tmp/igneum-devnet/node1 --rpclisten=0.0.0.0:26610 --listen=0.0.0.0:26611 --evm-rpclisten=127.0.0.1:26791 \
|
|
--addpeer=188.245.5.161:26611 --addpeer=192.168.68.67:26611 --override-params-file="$OV" $SNAPARG --nologfiles --yes >> /tmp/igneum-devnet/node1.out 2>&1 &
|
|
lines /tmp/igneum-devnet/node1.out
|
|
echo "running now:"; ps -o pid=,lstart=,command= -p "$(pgrep -f 'igneumd --devnet' | tr '\n' ',' | sed 's/,$//')" | cut -c1-160
|