Files
zeekayandHanzo AI 15131f6af4
CI/CD / render (push) Waiting to run
chain letters are lowercase
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]>
2026-09-08 15:23:20 -07:00

69 lines
3.0 KiB
Bash
Executable File

#!/bin/sh
# boot.sh — deterministic BOOT proof on a disposable lux-CLI localnet.
#
# Brings a fresh network up FROM GENESIS, drives a real DEX fill through the
# 0x9999 money path with the proven `trader` binary, then runs the boot GATE
# (verify.sh) which asserts: chainId, booted-past-genesis, 0x9999 active+settled,
# a DEXFill emitted, and all validators converge on one block hash.
#
# Disposable target ONLY — never point this at a live net (it wipes + writes).
#
# Env:
# LUXD path to a v1.31.2 luxd binary (REQUIRED for a real boot;
# default: ~/work/lux/node/build/luxd). Use the locked-in spec.
# N validators (default 5 — matches the production spec)
# NET lux CLI network flag (default: --dev, K-of-N turbo localnet)
# CHAIN_ID expected EVM chain id for the localnet (default 1337)
# RPC_BASE base http port the CLI assigns node 0 (default 9650)
# LUX_MNEMONIC funded mnemonic (default: canonical test mnemonic)
set -e
DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
LUXD="${LUXD:-$HOME/work/lux/node/build/luxd}"
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 "boot.sh: lux CLI not on PATH" >&2; exit 2; }
[ -x "$LUXD" ] || { echo "boot.sh: luxd binary not found/executable at $LUXD (set LUXD=)" >&2; exit 2; }
echo "[boot] luxd=$LUXD ($($LUXD --version 2>/dev/null | head -1))"
echo "[boot] lux network start $NET --num-validators=$N (fresh genesis)"
lux network clean >/dev/null 2>&1 || true
lux network start $NET --num-validators="$N" --node-path "$LUXD"
# Wait for the network to report healthy.
i=0
until lux network status 2>/dev/null | grep -qiE "healthy|running"; do
i=$((i + 1)); [ "$i" -ge 120 ] && { echo "[boot] network did not become healthy in 120s" >&2; exit 1; }
sleep 1
done
echo "[boot] network healthy after ${i}s"
# Discover responsive C-Chain endpoints (one per validator). Probe RPC_BASE..+N-1.
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"
if 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; then
EPS="${EPS:+$EPS,}$url"; n=$((n + 1))
fi
p=$((p + 1))
done
[ -n "$EPS" ] || { echo "[boot] no C-Chain RPC endpoints found from :$RPC_BASE (set RPC_BASE=)" >&2; exit 1; }
echo "[boot] endpoints: $EPS"
# Drive a real fill from genesis through 0x9999 (deploy 2 ERC-20s, open market,
# maker rests, taker swaps, assert DEXFill) — the destructive leg.
FIRST=$(printf %s "$EPS" | cut -d, -f1)
echo "[boot] trader prove -> $FIRST"
trader --rpc "$FIRST" prove
# Gate: assert the boot is known-good and all validators converge.
LUX_RPC="$EPS" LUX_CHAIN_ID="$CHAIN_ID" LUX_FROM_BLOCK=0 LUX_REQUIRE_FILL=1 sh "$DIR/verify.sh"
echo "[boot] BOOT proof GREEN ✓"