CI/CD / render (push) Waiting to run
The primary-network chains answer to either case; one spelling beats two. /v1/chain/c/rpc, /v1/chain/p, /v1/chain/x across the estate. Co-authored-by: Hanzo AI <[email protected]>
66 lines
3.0 KiB
Bash
Executable File
66 lines
3.0 KiB
Bash
Executable File
#!/bin/sh
|
|
# upgrade.sh — deterministic UPGRADE proof.
|
|
#
|
|
# Boots a running net on FROM_LUXD, rolls every validator to TO_LUXD (the new
|
|
# node version), un-wedges with --skip-bootstrap semantics (the lux CLI restart
|
|
# preserves chain state), and re-asserts the boot GATE: the DEX still fills and
|
|
# all validators still converge across the version change. Proves the upgrade
|
|
# path is safe — the exact maneuver mainnet/testnet need for a co-restart.
|
|
#
|
|
# Disposable target ONLY.
|
|
#
|
|
# Env:
|
|
# FROM_LUXD luxd binary to boot on (default: ~/work/lux/node/build/luxd)
|
|
# TO_LUXD luxd binary to roll to (REQUIRED — the upgrade target, e.g. v1.31.2)
|
|
# N, NET, CHAIN_ID, RPC_BASE, LUX_MNEMONIC — as boot.sh
|
|
set -e
|
|
DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
|
|
FROM_LUXD="${FROM_LUXD:-$HOME/work/lux/node/build/luxd}"
|
|
TO_LUXD="${TO_LUXD:?set TO_LUXD to the upgrade-target luxd binary (e.g. the v1.31.2 build)}"
|
|
N="${N:-5}"
|
|
NET="${NET:---dev}"
|
|
CHAIN_ID="${CHAIN_ID:-1337}"
|
|
RPC_BASE="${RPC_BASE:-9650}"
|
|
export LUX_MNEMONIC="${LUX_MNEMONIC:-know defense install season surface planet hobby borrow theory security aisle toast}"
|
|
|
|
command -v lux >/dev/null 2>&1 || { echo "upgrade.sh: lux CLI not on PATH" >&2; exit 2; }
|
|
|
|
# 1) Boot + prove on the FROM version (establishes pre-upgrade chain state).
|
|
echo "[upgrade] booting on FROM=$FROM_LUXD"
|
|
LUXD="$FROM_LUXD" sh "$DIR/boot.sh"
|
|
|
|
# 2) Roll to the TO version. `lux network stop` snapshots state; restarting with
|
|
# a new --node-path replays it — the in-place version roll. --skip-bootstrap
|
|
# (codified in the production startup.sh) is what lets a self-contained set
|
|
# come back at its own tip and reconcile via sibling-tolerant finality.
|
|
echo "[upgrade] rolling validators to TO=$TO_LUXD ($($TO_LUXD --version 2>/dev/null | head -1))"
|
|
lux network stop
|
|
lux network start $NET --num-validators="$N" --node-path "$TO_LUXD"
|
|
|
|
i=0
|
|
until lux network status 2>/dev/null | grep -qiE "healthy|running"; do
|
|
i=$((i + 1)); [ "$i" -ge 180 ] && { echo "[upgrade] net did not recover in 180s" >&2; exit 1; }
|
|
sleep 1
|
|
done
|
|
echo "[upgrade] recovered on TO version after ${i}s"
|
|
|
|
# 3) Re-discover endpoints and re-assert the gate (DEX still fills + converges).
|
|
EPS=""; n=0; p="$RPC_BASE"
|
|
while [ "$n" -lt "$N" ] && [ "$p" -lt $((RPC_BASE + 50)) ]; do
|
|
url="http://127.0.0.1:$p/v1/chain/c/rpc"
|
|
curl -s -m 3 -X POST -H 'content-type: application/json' \
|
|
--data '{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}' "$url" 2>/dev/null | grep -q result \
|
|
&& { EPS="${EPS:+$EPS,}$url"; n=$((n + 1)); }
|
|
p=$((p + 1))
|
|
done
|
|
[ -n "$EPS" ] || { echo "[upgrade] no endpoints after roll" >&2; exit 1; }
|
|
|
|
# A fresh fill AFTER the upgrade proves the money path survived the version roll.
|
|
FIRST=$(printf %s "$EPS" | cut -d, -f1)
|
|
echo "[upgrade] post-upgrade trader prove -> $FIRST"
|
|
trader --rpc "$FIRST" prove
|
|
|
|
LUX_RPC="$EPS" LUX_CHAIN_ID="$CHAIN_ID" LUX_FROM_BLOCK=0 LUX_REQUIRE_FILL=1 sh "$DIR/verify.sh"
|
|
echo "[upgrade] UPGRADE proof GREEN ✓ — DEX fills across the version roll"
|