Fix B7 rank and B6 HKS gates behind existing B1 recovery
This commit is contained in:
1 parent
bccf1fee9f
commit
086c56dc36
27 files changed
+61726
-46
No files matched your search
@@ -0,0 +1,34 @@
|
||||
"""Single-writer Git barriers; worker verification never spawns a process."""
|
||||
import fcntl
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import subprocess
|
||||
from phase2_h1_worker_v2 import sha,checked,save
|
||||
BASE=Path('/home/frank14f/optane/MeltMind')
|
||||
WRITER=Path('/tmp/meltmind-git-review-20261114-v1-29ebglg8')
|
||||
|
||||
|
||||
def freeze(root,name,files):
|
||||
with Path('/tmp/meltmind-single-writer.lock').open('a') as lock:
|
||||
fcntl.flock(lock,fcntl.LOCK_EX)
|
||||
def git(*args):return subprocess.check_output(['git','-C',str(WRITER),*args],text=True).strip()
|
||||
if git('branch','--show-current')!='codex/s2-execution-diff-20261114' or git('status','--porcelain'):raise RuntimeError('Single writer not clean')
|
||||
hashes={}
|
||||
for path in files:
|
||||
path=Path(path);rel=str(path.resolve().relative_to(BASE));dest=WRITER/rel;dest.parent.mkdir(parents=True,exist_ok=True);shutil.copyfile(path,dest);hashes[rel]=sha(path)
|
||||
subprocess.run(['git','-C',str(WRITER),'add','--',*hashes],check=True)
|
||||
if git('diff','--cached','--name-only'):subprocess.run(['git','-C',str(WRITER),'commit','-m','Phase2 '+root.name+' '+name+' immutable barrier'],check=True)
|
||||
commit=git('rev-parse','HEAD')
|
||||
for rel,h in hashes.items():
|
||||
if hashlib.sha256(subprocess.check_output(['git','-C',str(WRITER),'show',commit+':'+rel])).hexdigest()!=h:raise ValueError('Git byte mismatch')
|
||||
save(root/(name+'-git-freeze.json'),dict(commit=commit,sha256=hashes,remote_published=False))
|
||||
save(root/(name+'-authorization.json'),dict(proof_sha256=sha(root/(name+'-git-freeze.json')),contract_sha256=sha(root/'contract.json')))
|
||||
|
||||
|
||||
def verify(root,name):
|
||||
auth=json.loads((root/(name+'-authorization.json')).read_text());checked(root/'contract.json',auth['contract_sha256'])
|
||||
p=checked(root/(name+'-git-freeze.json'),auth['proof_sha256']);proof=json.loads(p.read_text())
|
||||
for rel,h in proof['sha256'].items():checked(BASE/rel,h)
|
||||
return proof
|
||||
Reference in new issue
Block a user