The fleet's 22:09 UK incident (a Mac-side pkill -f <log file name> matched nothing, the roll-everything script lived on and wiped a held box) and the day's two pgrep self-matches are one class. The check flags pgrep -f / pkill -f with a plain literal (every one on a line), any pgrep/pkill on a file-name shape, and ps | grep with a literal; it allows the bracket form, -x, -F pidfile, kill $(cat pidfile), a variable and a full path; 11 banned and 16 allowed shapes in its self-test; 0.15 s over the tree. The 25 pkill -f sp1-gpu-server inside bash -c bodies (which matched the calling bash) are pkill -x; the other 11 literals take the bracket form; prover-socket-check accepts both. Row R in the record; the CLAUDE.md rule names the check and covers pkill and file names. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
91 lines
7.4 KiB
PowerShell
91 lines
7.4 KiB
PowerShell
# Proving v1, step 2 (5 October 2026): aggregated chains on PC 2's RTX 5090. A signed `run` job (shell powershell,
|
|
# not elevated; the miners keep mining; the live prover in /opt/igneum is untouched: this build lands in /opt/igneum-pv1).
|
|
# 1. exports the chain from PC 2's own node (igneum_exportSegments 0..tip) to the job folder
|
|
# 2. inside WSL2 (root, Ubuntu-24.04): the fetched package igneum-prove-wsl2-pv1 -> ~/igneum-prove-pv1, every file
|
|
# re-stamped, built with the cuda feature against the live build's warm target dir, installed to /opt/igneum-pv1
|
|
# 3. cuts 8 consecutive live fixtures (tip-30 .. tip-23) with the new exporter, runs --mode native on each
|
|
# 4. --mode chain over the 8 (shards compressed, each block aggregated with the previous block's proof, verified),
|
|
# SP1_PROVER=cuda, a 1-s nvidia-smi sampler underneath for the GPU memory peak
|
|
# 5. --mode verify-segment on the final proof (the node's light-verifier path) for its timing
|
|
# Every number is a RESULT line. The results JSON is printed at the end (RESULTS-JSON ... END).
|
|
$ErrorActionPreference = 'Continue'
|
|
function Stamp { (Get-Date).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ') }
|
|
function Rpc($port, $method, $params) {
|
|
try { (Invoke-RestMethod -Method Post -Uri "http://127.0.0.1:$port" -ContentType 'application/json' -Body (@{jsonrpc='2.0'; id=1; method=$method; params=$params} | ConvertTo-Json -Compress -Depth 6) -TimeoutSec 180).result } catch { "rpc error: $_" | Out-Host; $null }
|
|
}
|
|
$evmPort = $null
|
|
foreach ($p in 26790, 26800, 26810) { if (Rpc $p 'igneum_getProvingStatus' @()) { $evmPort = $p; break } }
|
|
$job = $env:IGNEUM_JOB_DIR
|
|
if (-not $job) { $job = Join-Path $env:TEMP 'igneum-pv1-chain' }
|
|
New-Item -ItemType Directory -Force -Path $job | Out-Null
|
|
$tipHex = Rpc $evmPort 'eth_blockNumber' @()
|
|
$tip = [Convert]::ToInt64($tipHex, 16)
|
|
$first = $tip - 30; $last = $first + 7
|
|
"RESULT start $(Stamp) node_evm_port=$evmPort tip=$tip chain blocks $first..$last"
|
|
# 1. the export (the whole chain: the exporter replays from genesis)
|
|
$t = Get-Date
|
|
$body = (@{jsonrpc='2.0'; id=1; method='igneum_exportSegments'; params=@('0x0', ('0x{0:x}' -f $last))} | ConvertTo-Json -Compress)
|
|
$seqFile = Join-Path $job 'seq.json'
|
|
$bodyFile = Join-Path $job 'export-request.json'
|
|
[IO.File]::WriteAllText($bodyFile, $body, (New-Object System.Text.UTF8Encoding $false))
|
|
# curl.exe (Windows 10+ ships it) streams the 70 MB reply to a file; Invoke-WebRequest's Content is a string there
|
|
# and WriteAllBytes refused it (the first run, 19:52Z)
|
|
& curl.exe -s -S -m 600 -X POST "http://127.0.0.1:$evmPort" -H 'Content-Type: application/json' --data-binary "@$bodyFile" -o $seqFile 2>&1 | ForEach-Object { "curl: $_" }
|
|
if (-not (Test-Path $seqFile) -or (Get-Item $seqFile).Length -lt 1000) { "RESULT export FAILED: no reply file"; exit 1 }
|
|
$len = (Get-Item $seqFile).Length
|
|
"RESULT export $(Stamp) $len bytes in $([math]::Round(((Get-Date) - $t).TotalSeconds,1)) s to $seqFile"
|
|
# the JSON-RPC envelope: the exporter wants the result object; unwrap with python inside WSL (below)
|
|
$pkg = Join-Path $env:LOCALAPPDATA 'igneum\prove\igneum-prove-wsl2-pv1\igneum-prove-wsl2'
|
|
if (-not (Test-Path $pkg)) { $pkg = Join-Path $env:LOCALAPPDATA 'igneum\prove\igneum-prove-wsl2-pv1' }
|
|
"RESULT package $(Stamp) $pkg exists=$(Test-Path (Join-Path $pkg 'package'))"
|
|
function WslPath($p) { $w = (& wsl.exe -d Ubuntu-24.04 -u root -- wslpath -a ($p -replace '\\', '/') 2>$null); if ($w) { ($w -replace "`0", '').Trim() } else { '/mnt/c' + ($p.Substring(2) -replace '\\', '/') } }
|
|
$pkgW = WslPath $pkg; $jobW = WslPath $job
|
|
$bash = @"
|
|
set -uo pipefail
|
|
export PATH="`$HOME/.cargo/bin:`$HOME/.sp1/bin:`$PATH"
|
|
CUDA_DIR="`$(ls -d /usr/local/cuda-12.* 2>/dev/null | sort -V | tail -1 || true)"; [ -n "`$CUDA_DIR" ] && export PATH="`$CUDA_DIR/bin:`$PATH" && export LD_LIBRARY_PATH="`$CUDA_DIR/lib64:/usr/lib/wsl/lib:`${LD_LIBRARY_PATH:-}"
|
|
stamp() { date -u +%Y-%m-%dT%H:%M:%SZ; }
|
|
PKG='$pkgW'; JOB='$jobW'; DEST="`$HOME/igneum-prove-pv1"; LIVE_TARGET="`$HOME/igneum-prove/proving/igneum-prove/target"
|
|
mkdir -p "`$DEST"
|
|
rsync -a --delete --exclude target "`$PKG/package/" "`$DEST/"
|
|
find "`$DEST" -name target -prune -o -type f -exec touch {} + 2>/dev/null
|
|
ls -la "`$DEST/proving/igneum-prove/elf/" | sed 's/^/elf: /'
|
|
grep -o '"program_id": "0x[0-9a-f]*"' "`$DEST/proving/igneum-prove/elf/manifest.json" | sed 's/^/RESULT manifest /'
|
|
cd "`$DEST/proving/igneum-prove"
|
|
echo "RESULT build start `$(stamp) target `$LIVE_TARGET (warm from the live build; the three workspace crates recompile)"
|
|
t0=`$(date +%s)
|
|
if ! CARGO_TARGET_DIR="`$LIVE_TARGET" cargo build --release -p igneum-prove-export -p igneum-prove-host --features igneum-prove-host/cuda 2>&1 | tail -3; then echo "RESULT build FAILED"; exit 1; fi
|
|
echo "RESULT build `$(stamp) exit 0 in `$(( `$(date +%s) - t0 )) s"
|
|
mkdir -p /opt/igneum-pv1 && cp "`$LIVE_TARGET/release/igneum-prove-host" "`$LIVE_TARGET/release/igneum-prove-export" /opt/igneum-pv1/
|
|
H=/opt/igneum-pv1/igneum-prove-host; X=/opt/igneum-pv1/igneum-prove-export
|
|
echo "RESULT installed `$(sha256sum `$H | cut -c1-16) host, `$(sha256sum `$X | cut -c1-16) export; live /opt/igneum untouched: `$(sha256sum /opt/igneum/igneum-prove-host | cut -c1-16)"
|
|
`$H --mode id | sed 's/^/RESULT pv1-host /'
|
|
# 3. the fixtures: unwrap the JSON-RPC envelope, cut eight consecutive blocks
|
|
python3 -c "import json,sys; d=json.load(open('`$JOB/seq.json')); json.dump(d['result'], open('`$JOB/export.json','w'))"
|
|
LIST=""
|
|
for n in `$(seq $first $last); do
|
|
if ! `$X "`$JOB/export.json" `$n "`$JOB/block-`$n.json" --source "PC 2 live devnet export, proving v1 chain run" 2>&1 | tail -1 | sed "s/^/export `$n: /"; then echo "RESULT cut `$n FAILED"; exit 1; fi
|
|
`$H "`$JOB/block-`$n.json" --mode native 2>&1 | grep -E "^RESULT (native|plan)" | sed "s/^/block `$n /"
|
|
LIST="`$LIST`${LIST:+,}`$JOB/block-`$n.json"
|
|
done
|
|
echo "RESULT fixtures `$(stamp) `$LIST"
|
|
# 4. the chain on the GPU, with the memory sampler
|
|
nvidia-smi --query-gpu=timestamp,index,memory.used,utilization.gpu,power.draw --format=csv,noheader,nounits -l 1 > "`$JOB/smi-chain.csv" 2>/dev/null &
|
|
SMI=`$!
|
|
t0=`$(date +%s)
|
|
SP1_PROVER=cuda RUST_LOG=off `$H --mode chain --chain "`$LIST" --prover 0xCAfc6e74000000000000000000000000000000c2 --out "`$JOB/chain-results.json" 2>&1 | grep -E "^(RESULT|STAGE|igneum-prove-host sources|segment proof written)" | sed 's/^/chain: /'
|
|
echo "RESULT chain wall `$(( `$(date +%s) - t0 )) s at `$(stamp)"
|
|
kill `$SMI 2>/dev/null; sleep 1
|
|
awk -F', *' '{ if (`$3+0 > max[`$2]) max[`$2]=`$3+0; n[`$2]++ } END { for (i in max) print "RESULT gpu_memory_peak_chain index=" i " samples=" n[i] " memory_used_max_mib=" max[i] }' "`$JOB/smi-chain.csv"
|
|
free -m | awk '/Mem:/ {print "RESULT wsl_ram_now total_mb=" `$2 " used_mb=" `$3}'
|
|
# 5. the node's verifier path on the final proof
|
|
STMT=`$(python3 -c "import json; print(json.load(open('`$JOB/chain-results.json'))['segment_statement'])")
|
|
PROOF=`$(python3 -c "import json; print(json.load(open('`$JOB/chain-results.json'))['segment_proof_file'])")
|
|
for i in 1 2 3; do `$H --mode verify-segment --proof "`$PROOF" --statement "`$STMT" 2>&1 | grep -E "^RESULT" | sed "s/^/verify-segment run `$i: /"; done
|
|
pkill -x sp1-gpu-server 2>/dev/null; sleep 1; rm -f /tmp/sp1-cuda-*.sock
|
|
echo "RESULTS-JSON"; cat "`$JOB/chain-results.json"; echo; echo "END"
|
|
"@
|
|
$bashFile = Join-Path $job 'chain.sh'
|
|
[IO.File]::WriteAllText($bashFile, ($bash -replace "`r`n", "`n"), (New-Object System.Text.UTF8Encoding $false))
|
|
& wsl.exe -d Ubuntu-24.04 -u root -- bash (WslPath $bashFile) 2>&1 | ForEach-Object { ($_ -replace "`0", '') }
|
|
"RESULT end $(Stamp)"
|