Repository navigation
bip360: exit nonzero when a test vector fails - #2380
Conversation
|
tACK f40146f Tested on macOS with Python 3.15.2: with the unmodified vectors the script exits 0; with a tampered I also checked that the branch merges cleanly on current master (78255e0); One minor observation: running 3c8190e already replaced the library's validation asserts with explicit raises so malformed trees still fail under |
jonatack
left a comment
There was a problem hiding this comment.
ACK
One minor observation: running p2mr.py with python3 -O strips the assert checks in run_single_test(). With the corrupted merkleRoot, the script then reports all vectors as passing and exits 0.
Agree with @devdavidejesus's comment and suggestion for a follow-up.
The BIP 360 reference script prints
FAILEDwhen a construction vector does not match the expected output, but still exits with status 0. A caller checking the exit status misses the failure.Count failures across both vector files and exit with status 1 after the negative structure tests have run, so all diagnostics are still printed.
I ran the script against the checked-in vectors (9/9 and 7/7) and all three negative structure checks. I then changed one expected
scriptPubKeyin temporary copies of the first vector file, the second, and both. On master all three runs exited 0. With this change each reported the mismatch and exited 1. The unmodified vectors exit 0.I used Codex to implement and test the change and Claude to review it.