Buckets:

soixantesept's picture
download
raw
2.95 kB
#!/usr/bin/env python3
"""Package every B6 binary variant, run the end-to-end chain proof on the candidates,
and emit REPORT.md + bundle67.json from the measured artifacts."""
from __future__ import annotations
import json
import pathlib
import subprocess
B6 = pathlib.Path("/root/hutter67/swarm67/B6-bundle")
OUT = B6 / "out"
WORK = B6 / "work"
# variant -> (binary path, short description, decode-proof status source)
VARIANTS = {
"orig_static_p1": (WORK / "paq8px.orig", "P1's shipped static binary, unmodified (baseline payload)"),
"dyn_Os": (OUT / "build/dyn_Os", "same source, -Os -flto=2, dynamic, gc-sections, stripped"),
"dyn_Os_hard": (OUT / "build/dyn_Os_hard", "-Os -flto=2 dynamic + hard size flags (no-plt/stack-protector off)"),
"dyn_Os_flto1": (OUT / "build/dyn_Os_flto1", "-Os -flto=1 dynamic"),
"dyn_Os_noflto": (OUT / "build/dyn_Os_noflto", "-Os dynamic, no LTO"),
"dyn_O3": (OUT / "build/dyn_O3", "P1 flags verbatim (-O3 -flto) except dynamic link instead of -static"),
"dyn_O2": (OUT / "build/dyn_O2", "-O2 -flto=2 dynamic"),
"dyn_Oz_clang": (OUT / "build/dyn_Oz_clang", "clang++-17 -Oz dynamic"),
"static_Os": (OUT / "build/static_Os", "-Os static (self-contained: no host libstdc++/libc needed)"),
}
PROVEN_IN_E2E = ["dyn_Os", "dyn_O3", "static_Os"]
def run(cmd, **kw):
return subprocess.run(cmd, capture_output=True, text=True, **kw)
def package(label: str, binary: pathlib.Path) -> dict | None:
if not binary.exists():
return None
d = OUT / f"bundle_{label}"
j = OUT / f"bundle_{label}.json"
r = run(["python3", str(WORK / "make_bundle.py"), "--binary", str(binary), "--out", str(d),
"--label", label, "--json", str(j)])
if r.returncode != 0:
print("package failed", label, r.stdout[-400:], r.stderr[-400:])
return None
return json.loads(j.read_text())
def e2e(label: str) -> dict | None:
r = run(["bash", str(WORK / "e2e_bundle.sh"), label, str(OUT / f"bundle_{label}")])
p = B6 / "test" / f"e2e_{label}.json"
if not p.exists():
print("e2e failed", label, r.stdout[-300:], r.stderr[-300:])
return None
return json.loads(p.read_text())
def main() -> int:
table = {}
for label, (binary, desc) in VARIANTS.items():
doc = package(label, binary)
if doc is None:
print(f"[skip] {label}: packaging failed or binary missing")
continue
doc["description"] = desc
doc["raw_binary_bytes"] = binary.stat().st_size
if label in PROVEN_IN_E2E:
ev = e2e(label)
doc["e2e"] = ev
doc["decode_proof"] = bool(ev and ev["all_match"])
table[label] = doc
print(f"[ok] {label}: bundle={doc['bundle_bytes']} proven={doc.get('decode_proof')}")
(OUT / "variant_table.json").write_text(json.dumps(table, indent=1))
return 0
if __name__ == "__main__":
raise SystemExit(main())

Xet Storage Details

Size:
2.95 kB
·
Xet hash:
ddb188d3479749df073505f723e3139463cf75ff32b4bc3109b0561886bc65ca

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.