igneum/proving/windows-wsl2/make-package.sh
igneum-labs 7dade79bcb Aggregation cost on the 5090 (5 October, night): the chained aggregation is 2.1 s alone and 9.7 s beside the miner, the batch-log2 curve (2^16 buys 1.6x for a fifth of the hash rate), batch and tree folds estimated, two streams and SP1 knobs closed; the host times the stdin build and names the knobs, --save-shards; the PC 2 job scripts and the readers
The statement and the pinned guests are unchanged; every fixture proof verifies as before. The defaults stay (batch-log2 22, SP1 defaults): the one knob that moves a mining card's prover costs a fifth of the hash rate; the plan carries the trade for the project lead and the batch fold for the next pin. Measured: docs/bench-log.md "aggregation cost on the RTX 5090"; the plan line: docs/plans/proving-v1.md "Aggregation cost (5 October, night)". Also: make-package's gate skips the exporter's .node-plan.json side files and takes the run lock for its execute step; the state-reply class (/api/state answering {} once paid_wei passes u64::MAX) found on the way and fixed on the app branch at 42f36b3.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
(cherry picked from commit ea38ece9eaa5949dd657cbfea5308c4948177ff8)
2026-10-06 07:04:50 +00:00

52 lines
4.3 KiB
Bash
Executable file

#!/usr/bin/env bash
# Builds igneum-prove-wsl2.zip (double-click setup and proof run for a Windows 11 PC) on the Mac.
# Packs this directory plus the proving sources and the execution layer's evm-types crate under package/, so the
# path dependency resolves on the PC without the repository. Usage: windows-wsl2/make-package.sh [out zip, default ~/Desktop/igneum-prove-wsl2.zip]
set -euo pipefail
HERE="$(cd "$(dirname "$0")" && pwd)"
ROOT="$(cd "$HERE/../.." && pwd)"
OUT="${1:-$HOME/Desktop/igneum-prove-wsl2.zip}"
STAGE="$(mktemp -d)/igneum-prove-wsl2"
PKG="$STAGE/package"
mkdir -p "$PKG/proving" "$PKG/vendor/igneum-node-exec/igneum"
cp "$HERE/SETUP-PROVER.bat" "$HERE/setup-prover.ps1" "$HERE/setup-wsl.sh" "$HERE/prove-block.sh" "$HERE/PROVE-BLOCK.bat" "$HERE/prove-shard.sh" "$HERE/PROVE-SHARD.bat" "$HERE/README.txt" "$STAGE/"
rsync -a --exclude "target*" --exclude Cargo.lock "$ROOT/proving/igneum-prove" "$PKG/proving/"
cp "$ROOT/proving/igneum-prove/Cargo.lock" "$PKG/proving/igneum-prove/" 2>/dev/null || true
rsync -a "$ROOT/proving/fixtures" "$PKG/proving/"
# the package travels to a PC and is built there against a kept target dir: stamp every file now (cargo rebuilds by mtime)
find "$PKG" -type f -exec touch {} +
rsync -a --exclude target "$ROOT/vendor/igneum-node-exec/igneum/evm-types" "$PKG/vendor/igneum-node-exec/igneum/"
# evm-types inherits thiserror from the node's workspace; pin it inline (the node's Cargo.toml line 346: 2.0.18) so the crate builds alone.
perl -pi -e 's/^thiserror\.workspace = true/thiserror = { version = "2.0.18", default-features = false }/' "$PKG/vendor/igneum-node-exec/igneum/evm-types/Cargo.toml"
# The exporters' inputs, so the fixtures can be regenerated on the PC too.
mkdir -p "$PKG/tools/evm-smoke" "$PKG/tools/prove-fixtures" && cp "$ROOT/tools/evm-smoke/seq.json" "$PKG/tools/evm-smoke/" 2>/dev/null || true
cp "$ROOT/tools/prove-fixtures/seq.json" "$PKG/tools/prove-fixtures/" 2>/dev/null || true
for f in "$STAGE/SETUP-PROVER.bat" "$STAGE/PROVE-BLOCK.bat" "$STAGE/PROVE-SHARD.bat" "$STAGE/README.txt" "$STAGE/setup-prover.ps1"; do perl -pi -e 's/\r?\n/\r\n/' "$f"; done
for f in "$STAGE/setup-wsl.sh" "$STAGE/prove-block.sh" "$STAGE/prove-shard.sh"; do perl -pi -e 's/\r\n/\n/' "$f"; chmod +x "$f"; done
# GATE (4 October 2026, after the second RTX 5090 run failed in its first second with a guest and host pair that had never
# run together): the host is built here from the same sources that go into the package and must execute the shard
# fixture and verify every block fixture natively before any zip exists. SKIP_GATE=1 skips it (never for a package that ships).
if [ "${SKIP_GATE:-0}" != "1" ]; then
echo "gate: building the host from the packaged sources and running the fixtures on this machine's CPU"
GATE_LOG="$(mktemp)"
if ! (cd "$ROOT/proving/igneum-prove" && "$ROOT/tools/lock/with-lock.sh" build env PATH="$HOME/.cargo/bin:$PATH" nice -n 19 cargo build --release -j 4 -p igneum-prove-host >"$GATE_LOG" 2>&1); then
echo "GATE FAILED: the host does not build; see $GATE_LOG"; exit 1
fi
H="$ROOT/proving/igneum-prove/target/release/igneum-prove-host"
for f in "$ROOT"/proving/fixtures/block-*.json; do
# the exporter's side files (block-N.json.node-plan.json, 5 October 2026) are not fixtures
case "$f" in *.node-plan.json) continue ;; esac
if ! "$H" "$f" --mode native >>"$GATE_LOG" 2>&1; then echo "GATE FAILED: native run of $(basename "$f"); see $GATE_LOG"; exit 1; fi
done
# the execute step reports a cycle count, not a time: the `run` lock (tools/lock/with-lock.sh: counts, not ms), so the
# gate does not queue behind every build and measurement on the Mac (5 October 2026: 25 min behind a packbench run)
if ! "$ROOT/tools/lock/with-lock.sh" run "$H" "$ROOT/proving/fixtures/block-338-shard1.json" --mode execute --shard 0 >>"$GATE_LOG" 2>&1; then
echo "GATE FAILED: the guest did not execute the shard fixture (the exact failure the PC hit on 4 October); see $GATE_LOG"; exit 1
fi
"$H" --mode id | tee -a "$GATE_LOG" # the pinned program ids this package carries (the PC's build embeds the same elf/ files)
echo "gate: passed ($(grep -c '^RESULT' "$GATE_LOG") RESULT lines)"
fi
rm -f "$OUT"
(cd "$(dirname "$STAGE")" && zip -qr "$OUT" "$(basename "$STAGE")")
ls -la "$OUT"
unzip -l "$OUT" | tail -n +4 | awk '{print $4}' | sed '/^$/d' | grep -v '/$' | head -40