igneum/infra/devnet/restart-seed.sh

42 lines
4.1 KiB
Bash
Executable file

#!/usr/bin/env bash
# Moves the seed (188.245.5.161, systemd unit igneumd-v4) to the 2b6d23ef Linux node and restarts it with the
# override file given as ONE JSON argument, the same object as restart-hand-nodes.sh and the manifest's
# consensus.override. The binary is the Linux cross-build of fork 2b6d23ef recorded in docs/plans/release-0.3.6.md
# 8e; superseded in 0.3.9, see below. Ends by printing the unit state and the fee and digest lines.
# infra/devnet/restart-seed.sh '{"difficulty_v2_activation_daa":33000,"proving_v0_activation_daa":84100,"fees_v1_activation_daa":210000}'
set -euo pipefail
OVJSON="${1:?override JSON object}"
# 0.3.9 (5 October 2026): the seed is Debian 12 (glibc 2.36) and refuses the PC 1 build (glibc 2.38/2.39: "GLIBC_2.38 not
# found"), so the binary is the Mac zig cross-build of the fork tip (infra/cross/build-linux.sh, glibc 2.36 target);
# IGNEUMD_LINUX names it and IGNEUMD_LINUX_SHA256 its sha256 (the defaults are the 0.3.9 build of a24ab01a).
SRC="${IGNEUMD_LINUX:-/Users/joshm/Projects/igneum/infra/cross/out-039/igneumd}"
WANT="${IGNEUMD_LINUX_SHA256:-7e26e374586ad8ba539e371c6cbbd74f0f77aee1e2e97cd25f0182fcbda458a5}"
echo "$OVJSON" | python3 -c 'import json,sys; o=json.load(sys.stdin); assert isinstance(o, dict) and "fees_v1_activation_daa" in o; print("override:", json.dumps(o, sort_keys=True))'
test "$(shasum -a 256 "$SRC" | cut -c1-64)" = "$WANT" || { echo "$SRC is not the 2b6d23ef Linux node ($WANT)"; exit 1; }
SSH="ssh -i $HOME/.ssh/igneum_ed25519 -o ConnectTimeout=20 root@188.245.5.161"
# 6 October 2026 (the exec recovery after the 15:44Z reorg): IGNEUMD_EXEC_SNAPSHOT_FILE=<local file> copies that exec snapshot to the
# seed (/root/v4/exec-snapshot.bin) and adds --igneum-exec-snapshot=<path>,0x<sha256> to EXTRA_ARGS in seed-v4.env (replacing an
# earlier one); IGNEUM_EXEC_RESET=1 deletes the seed's persisted exec files (the tip-0 file a genesis replay writes, and the .prev)
# while the unit is stopped. Both off by default.
SNAPF="${IGNEUMD_EXEC_SNAPSHOT_FILE:-}"; SNAPSHA=""
if [ -n "$SNAPF" ]; then SNAPSHA="$(shasum -a 256 "$SNAPF" | cut -c1-64)"; scp -i "$HOME/.ssh/igneum_ed25519" "$SNAPF" root@188.245.5.161:/root/v4/exec-snapshot.bin && ssh -i "$HOME/.ssh/igneum_ed25519" root@188.245.5.161 "install -o igneum -g igneum -m 644 /root/v4/exec-snapshot.bin /var/lib/igneum-v4/exec-snapshot-recovery.bin"; fi
RESET="${IGNEUM_EXEC_RESET:-0}"
scp -i "$HOME/.ssh/igneum_ed25519" "$SRC" root@188.245.5.161:/root/v4/out/igneumd.039
$SSH "set -e
test \"\$(sha256sum /root/v4/out/igneumd.039 | cut -c1-64)\" = $WANT
cp -p /opt/igneum/v4/bin/igneumd /opt/igneum/v4/bin/igneumd.prev-2b6d23ef
cp /root/v4/out/igneumd.039 /opt/igneum/v4/bin/igneumd.new && chmod +x /opt/igneum/v4/bin/igneumd.new
cp -p /etc/igneum/override-v3.json /etc/igneum/override-v3.json.prev-\$(date -u +%Y%m%dT%H%M%SZ) || true
printf '%s\n' '$OVJSON' > /etc/igneum/override-v3.json
grep -qE '^EXTRA_ARGS=\"?--override-params-file=/etc/igneum/override-v3.json' /etc/igneum/seed-v4.env
systemctl stop igneumd-v4
if [ '$RESET' = 1 ]; then rm -f /var/lib/igneum-v4/igneum-devnet/datadir/evm/exec-snapshot.bin /var/lib/igneum-v4/igneum-devnet/datadir/evm/exec-snapshot.prev.bin; echo 'exec files reset on the seed'; fi
if [ -n '$SNAPSHA' ]; then test \"\$(sha256sum /var/lib/igneum-v4/exec-snapshot-recovery.bin | cut -c1-64)\" = $SNAPSHA; python3 -c 'import sys,re; p=\"/etc/igneum/seed-v4.env\"; t=open(p).read(); out=[]
for l in t.split(\"\\n\"):
if l.startswith(\"EXTRA_ARGS=\"): l=\"EXTRA_ARGS=\\\"--override-params-file=/etc/igneum/override-v3.json --igneum-exec-snapshot=/var/lib/igneum-v4/exec-snapshot-recovery.bin,0x$SNAPSHA\\\"\"
out.append(l)
open(p,\"w\").write(\"\\n\".join(out))'; grep -E '^EXTRA_ARGS=' /etc/igneum/seed-v4.env | cut -c1-160; fi
mv -f /opt/igneum/v4/bin/igneumd.new /opt/igneum/v4/bin/igneumd
systemctl start igneumd-v4
sleep 10; systemctl is-active igneumd-v4; systemctl show -p ActiveEnterTimestamp,MainPID igneumd-v4
journalctl -u igneumd-v4 --no-pager -n 80 -o cat | grep -E 'igneumd/2.1.0-|Calibrated v1 fees from the override file|Fees on igneum-devnet|Consensus params digest' | tail -4"