Skip to content

Commit 0ea709c

Browse files
authored
bip360 test vectors: non-standard leaf version should be allowed during construction of P2MR output (#46)
1 parent 7e98bd0 commit 0ea709c

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

bip-0360/ref-impl/common/tests/data/p2mr_construction.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
},
5858
{
5959
"id": "p2mr_different_version_leaves",
60-
"objective": "Tests P2MR with two script leaves of different versions. TO-DO: currently ignores given leaf version and over-rides. Probably better to throw error",
60+
"objective": "Tests P2MR with two script leaves of different versions. An unknown leaf version should be accepted and the P2MR output constructed successfully.",
6161
"given": {
6262
"scriptTree": [
6363
{

bip-0360/ref-impl/rust/tests/p2mr_construction.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ fn test_p2mr_single_leaf_script_tree() {
6565
process_test_vector_p2mr(test_vector).unwrap();
6666
}
6767

68+
/// Verifies that P2MR construction succeeds when leaves carry non-standard leaf versions (e.g. 0xfa).
69+
/// Unknown leaf versions are accepted: the TapLeaf hash is computed using the supplied version,
70+
/// and the resulting merkle root and control blocks are valid.
6871
#[test]
6972
fn test_p2mr_different_version_leaves() {
7073

bip-0360/ref-impl/rust/tests/p2mr_pqc_construction.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ fn test_p2mr_pqc_single_leaf_script_tree() {
5252
process_test_vector_p2mr(test_vector).unwrap();
5353
}
5454

55+
/// Verifies that P2MR construction succeeds when leaves carry non-standard leaf versions (e.g. 0xfa).
56+
/// Unknown leaf versions are accepted: the TapLeaf hash is computed using the supplied version,
57+
/// and the resulting merkle root and control blocks are valid.
5558
#[test]
5659
fn test_p2mr_pqc_different_version_leaves() {
5760

0 commit comments

Comments
 (0)