Skip to content
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

Support constructing blinded path onion keys #2411

Merged

Conversation

valentinewallace
Copy link
Contributor

@valentinewallace valentinewallace commented Jul 13, 2023

Lays some groundwork for route blinding support, helping address #1970.

Prior to this PR we would only construct onion keys for unblinded path hops, and also only parse onion failures from unblinded path hops. This is tested in #2413.

This was referenced Jul 13, 2023
@valentinewallace valentinewallace added this to the 0.0.117 milestone Jul 13, 2023
@codecov-commenter
Copy link

codecov-commenter commented Jul 13, 2023

Codecov Report

Patch coverage: 87.02% and project coverage change: +0.67% 🎉

Comparison is base (131560e) 90.35% compared to head (80a949d) 91.02%.
Report is 21 commits behind head on main.

❗ Current head 80a949d differs from pull request most recent head 7b31712. Consider uploading reports for the commit 7b31712 to get more accurate results

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2411      +/-   ##
==========================================
+ Coverage   90.35%   91.02%   +0.67%     
==========================================
  Files         106      106              
  Lines       56242    62890    +6648     
  Branches    56242    62890    +6648     
==========================================
+ Hits        50816    57246    +6430     
- Misses       5426     5644     +218     
Files Changed Coverage Δ
lightning/src/ln/onion_utils.rs 91.11% <86.29%> (-0.17%) ⬇️
lightning/src/blinded_path/mod.rs 95.18% <100.00%> (+0.92%) ⬆️
lightning/src/ln/channelmanager.rs 89.15% <100.00%> (+3.47%) ⬆️
lightning/src/onion_message/messenger.rs 86.51% <100.00%> (+0.66%) ⬆️

... and 19 files with indirect coverage changes

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

Copy link
Contributor

@alecchendev alecchendev left a comment

Choose a reason for hiding this comment

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

Looks pretty good!

lightning/src/ln/onion_utils.rs Outdated Show resolved Hide resolved
lightning/src/ln/onion_utils.rs Show resolved Hide resolved
lightning/src/ln/onion_utils.rs Outdated Show resolved Hide resolved
lightning/src/ln/onion_utils.rs Outdated Show resolved Hide resolved
@valentinewallace
Copy link
Contributor Author

CI failure is #2385.

@dunxen dunxen self-requested a review July 21, 2023 08:14
@valentinewallace valentinewallace force-pushed the 2023-07-blinded-onion-keys branch 2 times, most recently from d230f57 to b694acd Compare July 24, 2023 22:19
@valentinewallace
Copy link
Contributor Author

Rebased to fix CI.

lightning/src/ln/onion_utils.rs Outdated Show resolved Hide resolved
lightning/src/ln/onion_utils.rs Outdated Show resolved Hide resolved
lightning/src/ln/onion_utils.rs Outdated Show resolved Hide resolved
lightning/src/ln/onion_utils.rs Show resolved Hide resolved
lightning/src/ln/onion_utils.rs Outdated Show resolved Hide resolved
lightning/src/ln/outbound_payment.rs Outdated Show resolved Hide resolved
let route_hop = match route_hop_opt {
Some(hop) => hop,
None => {
res = Some((None, None, true));
Copy link
Contributor

Choose a reason for hiding this comment

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

For all these lines where we set res = Some((None, None, true)); when the error is from a blinded hop, do we set them to be retryable just because we don't have a way of knowing otherwise?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, if we return payment_retryable = false here then we mark the payment as abandoned in outbound_payment, which would be bad since it would prevent further payment retries. A payment is only not retryable if the recipient explicitly rejects it, which we have no way of knowing with blinded path errors.

Get rid of a bunch of indentation and be more idiomatic.
And fix an its vs it's grammar
Copy link
Contributor

@alecchendev alecchendev left a comment

Choose a reason for hiding this comment

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

Wondering was there any reason the "Add missing test coverage for bogus err packet with valid hmac" and "Struct-ify decoded onion failures" commits got dropped?

@valentinewallace
Copy link
Contributor Author

Wondering was there any reason the "Add missing test coverage for bogus err packet with valid hmac" and "Struct-ify decoded onion failures" commits got dropped?

I was planning to split them into a different PR with another onion failure decode refactor, but ended up tabling that refactor for now. So, I re-added them here, sorry for the confusion lol.

lightning/src/ln/onion_utils.rs Outdated Show resolved Hide resolved
lightning/src/ln/onion_utils.rs Outdated Show resolved Hide resolved
We don't bother actually parsing errors from within a blinded path, since all
errors should be wiped by the introduction node by the time it gets back to us
(the sender).
Useful for generating a next hop blinding point when forwarding a blinded
payment.
To avoid several long hard-to-read tuple return values.
@TheBlueMatt TheBlueMatt merged commit 4fb5708 into lightningdevkit:main Aug 22, 2023
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants