interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / tools / adapters / lower

17 lines · 1129 bytes Raw Blame History
1#!/usr/bin/env python3
2"""Transparent host dispatch; validation, hashing and lowering run in seeded native Omega."""
3from pathlib import Path
4import hashlib,json,os,sys
5root=Path(__file__).resolve().parents[2]
6closure={'src/source-aware/vendor/sha256.om','src/source-aware/core.om','src/adapters/upper-lower.om'}
7try:
8 build=root/'build/L831';m=json.loads((build/'build.json').read_text());exe=build/'lower'
9 if m['compiler_sha256']!='734f0a39319fbfa930bcc62cb30dbf06d47d78e126372b74f5baf478e6126b61':raise ValueError('compiler identity')
10 if set(m['inputs'])!=closure:raise ValueError('source closure')
11 for rel,digest in m['inputs'].items():
12 if hashlib.sha256((root/rel).read_bytes()).hexdigest()!=digest:raise ValueError('changed source')
13 if hashlib.sha256(exe.read_bytes()).hexdigest()!=m['binary_sha256']:raise ValueError('changed artifact')
14except (OSError,ValueError,KeyError) as exc:
15 print('LOWER_STALE_OR_MISSING_BUILD: '+str(exc),file=sys.stderr);raise SystemExit(78)
16# The optional NAME is passed through; the native tool validates it (64 on refusal).
17os.execv(exe,[str(exe)]+sys.argv[1:])