From 1baf0e71bb25445fa348c3cd6b92f68adac34e8b Mon Sep 17 00:00:00 2001 From: JP Date: Mon, 27 Jul 2026 21:40:00 +0100 Subject: [PATCH] bip360: fix leafHashes order and a control byte in the pqc vectors In p2mr_pqc_construction.json, the three-leaf vectors (p2mr_three_leaf_complex, p2mr_three_leaf_alternative) listed intermediary.leafHashes with entries 0 and 2 swapped relative to the depth-first order of the script tree, while the merkle root, scriptPubKey, address and control blocks all follow depth-first order (as do the same trees in p2mr_construction.json). In p2mr_different_version_leaves, scriptPathControlBlocks[1] started with byte 0xc1 although the leaf it commits to has leafVersion 0xfa; the control byte carries the leaf version in its upper 7 bits with the low bit set, so it must be 0xfb. The vector's leafHashes[1] and merkle root already correspond to the 0xfa leaf. --- .../common/tests/data/p2mr_pqc_construction.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bip-0360/ref-impl/common/tests/data/p2mr_pqc_construction.json b/bip-0360/ref-impl/common/tests/data/p2mr_pqc_construction.json index 75caf808..e63a1f25 100644 --- a/bip-0360/ref-impl/common/tests/data/p2mr_pqc_construction.json +++ b/bip-0360/ref-impl/common/tests/data/p2mr_pqc_construction.json @@ -72,7 +72,7 @@ "bip350Address": "bc1zzcvuumfz53k75pzuft0h7hen66qs6qxsa8y2f3a6xhdn0wg4cczq0h84sj", "scriptPathControlBlocks": [ "c1f224a923cd0021ab202ab139cc56802ddb92dcfc172b9212261a539df79a112a", - "c13bb0db8c6adcd87330a4a8c91be0fe1b23da3c151b6f2fb4f269429c43b8d8bc" + "fb3bb0db8c6adcd87330a4a8c91be0fe1b23da3c151b6f2fb4f269429c43b8d8bc" ] } }, @@ -184,9 +184,9 @@ }, "intermediary": { "leafHashes": [ - "0840c39e59eda6c9deee687a480cb169130c2f053ed2eb3134511ec1cfd8a2c7", + "b2a5304f678cc5a2ed51feb377dd0a609bd22ec979cc608bfcf884d0f8e6f93a", "837ef6677aeb0df2b0de47f45024684cc6ca03bda10fa30bb5bc05a94beb8dd1", - "b2a5304f678cc5a2ed51feb377dd0a609bd22ec979cc608bfcf884d0f8e6f93a" + "0840c39e59eda6c9deee687a480cb169130c2f053ed2eb3134511ec1cfd8a2c7" ], "merkleRoot": "eaf8f557fdb9673de7bb9bad7e7452da9f44a3e65133fdadf2849c55cfb3cf5b" }, @@ -232,9 +232,9 @@ }, "intermediary": { "leafHashes": [ - "52e9326c2bf04d926b7e9f6c7645dd853f3f007b870201de9b814952750c9310", + "ddb521a44e33ff4974e618d8b8b7794275b7dc754d847c537404f84330454361", "dcef3ce86cc8cea78c9e00f3d9ef58360cb6ed3cb90ec62efe00b9703854ba5c", - "ddb521a44e33ff4974e618d8b8b7794275b7dc754d847c537404f84330454361" + "52e9326c2bf04d926b7e9f6c7645dd853f3f007b870201de9b814952750c9310" ], "merkleRoot": "51e3c1151ba73d9efce801837773331bf9030977242f62dfeb6756795f482409" },