"""Compare fictional EOA transaction labels; not a node, receipt or validity test.""" import json,sys,hashlib from pathlib import Path def compare(a,b): if any(x.get(k)is None for x in [a,b]for k in ['chain_id','sender','nonce']):return 'unknown' if a['chain_id']!=b['chain_id']or a['sender']!=b['sender']:return 'different_scope' if a['nonce']!=b['nonce']:return 'different_sequence' if a['hash']==b['hash']:return 'same_transaction' if b.get('included')is True and b.get('receipt_status')in[0,1]:return 'same_sequence_included' return 'same_sequence_candidate' def main(path): p=Path(path);data=json.loads(p.read_text());out=[] for row in data['cases']: code=compare(row['a'],row['b']) if code!=row['expected']:raise ValueError('case mismatch: '+row['id']) out.append({'id':row['id'],'label':row['label'],'classification':code,'a':row['a'],'b':row['b']}) return {'scope':data['scope'],'input_sha256':hashlib.sha256(p.read_bytes()).hexdigest(),'rows':out} if __name__=='__main__':print(json.dumps(main(sys.argv[1]),ensure_ascii=False,indent=2))