Skip to content

Introduce ReceiveAuthKey verification for Blinded Payment Paths - #4126

Merged
TheBlueMatt merged 2 commits into
lightningdevkit:mainfrom
shaavan:aad-payment
Nov 14, 2025
Merged

Introduce ReceiveAuthKey verification for Blinded Payment Paths#4126
TheBlueMatt merged 2 commits into
lightningdevkit:mainfrom
shaavan:aad-payment

Conversation

@shaavan

Copy link
Copy Markdown
Member

Building on the goals set forth in #3917, this PR introduces ReceiveAuthKey-based verification for Blinded Payment Paths.

Key Outcomes

  • Uniform verification mechanism: Both payment and message blinded paths now share the same authentication logic.
  • Smaller payloads: The final ReceiveTlvs are noticeably reduced in size, making blinded paths lighter.

Follow-Up Preparation

This PR also lays the groundwork for introducing dummy payment hops in a follow-up PR.
By minimizing per-hop authentication data, we keep dummy hops compact — preserving overall path size and ensuring that forward and dummy TLVs are padded to the same length, improving hop indistinguishability and privacy.

@ldk-reviews-bot

ldk-reviews-bot commented Sep 25, 2025

Copy link
Copy Markdown

👋 Thanks for assigning @TheBlueMatt as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@codecov

codecovBot commented Sep 25, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.65517% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.33%. Comparing base (95c4eaf) to head (b18ccb3).
⚠️ Report is 35 commits behind head on main.

Files with missing linesPatch %Lines
lightning/src/blinded_path/payment.rs70.37%3 Missing and 5 partials ⚠️
lightning/src/routing/router.rs70.00%3 Missing ⚠️
lightning/src/ln/msgs.rs94.11%0 Missing and 1 partial ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #4126 +/- ##
==========================================
+ Coverage 89.28% 89.33% +0.04% 
==========================================
Files 180 180 Lines 137913 138086 +173 Branches 137913 138086 +173 ==========================================
+ Hits 123142 123356 +214 + Misses 12167 12127 -40 + Partials 2604 2603 -1 
FlagCoverage Δ
fuzzing35.86% <4.00%> (+2.30%)⬆️
tests88.70% <89.65%> (+0.01%)⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ldk-reviews-bot

Copy link
Copy Markdown

🔔 1st Reminder

Hey @jkczyz! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@ldk-reviews-bot

Copy link
Copy Markdown

🔔 2nd Reminder

Hey @jkczyz! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@ldk-reviews-bot

Copy link
Copy Markdown

🔔 3rd Reminder

Hey @jkczyz! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@ldk-reviews-bot

Copy link
Copy Markdown

🔔 4th Reminder

Hey @jkczyz! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@ldk-reviews-bot

Copy link
Copy Markdown

🔔 5th Reminder

Hey @jkczyz! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@shaavan

Copy link
Copy Markdown
MemberAuthor

Updated frompr4126.01 to pr4126.02 (diff):

Changes:

  1. Various cleanups
  2. Expanded Documentation
  3. Restructured the fails_receive_tlvs_authentication test so that it can properly test the new ReceiveAuthKey based authentication

@ldk-reviews-bot

Copy link
Copy Markdown

🔔 6th Reminder

Hey @jkczyz! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@ldk-reviews-bot

Copy link
Copy Markdown

🔔 7th Reminder

Hey @jkczyz! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@ldk-reviews-bot

Copy link
Copy Markdown

🔔 8th Reminder

Hey @jkczyz! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@ldk-reviews-bot

Copy link
Copy Markdown

🔔 9th Reminder

Hey @jkczyz! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@ldk-reviews-bot

Copy link
Copy Markdown

🔔 10th Reminder

Hey @jkczyz! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@ldk-reviews-bot

Copy link
Copy Markdown

🔔 11th Reminder

Hey @jkczyz! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@ldk-reviews-bot

Copy link
Copy Markdown

🔔 12th Reminder

Hey @jkczyz! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@ldk-reviews-bot

Copy link
Copy Markdown

🔔 13th Reminder

Hey @jkczyz! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

@ldk-reviews-bot

Copy link
Copy Markdown

🔔 14th Reminder

Hey @jkczyz! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

Comment threadlightning/src/ln/channelmanager.rs Outdated
Comment threadlightning/src/ln/onion_utils.rs Outdated
Comment threadlightning/src/ln/onion_utils.rs Outdated
Comment threadlightning/src/ln/onion_utils.rs Outdated
Comment threadlightning/src/blinded_path/payment.rs Outdated
Comment threadlightning/src/blinded_path/payment.rs Outdated
Comment threadlightning/src/offers/signer.rs
@ldk-reviews-bot

Copy link
Copy Markdown

👋 The first review has been submitted!

Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer.

@shaavan

Copy link
Copy Markdown
MemberAuthor

Updated.02 → .03

Thanks @jkczyz - changes:

  • Test cleanups
  • Various documentation changes.

@shaavan
shaavanforce-pushed the aad-payment branch 2 times, most recently from acbadec to 18e6b33CompareNovember 4, 2025 15:21
@shaavan

Copy link
Copy Markdown
MemberAuthor

Rebased.03 → .04

@shaavan

Copy link
Copy Markdown
MemberAuthor

Rebased.04 → .05

@TheBlueMattTheBlueMatt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment threadlightning/src/blinded_path/payment.rs Outdated
Comment threadlightning/src/ln/msgs.rs Outdated
Comment threadlightning/src/offers/signer.rs
@shaavan

Copy link
Copy Markdown
MemberAuthor

Updated.05 → .06

Thanks @TheBlueMatt — changes:

  • Added used_aad check in decrypt_intro_payload
  • Restored HMAC variable names for clarity on reuse risk
  • Moved used_aad check to read-time to simplify downstream logic

@jkczyzjkczyz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Mostly some nits but one is needed to be addressed to fix CI.

Comment threadlightning/src/ln/onion_payment.rs Outdated
Comment threadlightning/src/ln/channelmanager.rs Outdated
Comment threadlightning/src/blinded_path/payment.rs
Comment threadlightning/src/blinded_path/payment.rs Outdated
Comment threadlightning/src/blinded_path/payment.rs Outdated
@shaavan

Copy link
Copy Markdown
MemberAuthor

Updated:.06 → .07

Thanks @jkczyz — changes:

  • Removed unrelated edits from onion_payment.rs
  • Fix lint errors
  • Rename receive_auth_keylocal_node_receive_key (match message.rs)
  • Doc nits

Comment threadlightning/src/routing/router.rs Outdated
Comment threadlightning/src/ln/onion_utils.rs Outdated
Extends the work started in
[PR#3917](lightningdevkit#3917)
by adding ReceiveAuthKey-based verification for Blinded Payment Paths.
This reduces space previously taken by individual ReceiveTlvs and
aligns the verification logic with that used for Blinded Message Paths.
Now that we have introduced an alternate mechanism for authentication
in the codebase, we can safely remove the now redundant (hmac, nonce)
fields from the Payment ReceiveTlvs's while maintaining the security
of the onion messages.
@shaavan

Copy link
Copy Markdown
MemberAuthor

Updated:.07 → .08

Thanks @jkczyz — changes:

  1. Removed now redundant LocalHTLCFailureReason variant.
  2. Minor documentation fixes.

@TheBlueMattTheBlueMatt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hell yea net code removal!

@TheBlueMatt
TheBlueMatt merged commit 6d0254c into lightningdevkit:mainNov 14, 2025
26 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@shaavan@ldk-reviews-bot@TheBlueMatt@jkczyz