"""Independent bounded batch input verification; never touches S3-A sources.""" from pathlib import Path from freeze_g1_components import sha from s2_custody_common import read_json, checked def contract(root): root = Path(root) c = read_json(root/'contract.json') for p,h in {**c['code_sha256'],**c['source_sha256']}.items(): checked(p,h) frozen = read_json(root/'code-freeze.json') if not frozen.get('git_commit') or frozen['contract_sha256'] != sha(root/'contract.json'): raise ValueError('Naive-ordering contract/code must be fixed before any execution') if c['latest_ruling'] != '1794733619.697459' or c['limits']['worker_cpu_seconds'] != 36000: raise ValueError('Wrong custody authorization or budget') return c def rows(c): return sorted((r for r in read_json(checked(c['roster'],c['roster_sha256']))['parts'] if r['included']),key=lambda r:r['case'])