interplane.Get Omega
Read in your language

aien-protocols-mv

Canonical specifications, wire protocols, and schemas for the AIEN sovereign ecosystem

Brought by drakestapleton

branch main Branches Tags History

aien-protocols-mv / evidence / aienet0-20261028 / host-checks.sh

72 lines · 2946 bytes Raw Blame History
1#!/usr/bin/env bash
2# Host-only checks behind the Aienet-0 job path evidence (HOST_TESTED, Spark).
3# usage: host-checks.sh OMC OMEGA_MV OH_TREE CORE_TREE
4# OMC pinned omc (sha256 2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f)
5# OMEGA_MV omega-mv checkout holding the pinned OM-2 SHA-256 unit
6# OH_TREE open-humanity checkout at feat/aienet0-mjb1-carrier
7# CORE_TREE aien-sovereign-core-mv checkout holding ref pr662 (Core PR #662)
8# Writes build/parity/mutants/xcheck logs next to this script. Exit 0 only
9# when every step passes.
10set -u -o pipefail
11omc=${1:?} mv=${2:?} oh=${3:?} core=${4:?}
12here=$(cd "$(dirname "$0")" && pwd)
13root=$(cd "$here/../.." && pwd)
14jp=$root/specs/aienet/jobpath
15work=$(mktemp -d)
16trap 'rm -rf "$work"' EXIT
17fail=0
18step() { # NAME CMD... : run, log to NAME.log, record rc
19 local name=$1
20 shift
21 { echo "\$ $*"; "$@"; } >"$here/$name.log" 2>&1
22 local rc=$?
23 echo "$name rc=$rc" | tee -a "$here/host-checks.rc"
24 [[ $rc == 0 ]] || fail=1
25}
26: >"$here/host-checks.rc"
27bin=$work/matmul_u32_recompute
28step build env OMEGA_OMC="$omc" OMEGA_MV="$mv" "$jp/build.sh" "$bin"
29sha256sum "$bin" | sed "s|$work/||" >"$here/recompute.sha256"
30step parity "$jp/parity.sh" "$bin"
31step mutants-protocols env OMEGA_MV="$mv" "$jp/mutants.sh" "$omc"
32step mutants-open-humanity "$oh/scripts/aienet0/mutants.sh" "$work/oh-mutants"
33mkdir -p "$here/mutants-open-humanity"
34cp "$work"/oh-mutants/*.diff "$here/mutants-open-humanity/"
35for d in "$work"/oh-mutants/*.controls; do
36 [[ -f $d/summary.tsv ]] && cp "$d/summary.tsv" "$here/mutants-open-humanity/$(basename "$d").summary.tsv"
37done
38
39# Three-way agreement: Core #662 task.rs (oracle and run) vs the Rust worker
40# kernel (aien-microjob) vs the Omega recompute, on the same payloads.
41mkdir -p "$work/x/src"
42cp "$here/xcheck662/Cargo.toml" "$work/x/"
43cp "$here/xcheck662/main.rs" "$work/x/src/"
44git -C "$core" show pr662:crates/aien-hetjob/src/task.rs >"$work/x/src/task.rs"
45{
46 echo "core pr662 $(git -C "$core" rev-parse pr662)"
47 echo "task.rs sha256 $(sha256sum <"$work/x/src/task.rs" | cut -c1-64)"
48} >"$here/xcheck662.pins"
49(cd "$root" && cargo build -q -p aien-microjob --example an0_digest)
50ex=$root/target/debug/examples/an0_digest
51xcheck() {
52 (cd "$work/x" && cargo build -q --release) || return 1
53 local agree=0 bad=0
54 while read -r m k n seed; do
55 read -r payload rust < <("$ex" "$m" "$k" "$n" "$seed")
56 om=$(printf '%s' "$payload" | xxd -r -p | "$bin" | tr -d '\n')
57 core=$(echo "$payload" | "$work/x/target/release/xcheck662")
58 if [[ $rust == "$om" && $om == "$core" ]]; then v=AGREE; agree=$((agree + 1)); else v=DISAGREE; bad=$((bad + 1)); fi
59 echo "$m $k $n $seed core662=$core rust=$rust omega=$om $v"
60 done <<'EOF'
611 1 1 0
622 3 4 7
6364 64 64 1311768467463790320
6464 64 64 2716205057
65128 64 32 99
66256 256 256 2716205057
67EOF
68 echo "agree=$agree disagree=$bad"
69 [[ $bad == 0 ]]
70}
71step xcheck662 xcheck
72exit $fail