#!/bin/sh # Every hash, the 5 reference answers and the cheat suite, on the bundled verifier. No network is used. set -u ROOT=$(cd "$(dirname "$0")" && pwd) cd "$ROOT" || exit 2 case "$(uname -s)-$(uname -m)" in Darwin-arm64) ENGINE="$ROOT/scorer/bin/sample_verifier-macos-arm64" ;; Linux-x86_64|Linux-amd64) ENGINE="$ROOT/scorer/bin/sample_verifier-linux-amd64" ;; Linux-aarch64|Linux-arm64) ENGINE="$ROOT/scorer/bin/sample_verifier-linux-arm64" ;; *) echo "no bundled verifier for $(uname -s) $(uname -m); see VERIFY.md"; exit 2 ;; esac [ -x "$ENGINE" ] || chmod +x "$ENGINE" 2>/dev/null || true FAIL="" if command -v shasum > /dev/null; then SUM="shasum -a 384"; else SUM="sha384sum"; fi if $SUM -c SHA384SUMS > /dev/null 2>&1; then echo "SHA384SUMS: $(grep -c . SHA384SUMS) files hold"; else echo "SHA384SUMS: NOT ALL HOLD"; FAIL="$FAIL hashes;"; fi OUT=$(mktemp -d) cd scorer || exit 2 python3 -B pack_score.py ../reference --engine "$ENGINE" --environments data/environments.jsonl --calls-from harness --quiet --out "$OUT/scores.jsonl" > "$OUT/scores.log" 2>&1 python3 -B pack_score.py --run run_cheat_suite.py --environments data/environments.jsonl --reference ../reference --engine "$ENGINE" --out "$OUT/cheat.jsonl" > "$OUT/cheat.log" 2>&1 CE=$? python3 -B - "$OUT" "$CE" <<'PY' || FAIL="$FAIL scores;" import json, sys out, ce = sys.argv[1], int(sys.argv[2]) r = [json.loads(l) for l in open(out + "/scores.jsonl")] c = [json.loads(l) for l in open(out + "/cheat.jsonl") if l.strip()] a = [x for x in c if x.get("applies")] cheats = [x for x in a if not x["expect"]] honest = [x for x in a if x["expect"]] over = sum(1 for x in cheats if x["reward"] or x["graded"]) at1 = sum(1 for x in honest if x["ok"]) print("reference answers: reward 1 on %d of %d, proofs hold on %d" % (sum(x["reward"] for x in r), len(r), sum(x["proofs_hold"] for x in r))) print("cheat suite: %d cheat attempts over %d vectors, %d above 0; honest controls %d of %d at 1 (exit %d)" % (len(cheats), len({x["vector"] for x in cheats}), over, at1, len(honest), ce)) sys.exit(0 if sum(x["reward"] for x in r) == len(r) == 5 and not over and cheats and at1 == len(honest) and ce == 0 else 1) PY rm -rf "${OUT:?}" if [ -z "$FAIL" ]; then echo "SAMPLE HOLDS"; else echo "NOT HOLDING:$FAIL"; exit 1; fi