-
Notifications
You must be signed in to change notification settings - Fork 421
Introduce Dummy Hop support for Blinded Payment Path #4152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
👋 Thanks for assigning @TheBlueMatt as a reviewer! |
|
The implementation is still in progress. The parsing logic that mitigates timing-based attacks is being refined. Once that’s settled, this PR will be ready for review. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #4152 +/- ##
==========================================
+ Coverage 89.32% 89.34% +0.01%
==========================================
Files 180 180
Lines 138329 138873 +544
Branches 138329 138873 +544
==========================================
+ Hits 123566 124070 +504
- Misses 12157 12174 +17
- Partials 2606 2629 +23
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
TheBlueMatt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay!
| let tlvs = intermediate_nodes | ||
| .iter() | ||
| .map(|node| BlindedPaymentTlvsRef::Forward(&node.tlvs)) | ||
| .chain((0..dummy_count).map(|_| BlindedPaymentTlvsRef::Dummy(&PaymentDummyTlv))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a debug-assert that the forward hops and the dummy hops (ie all hops except the last) end up with the same length after padding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, I’ll add that in the next update. Thanks for pointing it out!
|
Updated: .01 → .02 SummaryThis iteration introduces dummy hops before the actual receiver in a blinded path. The goal is to defend against potential timing side-channels at the receiver.
Conceptually this works, but it leads to two concrete issues, surfaced by failing tests. Test Failures1.
|
|
Updated: .02 → .03 ChangesAccount for an existing fee-handling trade-off in LDK that leads to a small, intentional overpayment when the payer is the introduction node of a blinded path. This restores the DetailsLDK already has a known quirk in blinded-path handling:
In the classic two-hop case where (payer as introduction node → payee), this overpayment used to be manually avoided in tests (see router.rs L1754–1756), because the path length was unambiguous and the introduction node could safely treat the effective fee as zero. With the introduction of dummy hops, that assumption no longer holds:
Rather than change LDK’s fee semantics in this PR, I’ve chosen to make this overpayment explicit in the test framework and document the reasoning clearly. Once the underlying fee trade-off is revisited in LDK, this temporary adjustment can be removed with minimal changes. |
|
Rebased: .03 → .04 |
This shouldn't be an issue? We should be failing all blinded path receives with Re: the fee issues, yea, its something we'll have to handle, but in practice what should happen is that we pick a route with a non-zero fee, then we go to pay it and when we start unwrapping the onion we notice that the fee is for us, allowing us to reclaim the funds. Interestingly, this is a bit of a privacy leak - if the sender and the intro node are the same they can intuit that the remaining hops are blinded. Dunno if its worth doing anything about but we could add fees for the blinded hops. |
|
Updated: .04 → .05 Changes:
Thanks a lot Matt, that comment really helped clear things up. I had been assuming the existing test behaviour should stay the same even after introducing dummy hops, but your note made me rethink that. In Once dummy hops are in the mix though, the failure no longer originates at the intro node. It surfaces from a deeper Updated the test accordingly. Thanks again! |
|
Updated: .05 → .06 Changes:Cleaned up the commits for clarity and flow. NoteWith this update, the first full version of Payment Dummy Hops for Blinded Payment Path receive is finally in place. The dummy-hop support for TrampolineBlindedReceive will follow in a separate PR. |
Dummy BlindedPaymentTlvs is an empty TLV inserted immediately before the actual ReceiveTlvs in a blinded path. Receivers treat these dummy hops as real hops, which prevents timing-based attacks. Allowing arbitrary dummy hops before the final ReceiveTlvs obscures the recipient's true position in the route and makes it harder for an onlooker to infer the destination, strengthening recipient privacy.
Adds a new constructor for blinded paths that allows specifying the number of dummy hops. This enables users to insert arbitrary hops before the real destination, enhancing privacy by making it harder to infer the sender–receiver distance or identify the final destination. Lays the groundwork for future use of dummy hops in blinded path construction.
NextPacketDetails currently bundles four fields used to define the forwarding details for the packet. With the introduction of dummy hops, not all of these fields apply in those paths. To avoid overloading NextPacketDetails with conditional semantics, this refactor extracts the forwarding-specific pieces into a dedicated ForwardInfo struct. This keeps the data model clean, reusable, and makes the logic around dummy hops easier to follow.
Upcoming commits will need the ability to specify whether a blinded path contains dummy hops. This change adds that support to the testing framework ahead of time, so later tests can express dummy-hop scenarios explicitly.
|
Updated: .06 → .07 Addressed @TheBlueMatt’s comment — updates:
|
Builds on #4126
This PR adds Dummy Hop support for Blinded Payment Paths, paralleling the dummy-hop feature introduced for Blinded Message Paths in #3726.
By allowing arbitrary dummy hops before the real ReceiveTlvs, the length of a Blinded Payment Path can be increased to create a larger search space for an attacker trying to locate the true recipient. This reduces the risk of timing and position based deanonymization and improves user privacy.