"""Validate the new certificate and two scientifically corrupted copies.""" import copy,json,pathlib from check_certificate import check p=pathlib.Path(__file__).parent d=json.loads((p/'certificate.json').read_text());check(d) controls=[] for name,change in [('omit_middle_slot',lambda x:x['witness']['slots'].pop(10)),('forge_seam_bound',lambda x:x['seam'][0].update(capacity=27))]: bad=copy.deepcopy(d);change(bad) try: check(bad) except AssertionError: controls.append({'name':name,'detected':True}) else: raise AssertionError('Missed corruption: '+name) raw=json.dumps({'certificate_pass':True,'controls':controls},sort_keys=True,indent=2)+'\n' (p/'checker-observations.json').write_text(raw,encoding='utf-8') print(raw,end='')