lnd icon indicating copy to clipboard operation
lnd copied to clipboard

Follow up signature normalization requirements

Open yyforyongyu opened this issue 3 months ago • 4 comments

We should follow up and add these test vectors: https://github.com/lightning/bolts/pull/1284

yyforyongyu avatar Sep 16 '25 07:09 yyforyongyu

Hello, @yyforyongyu and @saubyk if you’re okay with it, I would be happy to be assigned to this one.

MPins avatar Oct 31 '25 19:10 MPins

According to the issue and the discussion, our implementation always makes sure we use the lower S value. Things which should be done here:

  1. Make sure if the public key is provided that we validate that the lower S value is set, for signature validation see and how it should be done: https://github.com/btcsuite/btcd/blob/442ef28bcf03797e845c8e957e5cd6d4bffb5764/txscript/engine.go#L1406-L1411

  2. Adding the new test vectors

ziggie1984 avatar Nov 02 '25 14:11 ziggie1984

@MPins Thanks! Yeah let's hear what @saubyk thinks. Meanwhile this issue is about adding new test vectors to ensure the normalization is correct, which I believe is already the case.

yyforyongyu avatar Nov 03 '25 00:11 yyforyongyu

@yyforyongyu actually, the 'signature.Verify' used in LND (the Decred secp256k1 implementation) accepts high-S signatures. So as @ziggie1984 mentioned above, we need to explicitly validate that the signature is in low-S form.

MPins avatar Nov 14 '25 13:11 MPins