35 lines
1.8 KiB
Python
35 lines
1.8 KiB
Python
"""Pins and provenance join for the explicitly authorized seven cached continuations."""
|
|
from pathlib import Path
|
|
from freeze_g1_components import sha
|
|
from s2_custody_common import checked, read_json
|
|
|
|
|
|
def contract(root):
|
|
root=Path(root);c=read_json(root/'contract.json')
|
|
for p,h in {**c['source_sha256'],**c['code_sha256']}.items():checked(p,h)
|
|
frozen=read_json(root/'code-freeze.json')
|
|
if frozen['contract_sha256']!=sha(root/'contract.json') or not frozen.get('git_commit'):
|
|
raise ValueError('Continuation code and contract must be fixed')
|
|
if c['continuation_indices']!=[26,194,367,406,470,480,483] or c['scope_ruling']!='1794735162.417219':
|
|
raise ValueError('Exactly the seven explicitly approved cached parts')
|
|
return c
|
|
|
|
|
|
def prepared(root,c):
|
|
canonical=read_json(root/'canonical-preparation.json')
|
|
if canonical['status']!='CANONICAL617_TET_DOMAIN_READY' or canonical['contract_sha256']!=sha(root/'contract.json'):
|
|
raise ValueError('Canonical input join not ready')
|
|
checked(c['original_root']+'/batch-complete.json',canonical['original_batch_sha256'])
|
|
checked(root/'batch-complete.json',canonical['continuation_batch_sha256'])
|
|
checked(c['domain_audit'],canonical['domain_audit_sha256'])
|
|
result={}
|
|
for item in canonical['parts']:
|
|
p=checked(item['result_path'],item['result_sha256']);r=read_json(p)
|
|
for name,h in r['output_sha256'].items():checked(p.parent/name,h)
|
|
if r['full_tet_T_end']<=0:raise ValueError('Invalid complete-domain endpoint')
|
|
if not item['domain_continuation'] and r['full_tet_T_end']!=r['full_VTU_T_end']:
|
|
raise ValueError('Do not reuse a curve normalized to a different endpoint')
|
|
result[r['case']]=(r,p.parent)
|
|
if len(canonical['parts'])!=617 or set(result)!=set(c['cases']):raise ValueError('Canonical roster changed')
|
|
return result
|