') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); Route blinding: support forwarding as the intro node by valentinewallace · Pull Request #2540 · lightningdevkit/rust-lightning · GitHub
Skip to content

Route blinding: support forwarding as the intro node - #2540

Merged
valentinewallace merged 22 commits into
lightningdevkit:mainfrom
valentinewallace:2023-08-blinded-errors
Dec 1, 2023
Merged

Route blinding: support forwarding as the intro node#2540
valentinewallace merged 22 commits into
lightningdevkit:mainfrom
valentinewallace:2023-08-blinded-errors

Conversation

@valentinewallace

@valentinewallacevalentinewallace commented Aug 29, 2023

Copy link
Copy Markdown
Contributor

Adds support for being the intro node to a blinded path. As such, we won't advertise route blinding support in our feature bits yet.

The next PR (#2688) adds support for receiving to a multi-hop blinded path, to be followed by complete blinded forwarding support. #2688 also adds testing for the success case of forwarding-as-intro.

Helps address #1970.

Based on #2514, #2413

@codecov-commenter

codecov-commenter commented Aug 29, 2023

Copy link
Copy Markdown

Codecov Report

Attention: 56 lines in your changes are missing coverage. Please review.

Comparison is base (f07f4b9) 88.57% compared to head (6af786a) 88.63%.

FilesPatch %Lines
lightning/src/ln/onion_utils.rs37.03%6 Missing and 11 partials ⚠️
lightning/src/ln/onion_payment.rs76.92%7 Missing and 5 partials ⚠️
lightning/src/ln/channel.rs91.72%3 Missing and 8 partials ⚠️
lightning/src/ln/channelmanager.rs80.00%9 Missing and 2 partials ⚠️
lightning/src/ln/blinded_payment_tests.rs98.93%3 Missing ⚠️
lightning/src/ln/msgs.rs87.50%2 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@ Coverage Diff @@## main #2540 +/- ##
==========================================
+ Coverage 88.57% 88.63% +0.05% 
==========================================
Files 115 115 Lines 89479 90023 +544 Branches 89479 90023 +544 ==========================================
+ Hits 79258 79788 +530 + Misses 7858 7840 -18 - Partials 2363 2395 +32 

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

@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.

Quick glance, nothing wild

Comment threadlightning/src/ln/channelmanager.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channel.rs Outdated
@TheBlueMatt

Copy link
Copy Markdown
Collaborator

Also, what should/are we doing about blinded tails on probe calls? Presumably we should just drop the blinded tail or tweak the parameter to not included blinded tails?

Comment threadlightning/src/ln/blinded_payment_tests.rs Outdated
@valentinewallacevalentinewallace changed the title Error handling for blinded paymentsRoute blinding: forwarding and error handlingSep 8, 2023
@valentinewallacevalentinewallace modified the milestones: 0.0.117, 0.0.118Sep 11, 2023
@valentinewallacevalentinewallace mentioned this pull request Sep 11, 2023
60 tasks
@jkczyz
jkczyz self-requested a review September 22, 2023 17:33
@TheBlueMattTheBlueMatt modified the milestones: 0.0.118, 0.0.119Oct 12, 2023
@jkczyzjkczyz mentioned this pull request Oct 23, 2023
@valentinewallacevalentinewallace changed the title Route blinding: forwarding and error handlingRoute blinding: support forwarding as the intro nodeOct 26, 2023
@valentinewallace
valentinewallaceforce-pushed the 2023-08-blinded-errors branch 3 times, most recently from 29b1d33 to 9c171a7CompareOctober 31, 2023 17:30
@valentinewallace

Copy link
Copy Markdown
ContributorAuthor

Expanded test coverage a bit and broke out a few more commits. Think this is ready for review.

@valentinewallace
valentinewallace marked this pull request as ready for review October 31, 2023 17:32

@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.

Still working through some of the commits

Comment threadlightning/src/ln/channel.rs Outdated
Comment threadlightning/src/ln/channelmanager.rs
Comment threadlightning/src/ln/channelmanager.rs Outdated
Comment threadlightning/src/ln/channelmanager.rs Outdated
Comment threadlightning/src/ln/channelmanager.rs Outdated
Comment threadlightning/src/ln/channelmanager.rs Outdated
@valentinewallace

valentinewallace commented Nov 29, 2023

Copy link
Copy Markdown
ContributorAuthor

Noted the follow-ups here: #2540 (review) in #1970.

Also, squashed.

A blinding point is provided in update_add_htlc messages if we are relaying or
receiving a payment within a blinded path, to decrypt the onion routing packet
and the recipient-provided encrypted payload within. Will be used in upcoming
commits.
Will be used in the next commit to parse onion errors from blinded paths in
tests only.
So we can make sure they're encoded properly.
A blinding point is provided in update_add_htlc messages if we are relaying or
receiving a payment within a blinded path, to decrypt the onion routing packet
and the recipient-provided encrypted payload within. Will be used in upcoming
commits.
We need to store the inbound blinding point in PendingHTLCRouting in order to
calculate the outbound blinding point.
The new BlindedForward struct will be augmented when we add support for
forwarding as a non-intro node.
Useful so we know to fail blinded intro node HTLCs back with an
invalid_onion_blinding error per BOLT 4.
Another variant will be added to the new Blinded enum when we support
receiving/forwarding as a non-intro node.
Useful so we know to fail back blinded HTLCs where we are the intro node with
the invalid_onion_blinding error per BOLT 4.
We don't set this field for blinded received HTLCs because we don't support
receiving to multi-hop blinded paths yet, and there's no point in setting it
for HTLCs received to 1-hop blinded paths because per the spec they should fail
back using an unblinded error code.
Used in the next commit to set the update_add blinding point on HTLC forward.
Used by the next hop to decode their blinded onion payload.
Previously, we only parsed blinded receive payloads.
@TheBlueMatt

Copy link
Copy Markdown
Collaborator

Needs rebase.

/// generated using `get_fake_scid` from the scid_utils::fake_scid module.
short_channel_id: u64, // This should be NonZero<u64> eventually when we bump MSRV
/// Set if this HTLC is being forwarded within a blinded path.
blinded: Option<BlindedForward>,

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.

Ah, this is public now, we should include a bit more details about why this is here and what its used for. Happy to just do that in #2762.

@valentinewallacevalentinewallaceNov 30, 2023

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Good point, doing it in #2762 sgtm. FWIW, there are more detailed docs on the BlindedForward struct itself.

@valentinewallace
valentinewallace merged commit 74bc9e2 into lightningdevkit:mainDec 1, 2023
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

@valentinewallace@codecov-commenter@TheBlueMatt@jkczyz