zpay32: resync BOLT 11 vectors with bolts#1368
What changed, and why it matters
This commit updates LND's test data and test expectations to match a corrected official BOLT 11 specification test vector. The invoice string used to exercise 'high-S' signature rejection was changed so it no longer contains a duplicate 's' field. The test now expects the code to reject it specifically for the high-S signature, not for a duplicate field. It is a test-only alignment with the spec, not a functional code change.
No action required. This is a test maintenance commit. Reviewers may optionally verify the new test vector matches the upstream BOLT 11 PR.
Security signals we found
Test-only update to align with upstream BOLT 11 specification vectors
Corrected high-S signature test vector no longer masks signature validation behind duplicate-field rejection
No changes to signature verification, duplicate-field detection, or invoice decoding logic
Evidence from the diff
The change modifies zpay32/bolt11_vectors_test.go and zpay32/test-vectors/invoice-test.json. The high-S test vector from lightning/bolts#1368 drops a duplicated s (payment_secret) field, so the vector now survives duplicate-field validation and reaches signature verification. The expected error is updated from ErrDuplicatePaymentAddr to ErrHighSSignature. No production parsing logic is changed.
Changed components
zpay32/bolt11_vectors_test.gozpay32/test-vectors/invoice-test.jsonInspect captured patch +6 / −10
### zpay32/bolt11_vectors_test.go
@@ -35,15 +35,11 @@ var paymentLayerVectors = map[string]string{
// expectedVectorErrors maps invalid vectors to the error Decode must return
// for them, so a vector rejected for the wrong reason fails the test.
var expectedVectorErrors = map[string]error{
- "Same, but with an `n` field of invalid length": ErrInvalidFixedFieldLength, //nolint:ll
- "Two distinct p fields in an otherwise valid invoice": ErrDuplicatePaymentHash, //nolint:ll
- "The same p field twice in an otherwise valid invoice": ErrDuplicatePaymentHash, //nolint:ll
- "Two distinct s fields in an otherwise valid invoice": ErrDuplicatePaymentAddr, //nolint:ll
-
- // The spec's high-S vector also repeats its `s` field, so it's
- // rejected as a duplicate before the signature is checked. The low-S
- // check itself is covered by TestDecodeHighSWithDestination.
- "Non canonical signature (high-S) with 'n' field defined": ErrDuplicatePaymentAddr, //nolint:ll
+ "Same, but with an `n` field of invalid length": ErrInvalidFixedFieldLength, //nolint:ll
+ "Two distinct p fields in an otherwise valid invoice": ErrDuplicatePaymentHash, //nolint:ll
+ "The same p field twice in an otherwise valid invoice": ErrDuplicatePaymentHash, //nolint:ll
+ "Two distinct s fields in an otherwise valid invoice": ErrDuplicatePaymentAddr, //nolint:ll
+ "Non canonical signature (high-S) with 'n' field defined": ErrHighSSignature, //nolint:ll
}
// TestBOLT11Vectors runs every invoice test vector from the spec through
### zpay32/test-vectors/invoice-test.json
@@ -152,6 +152,6 @@
{
"description": "Non canonical signature (high-S) with 'n' field defined",
"valid": false,
- "invoice": "lnbc25m1p70xwfzpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaqnp4q0n326hr8v9zprg8gsvezcch06gfaqqhde2aj730yg0durunfhv66sp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs9qrsgqsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygsp5cfzp9ugllvk03rltd6hvndxj26ux6gcxc5azyxk060rj9tzghct5zvjlps76gx8wpq5yuu79688k8gnm2c0al6v608s96l0xzrrlqqwnzxmu"
+ "invoice": "lnbc25m1p70xwfzpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaqnp4q0n326hr8v9zprg8gsvezcch06gfaqqhde2aj730yg0durunfhv66sp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs9qrsgq4dnj26gykrcyg6rw2pyk7sshrg8890l9q0vxvvnq7c6q7n7fhn4uhw89rghjljt2a4q0he7ka3cefq84r79w4n2cthhrhtyzqtc99qcpl325ac"
}
]Why this scored 20/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.