infra/fast-time/fork-gate.mjs: H1 and H2 honest and mining through every phase, B the third node; modes attack (B's key fresh, 3 of 5 CPU threads in the split), third (B at about half of the table, accepted) and partition (H1 against H2, the heavier side wins with the gate on as with it off). A reorg is read from the chain (getVirtualChainFromBlock of the pre-cut tip lists removed blocks), never from a key; blue work compared as BigInt; leftovers stopped by pid file, never by name. infra/fast-time/fork-gate-gate.mjs runs the six cases side by side (known-failed first) and is GREEN only when every case gives the verdict it must and the two partition heals agree. tools/fast-time-remote.sh runs a harness on a build box under a slot with a holder line and a JSONL row (the node binaries from a fork worktree's target on the box, results fetched back); it carries the whole-body block and is listed in the check. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
77 lines
5.6 KiB
Bash
Executable file
77 lines
5.6 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# shellcheck disable=SC2034 # the BS_* context variables are read by lib.sh
|
|
# Run a fast-time harness (infra/fast-time/*.mjs, tools/finality-attacks) ON a build box instead of the Mac (CLAUDE.md,
|
|
# 7 October 2026: nothing heavy on the Mac), under a box slot with a holder line the workers dashboard shows and one JSONL
|
|
# line in /srv/builds/_log/builds.jsonl, the way tools/build-remote.sh runs cargo. The repo worktree's HEAD goes to the box
|
|
# through the bare mirror (checked out at /srv/builds/<worktree>), the harness directories are overlaid by rsync (uncommitted
|
|
# edits travel, every written file re-stamped with touch in lib.sh's bs_overlay_dir), the command runs at the worktree root
|
|
# on the box with IGNEUMD and IGNEUM_MINER pointing at a node build already there (a fork worktree's target/release under the
|
|
# same worktree root, built by tools/build-remote.sh from that fork worktree), and the result directory comes back.
|
|
#
|
|
# tools/fast-time-remote.sh [--box N] [--priority gate|normal] --node-bin <dir on the box, or relative to the worktree root>
|
|
# [--fetch <dir relative to the worktree root>] [--label <text>] -- <command at the worktree root>
|
|
#
|
|
# tools/fast-time-remote.sh --priority gate --node-bin vendor/igneum-node-horizon/target/release \
|
|
# --fetch docs/plans/mission-item-4-gate -- node infra/fast-time/fork-gate-gate.mjs
|
|
#
|
|
# Class: `--priority gate` (nice 0, the full core set, a slot ahead of queued suites; box 1: a release or mission gate) or
|
|
# normal (nice 10 on the last 32 cores like a suite, box 2 by lib.sh bs_route's attack class). The command never starts with
|
|
# cargo: build on the box first with tools/build-remote.sh from the fork worktree, then point --node-bin at its target.
|
|
# Added for mission item 4 (the fork-gate gate), 7 October 2026.
|
|
set -euo pipefail
|
|
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
# shellcheck disable=SC2034
|
|
BS_TOOL=fast-time-remote
|
|
# shellcheck source=../infra/build-server/lib.sh
|
|
. "$HERE/../infra/build-server/lib.sh"
|
|
|
|
{ # whole-body: bash parses this block entirely before running a line of it, so an edit to this file while a run is in
|
|
# flight cannot reach the running copy (7 Oct 2026: build-remote.sh was edited mid-run and died on shifted bytes after a 4-min build)
|
|
BOX="${BOX:-}"; PRIORITY="${PRIORITY:-normal}"; NODE_BIN=""; FETCH=""; LABEL=""; CMD=()
|
|
while [ $# -gt 0 ]; do
|
|
case "$1" in
|
|
--box) BOX="$2"; shift 2 ;;
|
|
--priority) PRIORITY="$2"; shift 2 ;;
|
|
--node-bin) NODE_BIN="$2"; shift 2 ;;
|
|
--fetch) FETCH="$2"; shift 2 ;;
|
|
--label) LABEL="$2"; shift 2 ;;
|
|
--) shift; CMD=("$@"); break ;;
|
|
*) bs_die "unknown argument $1 (the command follows --)" ;;
|
|
esac
|
|
done
|
|
[ ${#CMD[@]} -gt 0 ] || bs_die "no command: tools/fast-time-remote.sh [options] -- node infra/fast-time/<harness>.mjs ..."
|
|
[ -n "$NODE_BIN" ] || bs_die "--node-bin names the directory on the box that holds igneumd and igneum-miner (a fork worktree's target/release)"
|
|
case "$PRIORITY" in gate|normal) ;; *) bs_die "--priority takes gate or normal, not '$PRIORITY'" ;; esac
|
|
case "${CMD[0]}" in cargo) bs_die "the command must not be cargo: build with tools/build-remote.sh first" ;; esac
|
|
# the class: a gate runs at nice 0 on the full set, a slot ahead of queued suites, on box 1; normal is the bounded class on box 2
|
|
if [ "$PRIORITY" = gate ]; then BR_NICE=0; BR_CORES=0; BR_JOBS_CAP=0; BR_PRIORITY=gate; BR_KIND=gate; else BR_NICE=10; BR_CORES=32; BR_JOBS_CAP=32; BR_PRIORITY=normal; BR_KIND=other; fi
|
|
export BR_NICE BR_CORES BR_JOBS_CAP BR_PRIORITY BR_KIND
|
|
if [ -z "$BOX" ]; then if [ "$PRIORITY" = gate ]; then BOX=1; else BOX=$(bs_route attack); fi; fi
|
|
bs_host "$BOX"
|
|
# the context by hand (bs_context wants a crate): the repo worktree root is the tree; lib.sh reads these
|
|
BS_TOP=$(git -C "$HERE" rev-parse --show-toplevel); BS_WT_ROOT="$BS_TOP"; BS_KIND=repo; BS_MIRROR="$BS_MIRROR_REPO"; BS_TOP_REL=.
|
|
BS_WT=$(basename "$BS_WT_ROOT"); BS_CRATE_REL=infra/fast-time; BS_REMOTE_WT="$BS_ROOT_REMOTE/$BS_WT"; BS_REMOTE_CRATE="$BS_REMOTE_WT"
|
|
BS_BRANCH=$(git -C "$BS_TOP" branch --show-current 2>/dev/null || true); BS_SHA=$(git -C "$BS_TOP" rev-parse HEAD); [ -n "$BS_BRANCH" ] || BS_BRANCH="detached-$(git -C "$BS_TOP" rev-parse --short HEAD)"
|
|
BS_LOCAL_DIRS="infra/fast-time tools/finality-attacks"; BS_VENDOR_REPOS=""
|
|
case "$NODE_BIN" in /*) ;; *) NODE_BIN="$BS_REMOTE_WT/$NODE_BIN" ;; esac
|
|
bs_log "box $BOX ($BS_HOST) for priority $PRIORITY: ${CMD[*]} from $BS_WT at $BS_SHA ($BS_BRANCH), node binaries $NODE_BIN"
|
|
bs_ssh "[ -x '$NODE_BIN/igneumd' ] && [ -x '$NODE_BIN/igneum-miner' ]" || bs_die "no igneumd and igneum-miner at $NODE_BIN on the box: build them there first (tools/build-remote.sh from the fork worktree)"
|
|
bs_sync_sources
|
|
bs_log "sources in place (changed files re-stamped with touch by bs_overlay_dir)"
|
|
quoted=""; for a in "${CMD[@]}"; do quoted="$quoted $(printf '%q' "$a")"; done
|
|
cmd="export IGNEUMD=$(printf '%q' "$NODE_BIN/igneumd") IGNEUM_MINER=$(printf '%q' "$NODE_BIN/igneum-miner") IGNEUM_NODE_ROOT=$(printf '%q' "$BS_REMOTE_WT/"); $quoted"
|
|
BR_COMMAND="${CMD[*]}"; BR_TARGET=x86_64-unknown-linux-gnu; BR_ARTEFACTS=""; export BR_COMMAND BR_TARGET BR_ARTEFACTS
|
|
[ -n "$LABEL" ] || LABEL="fast-time ${CMD[*]}"
|
|
label="$BS_WT $LABEL; kind=$BR_KIND nice=$BR_NICE cores=$( [ "$BR_CORES" = 0 ] && echo 96 || echo "$BR_CORES")"
|
|
set +e
|
|
bs_remote_run "$BS_REMOTE_WT" "$label" "$cmd"
|
|
rc=$?
|
|
set -e
|
|
if [ -n "$FETCH" ]; then
|
|
mkdir -p "$BS_WT_ROOT/$FETCH"
|
|
bs_rsync -r "$BS_HOST:$BS_REMOTE_WT/$FETCH/" "$BS_WT_ROOT/$FETCH/" && bs_log "fetched $FETCH from the box" || bs_log "fetch of $FETCH failed (the run's rc was $rc)"
|
|
fi
|
|
bs_log "done: rc $rc"
|
|
[ "$rc" = 0 ] || exit "$rc"
|
|
exit 0
|
|
}
|