Skip to content

Implement route blinding test vectors - #3204

Merged
TheBlueMatt merged 4 commits into
lightningdevkit:mainfrom
valentinewallace:2024-07-rb-test-vectors
Aug 19, 2024
Merged

Implement route blinding test vectors #3204
TheBlueMatt merged 4 commits into
lightningdevkit:mainfrom
valentinewallace:2024-07-rb-test-vectors

Conversation

@valentinewallace

@valentinewallacevalentinewallace commented Jul 24, 2024

Copy link
Copy Markdown
Contributor

See https://github.com/lightning/bolts/blob/3fffab3b889c9a6818130b56fb6dcfdf6906f90e/bolt04/route-blinding-test.json for test vectors.

This also adds support for next_blinding_override in blinded payment paths, and fixes a ser bug for blinded hop features.

  • Release note

@valentinewallacevalentinewallace mentioned this pull request Jul 24, 2024
60 tasks
@codecov

codecovBot commented Jul 24, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 92.08633% with 22 lines in your changes missing coverage. Please review.

Project coverage is 90.21%. Comparing base (8fe3a56) to head (6f6115f).
Report is 44 commits behind head on main.

FilesPatch %Lines
lightning/src/ln/blinded_payment_tests.rs91.34%7 Missing and 13 partials ⚠️
lightning/src/blinded_path/payment.rs90.00%1 Missing ⚠️
lightning/src/ln/channelmanager.rs91.66%1 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #3204 +/- ##
==========================================
+ Coverage 89.73% 90.21% +0.48% 
==========================================
Files 123 124 +1 Lines 102287 106656 +4369 Branches 102287 106656 +4369 ==========================================
+ Hits 91784 96223 +4439 + Misses 7807 7759 -48 + Partials 2696 2674 -22 

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

@TheBlueMattTheBlueMatt added this to the 0.0.124 milestone Aug 7, 2024

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

Needs to go in a release soon for the features thing, right?

pub features: BlindedHopFeatures,
/// Set if this [`BlindedPath`] is concatenated to another, to indicate the
/// [`BlindedPath::blinding_point`] of the appended blinded path.
pub next_blinding_override: Option<PublicKey>,

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.

Why didn't we support this to begin with?

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.

IIRC I was under the impression that this field only applies to onion messages (it's required for OMs), not payments. And no one actually sets it for payments, so it never popped up in interop testing. :/

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.

I imagine no one set it ever, because its only useful for some kind of weird frankenstein trampoline afaict? What's the intended usecase for concatenating blinded paths? I mean I suppose we should just do it, but I'm curious why its there.

@valentinewallacevalentinewallaceAug 7, 2024

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.

I think Rusty pointed out here that it can help prevent the intro node from being aware that it's the intro node: lightning/bolts#1182 (comment)? I think this is clarified in lightning/bolts#1182 but still need to review that.

Edit: it is clarified quite a bit in that PR:
Screenshot 2024-08-07 at 3 18 29 PM

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, so basically its saying we should send onion messages as a blinded path from us to the intro node, prepended to the real blinded path? Do we do that?

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.

Yes, using next_blinding_override in OMs has always been required to prepend the unblinded path to the intro node.

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.

Oops, I think I misread your message. I'm not sure I follow Rusty's logic, actually. It seems like creating a blinded path from us to the intro node trades off the intro node knowing that they're the intro node for the node prior to the intro node knowing that the next hop is the intro node(?). Unless we set next_blinding_override for every hop in our prepended blinded path, which I suppose is possible.

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, I guess I'm still not really understanding why this is here, but its not much complexity to support, sooooo

TheBlueMatt
TheBlueMatt previously approved these changes Aug 14, 2024
@jkczyz
jkczyz self-requested a review August 16, 2024 15:47
jkczyz
jkczyz previously approved these changes Aug 16, 2024
@valentinewallace

Copy link
Copy Markdown
ContributorAuthor

Rebased due to conflicts.

impl_feature_write_without_length!(ChannelTypeFeatures);
impl_feature_write_without_length!(InvoiceRequestFeatures);
impl_feature_write_without_length!(OfferFeatures);
impl_feature_write_without_length!(BlindedHopFeatures);

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.

Had to add this line to the feature ser fix due to changes in commit 0c5922e92a3ec3fdf9226cceeb9057ad9aa9dc19.

jkczyz
jkczyz previously approved these changes Aug 16, 2024
@TheBlueMatt

Copy link
Copy Markdown
Collaborator
error: public documentation for `next_blinding_override` links to private item `BlindedPath`
--> lightning/src/blinded_path/payment.rs:204:20
|
204 | /// Set if this [`BlindedPath`] is concatenated to another, to indicate the
| ^^^^^^^^^^^ this item is private

@valentinewallace

Copy link
Copy Markdown
ContributorAuthor

Had a rebase error, squashed change with the following diff:

diff --git a/lightning/src/blinded_path/payment.rs b/lightning/src/blinded_path/payment.rs
index 10d5d8de0..ca937c57d 100644
--- a/lightning/src/blinded_path/payment.rs+++ b/lightning/src/blinded_path/payment.rs@@ -201,8 +201,8 @@ pub struct ForwardTlvs {
///
/// [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload
pub features: BlindedHopFeatures,
- /// Set if this [`BlindedPath`] is concatenated to another, to indicate the- /// [`BlindedPath::blinding_point`] of the appended blinded path.+ /// Set if this [`BlindedPaymentPath`] is concatenated to another, to indicate the+ /// [`BlindedPaymentPath::blinding_point`] of the appended blinded path.
pub next_blinding_override: Option<PublicKey>,
}
diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs
index 2054e4e8e..e08b45558 100644
--- a/lightning/src/ln/channelmanager.rs+++ b/lightning/src/ln/channelmanager.rs@@ -227,8 +227,8 @@ pub struct BlindedForward {
/// the introduction node.
pub failure: BlindedFailure,
/// Overrides the next hop's [`msgs::UpdateAddHTLC::blinding_point`]. Set if this HTLC is being
- /// forwarded within a [`BlindedPath`] that was concatenated to another blinded path that starts- /// at the next hop.+ /// forwarded within a [`BlindedPaymentPath`] that was concatenated to another blinded path that+ /// starts at the next hop.
pub next_blinding_override: Option<PublicKey>,
}

jkczyz
jkczyz previously approved these changes Aug 19, 2024
@TheBlueMatt

Copy link
Copy Markdown
Collaborator
 error[E0063]: missing field `next_blinding_override` in initializer of `ForwardTlvs`
--> src/invoice_request_deser.rs:104:9
|
104 | tlvs: ForwardTlvs {
| ^^^^^^^^^^^ missing `next_blinding_override`
error[E0063]: missing field `next_blinding_override` in initializer of `ForwardTlvs`
--> src/refund_deser.rs:82:9
|
82 | tlvs: ForwardTlvs {
| ^^^^^^^^^^^ missing `next_blinding_override

This allow us to forward blinded payments where the blinded path that we are
forwarding within was concatenated to another blinded path that starts at the
next hop.
Also allows constructing blinded paths using this override.
We were writing a length redundantly...
No reason to take a reference to a Deref.
@valentinewallace

Copy link
Copy Markdown
ContributorAuthor
diff --git a/fuzz/src/invoice_request_deser.rs b/fuzz/src/invoice_request_deser.rs
index a5db1c4be..3abb0974e 100644
--- a/fuzz/src/invoice_request_deser.rs+++ b/fuzz/src/invoice_request_deser.rs@@ -113,6 +113,7 @@ fn build_response<T: secp256k1::Signing + secp256k1::Verification>(
htlc_minimum_msat: 100,
},
features: BlindedHopFeatures::empty(),
+ next_blinding_override: None,
},
node_id: pubkey(43),
htlc_maximum_msat: 1_000_000_000_000,
diff --git a/fuzz/src/refund_deser.rs b/fuzz/src/refund_deser.rs
index 58dc68eed..17f255081 100644
--- a/fuzz/src/refund_deser.rs+++ b/fuzz/src/refund_deser.rs@@ -91,6 +91,7 @@ fn build_response<T: secp256k1::Signing + secp256k1::Verification>(
htlc_minimum_msat: 100,
},
features: BlindedHopFeatures::empty(),
+ next_blinding_override: None,
},
node_id: pubkey(43),
htlc_maximum_msat: 1_000_000_000_000,

@TheBlueMatt
TheBlueMatt merged commit fb4403f into lightningdevkit:mainAug 19, 2024
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.

3 participants

@valentinewallace@TheBlueMatt@jkczyz
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Implement route blinding test vectors by valentinewallace · Pull Request #3204 · lightningdevkit/rust-lightning · GitHub
Skip to content

Implement route blinding test vectors - #3204

Merged
TheBlueMatt merged 4 commits into
lightningdevkit:mainfrom
valentinewallace:2024-07-rb-test-vectors
Aug 19, 2024
Merged

Implement route blinding test vectors #3204
TheBlueMatt merged 4 commits into
lightningdevkit:mainfrom
valentinewallace:2024-07-rb-test-vectors

Conversation

@valentinewallace

@valentinewallacevalentinewallace commented Jul 24, 2024

Copy link
Copy Markdown
Contributor

See https://github.com/lightning/bolts/blob/3fffab3b889c9a6818130b56fb6dcfdf6906f90e/bolt04/route-blinding-test.json for test vectors.

This also adds support for next_blinding_override in blinded payment paths, and fixes a ser bug for blinded hop features.

  • Release note

@valentinewallacevalentinewallace mentioned this pull request Jul 24, 2024
60 tasks
@codecov

codecovBot commented Jul 24, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 92.08633% with 22 lines in your changes missing coverage. Please review.

Project coverage is 90.21%. Comparing base (8fe3a56) to head (6f6115f).
Report is 44 commits behind head on main.

FilesPatch %Lines
lightning/src/ln/blinded_payment_tests.rs91.34%7 Missing and 13 partials ⚠️
lightning/src/blinded_path/payment.rs90.00%1 Missing ⚠️
lightning/src/ln/channelmanager.rs91.66%1 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #3204 +/- ##
==========================================
+ Coverage 89.73% 90.21% +0.48% 
==========================================
Files 123 124 +1 Lines 102287 106656 +4369 Branches 102287 106656 +4369 ==========================================
+ Hits 91784 96223 +4439 + Misses 7807 7759 -48 + Partials 2696 2674 -22 

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

@TheBlueMattTheBlueMatt added this to the 0.0.124 milestone Aug 7, 2024

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

Needs to go in a release soon for the features thing, right?

pub features: BlindedHopFeatures,
/// Set if this [`BlindedPath`] is concatenated to another, to indicate the
/// [`BlindedPath::blinding_point`] of the appended blinded path.
pub next_blinding_override: Option<PublicKey>,

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.

Why didn't we support this to begin with?

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.

IIRC I was under the impression that this field only applies to onion messages (it's required for OMs), not payments. And no one actually sets it for payments, so it never popped up in interop testing. :/

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.

I imagine no one set it ever, because its only useful for some kind of weird frankenstein trampoline afaict? What's the intended usecase for concatenating blinded paths? I mean I suppose we should just do it, but I'm curious why its there.

@valentinewallacevalentinewallaceAug 7, 2024

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.

I think Rusty pointed out here that it can help prevent the intro node from being aware that it's the intro node: lightning/bolts#1182 (comment)? I think this is clarified in lightning/bolts#1182 but still need to review that.

Edit: it is clarified quite a bit in that PR:
Screenshot 2024-08-07 at 3 18 29 PM

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, so basically its saying we should send onion messages as a blinded path from us to the intro node, prepended to the real blinded path? Do we do that?

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.

Yes, using next_blinding_override in OMs has always been required to prepend the unblinded path to the intro node.

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.

Oops, I think I misread your message. I'm not sure I follow Rusty's logic, actually. It seems like creating a blinded path from us to the intro node trades off the intro node knowing that they're the intro node for the node prior to the intro node knowing that the next hop is the intro node(?). Unless we set next_blinding_override for every hop in our prepended blinded path, which I suppose is possible.

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, I guess I'm still not really understanding why this is here, but its not much complexity to support, sooooo

TheBlueMatt
TheBlueMatt previously approved these changes Aug 14, 2024
@jkczyz
jkczyz self-requested a review August 16, 2024 15:47
jkczyz
jkczyz previously approved these changes Aug 16, 2024
@valentinewallace

Copy link
Copy Markdown
ContributorAuthor

Rebased due to conflicts.

impl_feature_write_without_length!(ChannelTypeFeatures);
impl_feature_write_without_length!(InvoiceRequestFeatures);
impl_feature_write_without_length!(OfferFeatures);
impl_feature_write_without_length!(BlindedHopFeatures);

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.

Had to add this line to the feature ser fix due to changes in commit 0c5922e92a3ec3fdf9226cceeb9057ad9aa9dc19.

jkczyz
jkczyz previously approved these changes Aug 16, 2024
@TheBlueMatt

Copy link
Copy Markdown
Collaborator
error: public documentation for `next_blinding_override` links to private item `BlindedPath`
--> lightning/src/blinded_path/payment.rs:204:20
|
204 | /// Set if this [`BlindedPath`] is concatenated to another, to indicate the
| ^^^^^^^^^^^ this item is private

@valentinewallace

Copy link
Copy Markdown
ContributorAuthor

Had a rebase error, squashed change with the following diff:

diff --git a/lightning/src/blinded_path/payment.rs b/lightning/src/blinded_path/payment.rs
index 10d5d8de0..ca937c57d 100644
--- a/lightning/src/blinded_path/payment.rs+++ b/lightning/src/blinded_path/payment.rs@@ -201,8 +201,8 @@ pub struct ForwardTlvs {
///
/// [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload
pub features: BlindedHopFeatures,
- /// Set if this [`BlindedPath`] is concatenated to another, to indicate the- /// [`BlindedPath::blinding_point`] of the appended blinded path.+ /// Set if this [`BlindedPaymentPath`] is concatenated to another, to indicate the+ /// [`BlindedPaymentPath::blinding_point`] of the appended blinded path.
pub next_blinding_override: Option<PublicKey>,
}
diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs
index 2054e4e8e..e08b45558 100644
--- a/lightning/src/ln/channelmanager.rs+++ b/lightning/src/ln/channelmanager.rs@@ -227,8 +227,8 @@ pub struct BlindedForward {
/// the introduction node.
pub failure: BlindedFailure,
/// Overrides the next hop's [`msgs::UpdateAddHTLC::blinding_point`]. Set if this HTLC is being
- /// forwarded within a [`BlindedPath`] that was concatenated to another blinded path that starts- /// at the next hop.+ /// forwarded within a [`BlindedPaymentPath`] that was concatenated to another blinded path that+ /// starts at the next hop.
pub next_blinding_override: Option<PublicKey>,
}

jkczyz
jkczyz previously approved these changes Aug 19, 2024
@TheBlueMatt

Copy link
Copy Markdown
Collaborator
 error[E0063]: missing field `next_blinding_override` in initializer of `ForwardTlvs`
--> src/invoice_request_deser.rs:104:9
|
104 | tlvs: ForwardTlvs {
| ^^^^^^^^^^^ missing `next_blinding_override`
error[E0063]: missing field `next_blinding_override` in initializer of `ForwardTlvs`
--> src/refund_deser.rs:82:9
|
82 | tlvs: ForwardTlvs {
| ^^^^^^^^^^^ missing `next_blinding_override

This allow us to forward blinded payments where the blinded path that we are
forwarding within was concatenated to another blinded path that starts at the
next hop.
Also allows constructing blinded paths using this override.
We were writing a length redundantly...
No reason to take a reference to a Deref.
@valentinewallace

Copy link
Copy Markdown
ContributorAuthor
diff --git a/fuzz/src/invoice_request_deser.rs b/fuzz/src/invoice_request_deser.rs
index a5db1c4be..3abb0974e 100644
--- a/fuzz/src/invoice_request_deser.rs+++ b/fuzz/src/invoice_request_deser.rs@@ -113,6 +113,7 @@ fn build_response<T: secp256k1::Signing + secp256k1::Verification>(
htlc_minimum_msat: 100,
},
features: BlindedHopFeatures::empty(),
+ next_blinding_override: None,
},
node_id: pubkey(43),
htlc_maximum_msat: 1_000_000_000_000,
diff --git a/fuzz/src/refund_deser.rs b/fuzz/src/refund_deser.rs
index 58dc68eed..17f255081 100644
--- a/fuzz/src/refund_deser.rs+++ b/fuzz/src/refund_deser.rs@@ -91,6 +91,7 @@ fn build_response<T: secp256k1::Signing + secp256k1::Verification>(
htlc_minimum_msat: 100,
},
features: BlindedHopFeatures::empty(),
+ next_blinding_override: None,
},
node_id: pubkey(43),
htlc_maximum_msat: 1_000_000_000_000,

@TheBlueMatt
TheBlueMatt merged commit fb4403f into lightningdevkit:mainAug 19, 2024
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.

3 participants

@valentinewallace@TheBlueMatt@jkczyz
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' Implement route blinding test vectors by valentinewallace · Pull Request #3204 · lightningdevkit/rust-lightning · GitHub
Skip to content

Implement route blinding test vectors - #3204

Merged
TheBlueMatt merged 4 commits into
lightningdevkit:mainfrom
valentinewallace:2024-07-rb-test-vectors
Aug 19, 2024
Merged

Implement route blinding test vectors #3204
TheBlueMatt merged 4 commits into
lightningdevkit:mainfrom
valentinewallace:2024-07-rb-test-vectors

Conversation

@valentinewallace

@valentinewallacevalentinewallace commented Jul 24, 2024

Copy link
Copy Markdown
Contributor

See https://github.com/lightning/bolts/blob/3fffab3b889c9a6818130b56fb6dcfdf6906f90e/bolt04/route-blinding-test.json for test vectors.

This also adds support for next_blinding_override in blinded payment paths, and fixes a ser bug for blinded hop features.

  • Release note

@valentinewallacevalentinewallace mentioned this pull request Jul 24, 2024
60 tasks
@codecov

codecovBot commented Jul 24, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 92.08633% with 22 lines in your changes missing coverage. Please review.

Project coverage is 90.21%. Comparing base (8fe3a56) to head (6f6115f).
Report is 44 commits behind head on main.

FilesPatch %Lines
lightning/src/ln/blinded_payment_tests.rs91.34%7 Missing and 13 partials ⚠️
lightning/src/blinded_path/payment.rs90.00%1 Missing ⚠️
lightning/src/ln/channelmanager.rs91.66%1 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #3204 +/- ##
==========================================
+ Coverage 89.73% 90.21% +0.48% 
==========================================
Files 123 124 +1 Lines 102287 106656 +4369 Branches 102287 106656 +4369 ==========================================
+ Hits 91784 96223 +4439 + Misses 7807 7759 -48 + Partials 2696 2674 -22 

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

@TheBlueMattTheBlueMatt added this to the 0.0.124 milestone Aug 7, 2024

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

Needs to go in a release soon for the features thing, right?

pub features: BlindedHopFeatures,
/// Set if this [`BlindedPath`] is concatenated to another, to indicate the
/// [`BlindedPath::blinding_point`] of the appended blinded path.
pub next_blinding_override: Option<PublicKey>,

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.

Why didn't we support this to begin with?

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.

IIRC I was under the impression that this field only applies to onion messages (it's required for OMs), not payments. And no one actually sets it for payments, so it never popped up in interop testing. :/

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.

I imagine no one set it ever, because its only useful for some kind of weird frankenstein trampoline afaict? What's the intended usecase for concatenating blinded paths? I mean I suppose we should just do it, but I'm curious why its there.

@valentinewallacevalentinewallaceAug 7, 2024

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.

I think Rusty pointed out here that it can help prevent the intro node from being aware that it's the intro node: lightning/bolts#1182 (comment)? I think this is clarified in lightning/bolts#1182 but still need to review that.

Edit: it is clarified quite a bit in that PR:
Screenshot 2024-08-07 at 3 18 29 PM

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, so basically its saying we should send onion messages as a blinded path from us to the intro node, prepended to the real blinded path? Do we do that?

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.

Yes, using next_blinding_override in OMs has always been required to prepend the unblinded path to the intro node.

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.

Oops, I think I misread your message. I'm not sure I follow Rusty's logic, actually. It seems like creating a blinded path from us to the intro node trades off the intro node knowing that they're the intro node for the node prior to the intro node knowing that the next hop is the intro node(?). Unless we set next_blinding_override for every hop in our prepended blinded path, which I suppose is possible.

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, I guess I'm still not really understanding why this is here, but its not much complexity to support, sooooo

TheBlueMatt
TheBlueMatt previously approved these changes Aug 14, 2024
@jkczyz
jkczyz self-requested a review August 16, 2024 15:47
jkczyz
jkczyz previously approved these changes Aug 16, 2024
@valentinewallace

Copy link
Copy Markdown
ContributorAuthor

Rebased due to conflicts.

impl_feature_write_without_length!(ChannelTypeFeatures);
impl_feature_write_without_length!(InvoiceRequestFeatures);
impl_feature_write_without_length!(OfferFeatures);
impl_feature_write_without_length!(BlindedHopFeatures);

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.

Had to add this line to the feature ser fix due to changes in commit 0c5922e92a3ec3fdf9226cceeb9057ad9aa9dc19.

jkczyz
jkczyz previously approved these changes Aug 16, 2024
@TheBlueMatt

Copy link
Copy Markdown
Collaborator
error: public documentation for `next_blinding_override` links to private item `BlindedPath`
--> lightning/src/blinded_path/payment.rs:204:20
|
204 | /// Set if this [`BlindedPath`] is concatenated to another, to indicate the
| ^^^^^^^^^^^ this item is private

@valentinewallace

Copy link
Copy Markdown
ContributorAuthor

Had a rebase error, squashed change with the following diff:

diff --git a/lightning/src/blinded_path/payment.rs b/lightning/src/blinded_path/payment.rs
index 10d5d8de0..ca937c57d 100644
--- a/lightning/src/blinded_path/payment.rs+++ b/lightning/src/blinded_path/payment.rs@@ -201,8 +201,8 @@ pub struct ForwardTlvs {
///
/// [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload
pub features: BlindedHopFeatures,
- /// Set if this [`BlindedPath`] is concatenated to another, to indicate the- /// [`BlindedPath::blinding_point`] of the appended blinded path.+ /// Set if this [`BlindedPaymentPath`] is concatenated to another, to indicate the+ /// [`BlindedPaymentPath::blinding_point`] of the appended blinded path.
pub next_blinding_override: Option<PublicKey>,
}
diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs
index 2054e4e8e..e08b45558 100644
--- a/lightning/src/ln/channelmanager.rs+++ b/lightning/src/ln/channelmanager.rs@@ -227,8 +227,8 @@ pub struct BlindedForward {
/// the introduction node.
pub failure: BlindedFailure,
/// Overrides the next hop's [`msgs::UpdateAddHTLC::blinding_point`]. Set if this HTLC is being
- /// forwarded within a [`BlindedPath`] that was concatenated to another blinded path that starts- /// at the next hop.+ /// forwarded within a [`BlindedPaymentPath`] that was concatenated to another blinded path that+ /// starts at the next hop.
pub next_blinding_override: Option<PublicKey>,
}

jkczyz
jkczyz previously approved these changes Aug 19, 2024
@TheBlueMatt

Copy link
Copy Markdown
Collaborator
 error[E0063]: missing field `next_blinding_override` in initializer of `ForwardTlvs`
--> src/invoice_request_deser.rs:104:9
|
104 | tlvs: ForwardTlvs {
| ^^^^^^^^^^^ missing `next_blinding_override`
error[E0063]: missing field `next_blinding_override` in initializer of `ForwardTlvs`
--> src/refund_deser.rs:82:9
|
82 | tlvs: ForwardTlvs {
| ^^^^^^^^^^^ missing `next_blinding_override

This allow us to forward blinded payments where the blinded path that we are
forwarding within was concatenated to another blinded path that starts at the
next hop.
Also allows constructing blinded paths using this override.
We were writing a length redundantly...
No reason to take a reference to a Deref.
@valentinewallace

Copy link
Copy Markdown
ContributorAuthor
diff --git a/fuzz/src/invoice_request_deser.rs b/fuzz/src/invoice_request_deser.rs
index a5db1c4be..3abb0974e 100644
--- a/fuzz/src/invoice_request_deser.rs+++ b/fuzz/src/invoice_request_deser.rs@@ -113,6 +113,7 @@ fn build_response<T: secp256k1::Signing + secp256k1::Verification>(
htlc_minimum_msat: 100,
},
features: BlindedHopFeatures::empty(),
+ next_blinding_override: None,
},
node_id: pubkey(43),
htlc_maximum_msat: 1_000_000_000_000,
diff --git a/fuzz/src/refund_deser.rs b/fuzz/src/refund_deser.rs
index 58dc68eed..17f255081 100644
--- a/fuzz/src/refund_deser.rs+++ b/fuzz/src/refund_deser.rs@@ -91,6 +91,7 @@ fn build_response<T: secp256k1::Signing + secp256k1::Verification>(
htlc_minimum_msat: 100,
},
features: BlindedHopFeatures::empty(),
+ next_blinding_override: None,
},
node_id: pubkey(43),
htlc_maximum_msat: 1_000_000_000_000,

@TheBlueMatt
TheBlueMatt merged commit fb4403f into lightningdevkit:mainAug 19, 2024
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.

3 participants

@valentinewallace@TheBlueMatt@jkczyz
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', '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('^' + ".*" + ' Implement route blinding test vectors by valentinewallace · Pull Request #3204 · lightningdevkit/rust-lightning · GitHub
Skip to content

Implement route blinding test vectors - #3204

Merged
TheBlueMatt merged 4 commits into
lightningdevkit:mainfrom
valentinewallace:2024-07-rb-test-vectors
Aug 19, 2024
Merged

Implement route blinding test vectors #3204
TheBlueMatt merged 4 commits into
lightningdevkit:mainfrom
valentinewallace:2024-07-rb-test-vectors

Conversation

@valentinewallace

@valentinewallacevalentinewallace commented Jul 24, 2024

Copy link
Copy Markdown
Contributor

See https://github.com/lightning/bolts/blob/3fffab3b889c9a6818130b56fb6dcfdf6906f90e/bolt04/route-blinding-test.json for test vectors.

This also adds support for next_blinding_override in blinded payment paths, and fixes a ser bug for blinded hop features.

  • Release note

@valentinewallacevalentinewallace mentioned this pull request Jul 24, 2024
60 tasks
@codecov

codecovBot commented Jul 24, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 92.08633% with 22 lines in your changes missing coverage. Please review.

Project coverage is 90.21%. Comparing base (8fe3a56) to head (6f6115f).
Report is 44 commits behind head on main.

FilesPatch %Lines
lightning/src/ln/blinded_payment_tests.rs91.34%7 Missing and 13 partials ⚠️
lightning/src/blinded_path/payment.rs90.00%1 Missing ⚠️
lightning/src/ln/channelmanager.rs91.66%1 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #3204 +/- ##
==========================================
+ Coverage 89.73% 90.21% +0.48% 
==========================================
Files 123 124 +1 Lines 102287 106656 +4369 Branches 102287 106656 +4369 ==========================================
+ Hits 91784 96223 +4439 + Misses 7807 7759 -48 + Partials 2696 2674 -22 

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

@TheBlueMattTheBlueMatt added this to the 0.0.124 milestone Aug 7, 2024

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

Needs to go in a release soon for the features thing, right?

pub features: BlindedHopFeatures,
/// Set if this [`BlindedPath`] is concatenated to another, to indicate the
/// [`BlindedPath::blinding_point`] of the appended blinded path.
pub next_blinding_override: Option<PublicKey>,

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.

Why didn't we support this to begin with?

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.

IIRC I was under the impression that this field only applies to onion messages (it's required for OMs), not payments. And no one actually sets it for payments, so it never popped up in interop testing. :/

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.

I imagine no one set it ever, because its only useful for some kind of weird frankenstein trampoline afaict? What's the intended usecase for concatenating blinded paths? I mean I suppose we should just do it, but I'm curious why its there.

@valentinewallacevalentinewallaceAug 7, 2024

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.

I think Rusty pointed out here that it can help prevent the intro node from being aware that it's the intro node: lightning/bolts#1182 (comment)? I think this is clarified in lightning/bolts#1182 but still need to review that.

Edit: it is clarified quite a bit in that PR:
Screenshot 2024-08-07 at 3 18 29 PM

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, so basically its saying we should send onion messages as a blinded path from us to the intro node, prepended to the real blinded path? Do we do that?

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.

Yes, using next_blinding_override in OMs has always been required to prepend the unblinded path to the intro node.

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.

Oops, I think I misread your message. I'm not sure I follow Rusty's logic, actually. It seems like creating a blinded path from us to the intro node trades off the intro node knowing that they're the intro node for the node prior to the intro node knowing that the next hop is the intro node(?). Unless we set next_blinding_override for every hop in our prepended blinded path, which I suppose is possible.

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, I guess I'm still not really understanding why this is here, but its not much complexity to support, sooooo

TheBlueMatt
TheBlueMatt previously approved these changes Aug 14, 2024
@jkczyz
jkczyz self-requested a review August 16, 2024 15:47
jkczyz
jkczyz previously approved these changes Aug 16, 2024
@valentinewallace

Copy link
Copy Markdown
ContributorAuthor

Rebased due to conflicts.

impl_feature_write_without_length!(ChannelTypeFeatures);
impl_feature_write_without_length!(InvoiceRequestFeatures);
impl_feature_write_without_length!(OfferFeatures);
impl_feature_write_without_length!(BlindedHopFeatures);

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.

Had to add this line to the feature ser fix due to changes in commit 0c5922e92a3ec3fdf9226cceeb9057ad9aa9dc19.

jkczyz
jkczyz previously approved these changes Aug 16, 2024
@TheBlueMatt

Copy link
Copy Markdown
Collaborator
error: public documentation for `next_blinding_override` links to private item `BlindedPath`
--> lightning/src/blinded_path/payment.rs:204:20
|
204 | /// Set if this [`BlindedPath`] is concatenated to another, to indicate the
| ^^^^^^^^^^^ this item is private

@valentinewallace

Copy link
Copy Markdown
ContributorAuthor

Had a rebase error, squashed change with the following diff:

diff --git a/lightning/src/blinded_path/payment.rs b/lightning/src/blinded_path/payment.rs
index 10d5d8de0..ca937c57d 100644
--- a/lightning/src/blinded_path/payment.rs+++ b/lightning/src/blinded_path/payment.rs@@ -201,8 +201,8 @@ pub struct ForwardTlvs {
///
/// [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload
pub features: BlindedHopFeatures,
- /// Set if this [`BlindedPath`] is concatenated to another, to indicate the- /// [`BlindedPath::blinding_point`] of the appended blinded path.+ /// Set if this [`BlindedPaymentPath`] is concatenated to another, to indicate the+ /// [`BlindedPaymentPath::blinding_point`] of the appended blinded path.
pub next_blinding_override: Option<PublicKey>,
}
diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs
index 2054e4e8e..e08b45558 100644
--- a/lightning/src/ln/channelmanager.rs+++ b/lightning/src/ln/channelmanager.rs@@ -227,8 +227,8 @@ pub struct BlindedForward {
/// the introduction node.
pub failure: BlindedFailure,
/// Overrides the next hop's [`msgs::UpdateAddHTLC::blinding_point`]. Set if this HTLC is being
- /// forwarded within a [`BlindedPath`] that was concatenated to another blinded path that starts- /// at the next hop.+ /// forwarded within a [`BlindedPaymentPath`] that was concatenated to another blinded path that+ /// starts at the next hop.
pub next_blinding_override: Option<PublicKey>,
}

jkczyz
jkczyz previously approved these changes Aug 19, 2024
@TheBlueMatt

Copy link
Copy Markdown
Collaborator
 error[E0063]: missing field `next_blinding_override` in initializer of `ForwardTlvs`
--> src/invoice_request_deser.rs:104:9
|
104 | tlvs: ForwardTlvs {
| ^^^^^^^^^^^ missing `next_blinding_override`
error[E0063]: missing field `next_blinding_override` in initializer of `ForwardTlvs`
--> src/refund_deser.rs:82:9
|
82 | tlvs: ForwardTlvs {
| ^^^^^^^^^^^ missing `next_blinding_override

This allow us to forward blinded payments where the blinded path that we are
forwarding within was concatenated to another blinded path that starts at the
next hop.
Also allows constructing blinded paths using this override.
We were writing a length redundantly...
No reason to take a reference to a Deref.
@valentinewallace

Copy link
Copy Markdown
ContributorAuthor
diff --git a/fuzz/src/invoice_request_deser.rs b/fuzz/src/invoice_request_deser.rs
index a5db1c4be..3abb0974e 100644
--- a/fuzz/src/invoice_request_deser.rs+++ b/fuzz/src/invoice_request_deser.rs@@ -113,6 +113,7 @@ fn build_response<T: secp256k1::Signing + secp256k1::Verification>(
htlc_minimum_msat: 100,
},
features: BlindedHopFeatures::empty(),
+ next_blinding_override: None,
},
node_id: pubkey(43),
htlc_maximum_msat: 1_000_000_000_000,
diff --git a/fuzz/src/refund_deser.rs b/fuzz/src/refund_deser.rs
index 58dc68eed..17f255081 100644
--- a/fuzz/src/refund_deser.rs+++ b/fuzz/src/refund_deser.rs@@ -91,6 +91,7 @@ fn build_response<T: secp256k1::Signing + secp256k1::Verification>(
htlc_minimum_msat: 100,
},
features: BlindedHopFeatures::empty(),
+ next_blinding_override: None,
},
node_id: pubkey(43),
htlc_maximum_msat: 1_000_000_000_000,

@TheBlueMatt
TheBlueMatt merged commit fb4403f into lightningdevkit:mainAug 19, 2024
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.

3 participants

@valentinewallace@TheBlueMatt@jkczyz
, '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" + ' Implement route blinding test vectors by valentinewallace · Pull Request #3204 · lightningdevkit/rust-lightning · GitHub
Skip to content

Implement route blinding test vectors - #3204

Merged
TheBlueMatt merged 4 commits into
lightningdevkit:mainfrom
valentinewallace:2024-07-rb-test-vectors
Aug 19, 2024
Merged

Implement route blinding test vectors #3204
TheBlueMatt merged 4 commits into
lightningdevkit:mainfrom
valentinewallace:2024-07-rb-test-vectors

Conversation

@valentinewallace

@valentinewallacevalentinewallace commented Jul 24, 2024

Copy link
Copy Markdown
Contributor

See https://github.com/lightning/bolts/blob/3fffab3b889c9a6818130b56fb6dcfdf6906f90e/bolt04/route-blinding-test.json for test vectors.

This also adds support for next_blinding_override in blinded payment paths, and fixes a ser bug for blinded hop features.

  • Release note

@valentinewallacevalentinewallace mentioned this pull request Jul 24, 2024
60 tasks
@codecov

codecovBot commented Jul 24, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 92.08633% with 22 lines in your changes missing coverage. Please review.

Project coverage is 90.21%. Comparing base (8fe3a56) to head (6f6115f).
Report is 44 commits behind head on main.

FilesPatch %Lines
lightning/src/ln/blinded_payment_tests.rs91.34%7 Missing and 13 partials ⚠️
lightning/src/blinded_path/payment.rs90.00%1 Missing ⚠️
lightning/src/ln/channelmanager.rs91.66%1 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #3204 +/- ##
==========================================
+ Coverage 89.73% 90.21% +0.48% 
==========================================
Files 123 124 +1 Lines 102287 106656 +4369 Branches 102287 106656 +4369 ==========================================
+ Hits 91784 96223 +4439 + Misses 7807 7759 -48 + Partials 2696 2674 -22 

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

@TheBlueMattTheBlueMatt added this to the 0.0.124 milestone Aug 7, 2024

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

Needs to go in a release soon for the features thing, right?

pub features: BlindedHopFeatures,
/// Set if this [`BlindedPath`] is concatenated to another, to indicate the
/// [`BlindedPath::blinding_point`] of the appended blinded path.
pub next_blinding_override: Option<PublicKey>,

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.

Why didn't we support this to begin with?

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.

IIRC I was under the impression that this field only applies to onion messages (it's required for OMs), not payments. And no one actually sets it for payments, so it never popped up in interop testing. :/

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.

I imagine no one set it ever, because its only useful for some kind of weird frankenstein trampoline afaict? What's the intended usecase for concatenating blinded paths? I mean I suppose we should just do it, but I'm curious why its there.

@valentinewallacevalentinewallaceAug 7, 2024

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.

I think Rusty pointed out here that it can help prevent the intro node from being aware that it's the intro node: lightning/bolts#1182 (comment)? I think this is clarified in lightning/bolts#1182 but still need to review that.

Edit: it is clarified quite a bit in that PR:
Screenshot 2024-08-07 at 3 18 29 PM

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, so basically its saying we should send onion messages as a blinded path from us to the intro node, prepended to the real blinded path? Do we do that?

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.

Yes, using next_blinding_override in OMs has always been required to prepend the unblinded path to the intro node.

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.

Oops, I think I misread your message. I'm not sure I follow Rusty's logic, actually. It seems like creating a blinded path from us to the intro node trades off the intro node knowing that they're the intro node for the node prior to the intro node knowing that the next hop is the intro node(?). Unless we set next_blinding_override for every hop in our prepended blinded path, which I suppose is possible.

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, I guess I'm still not really understanding why this is here, but its not much complexity to support, sooooo

TheBlueMatt
TheBlueMatt previously approved these changes Aug 14, 2024
@jkczyz
jkczyz self-requested a review August 16, 2024 15:47
jkczyz
jkczyz previously approved these changes Aug 16, 2024
@valentinewallace

Copy link
Copy Markdown
ContributorAuthor

Rebased due to conflicts.

impl_feature_write_without_length!(ChannelTypeFeatures);
impl_feature_write_without_length!(InvoiceRequestFeatures);
impl_feature_write_without_length!(OfferFeatures);
impl_feature_write_without_length!(BlindedHopFeatures);

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.

Had to add this line to the feature ser fix due to changes in commit 0c5922e92a3ec3fdf9226cceeb9057ad9aa9dc19.

jkczyz
jkczyz previously approved these changes Aug 16, 2024
@TheBlueMatt

Copy link
Copy Markdown
Collaborator
error: public documentation for `next_blinding_override` links to private item `BlindedPath`
--> lightning/src/blinded_path/payment.rs:204:20
|
204 | /// Set if this [`BlindedPath`] is concatenated to another, to indicate the
| ^^^^^^^^^^^ this item is private

@valentinewallace

Copy link
Copy Markdown
ContributorAuthor

Had a rebase error, squashed change with the following diff:

diff --git a/lightning/src/blinded_path/payment.rs b/lightning/src/blinded_path/payment.rs
index 10d5d8de0..ca937c57d 100644
--- a/lightning/src/blinded_path/payment.rs+++ b/lightning/src/blinded_path/payment.rs@@ -201,8 +201,8 @@ pub struct ForwardTlvs {
///
/// [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload
pub features: BlindedHopFeatures,
- /// Set if this [`BlindedPath`] is concatenated to another, to indicate the- /// [`BlindedPath::blinding_point`] of the appended blinded path.+ /// Set if this [`BlindedPaymentPath`] is concatenated to another, to indicate the+ /// [`BlindedPaymentPath::blinding_point`] of the appended blinded path.
pub next_blinding_override: Option<PublicKey>,
}
diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs
index 2054e4e8e..e08b45558 100644
--- a/lightning/src/ln/channelmanager.rs+++ b/lightning/src/ln/channelmanager.rs@@ -227,8 +227,8 @@ pub struct BlindedForward {
/// the introduction node.
pub failure: BlindedFailure,
/// Overrides the next hop's [`msgs::UpdateAddHTLC::blinding_point`]. Set if this HTLC is being
- /// forwarded within a [`BlindedPath`] that was concatenated to another blinded path that starts- /// at the next hop.+ /// forwarded within a [`BlindedPaymentPath`] that was concatenated to another blinded path that+ /// starts at the next hop.
pub next_blinding_override: Option<PublicKey>,
}

jkczyz
jkczyz previously approved these changes Aug 19, 2024
@TheBlueMatt

Copy link
Copy Markdown
Collaborator
 error[E0063]: missing field `next_blinding_override` in initializer of `ForwardTlvs`
--> src/invoice_request_deser.rs:104:9
|
104 | tlvs: ForwardTlvs {
| ^^^^^^^^^^^ missing `next_blinding_override`
error[E0063]: missing field `next_blinding_override` in initializer of `ForwardTlvs`
--> src/refund_deser.rs:82:9
|
82 | tlvs: ForwardTlvs {
| ^^^^^^^^^^^ missing `next_blinding_override

This allow us to forward blinded payments where the blinded path that we are
forwarding within was concatenated to another blinded path that starts at the
next hop.
Also allows constructing blinded paths using this override.
We were writing a length redundantly...
No reason to take a reference to a Deref.
@valentinewallace

Copy link
Copy Markdown
ContributorAuthor
diff --git a/fuzz/src/invoice_request_deser.rs b/fuzz/src/invoice_request_deser.rs
index a5db1c4be..3abb0974e 100644
--- a/fuzz/src/invoice_request_deser.rs+++ b/fuzz/src/invoice_request_deser.rs@@ -113,6 +113,7 @@ fn build_response<T: secp256k1::Signing + secp256k1::Verification>(
htlc_minimum_msat: 100,
},
features: BlindedHopFeatures::empty(),
+ next_blinding_override: None,
},
node_id: pubkey(43),
htlc_maximum_msat: 1_000_000_000_000,
diff --git a/fuzz/src/refund_deser.rs b/fuzz/src/refund_deser.rs
index 58dc68eed..17f255081 100644
--- a/fuzz/src/refund_deser.rs+++ b/fuzz/src/refund_deser.rs@@ -91,6 +91,7 @@ fn build_response<T: secp256k1::Signing + secp256k1::Verification>(
htlc_minimum_msat: 100,
},
features: BlindedHopFeatures::empty(),
+ next_blinding_override: None,
},
node_id: pubkey(43),
htlc_maximum_msat: 1_000_000_000_000,

@TheBlueMatt
TheBlueMatt merged commit fb4403f into lightningdevkit:mainAug 19, 2024
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.

3 participants

@valentinewallace@TheBlueMatt@jkczyz
, '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('^' + ".*" + ' Implement route blinding test vectors by valentinewallace · Pull Request #3204 · lightningdevkit/rust-lightning · GitHub
Skip to content

Implement route blinding test vectors - #3204

Merged
TheBlueMatt merged 4 commits into
lightningdevkit:mainfrom
valentinewallace:2024-07-rb-test-vectors
Aug 19, 2024
Merged

Implement route blinding test vectors #3204
TheBlueMatt merged 4 commits into
lightningdevkit:mainfrom
valentinewallace:2024-07-rb-test-vectors

Conversation

@valentinewallace

@valentinewallacevalentinewallace commented Jul 24, 2024

Copy link
Copy Markdown
Contributor

See https://github.com/lightning/bolts/blob/3fffab3b889c9a6818130b56fb6dcfdf6906f90e/bolt04/route-blinding-test.json for test vectors.

This also adds support for next_blinding_override in blinded payment paths, and fixes a ser bug for blinded hop features.

  • Release note

@valentinewallacevalentinewallace mentioned this pull request Jul 24, 2024
60 tasks
@codecov

codecovBot commented Jul 24, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 92.08633% with 22 lines in your changes missing coverage. Please review.

Project coverage is 90.21%. Comparing base (8fe3a56) to head (6f6115f).
Report is 44 commits behind head on main.

FilesPatch %Lines
lightning/src/ln/blinded_payment_tests.rs91.34%7 Missing and 13 partials ⚠️
lightning/src/blinded_path/payment.rs90.00%1 Missing ⚠️
lightning/src/ln/channelmanager.rs91.66%1 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #3204 +/- ##
==========================================
+ Coverage 89.73% 90.21% +0.48% 
==========================================
Files 123 124 +1 Lines 102287 106656 +4369 Branches 102287 106656 +4369 ==========================================
+ Hits 91784 96223 +4439 + Misses 7807 7759 -48 + Partials 2696 2674 -22 

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

@TheBlueMattTheBlueMatt added this to the 0.0.124 milestone Aug 7, 2024

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

Needs to go in a release soon for the features thing, right?

pub features: BlindedHopFeatures,
/// Set if this [`BlindedPath`] is concatenated to another, to indicate the
/// [`BlindedPath::blinding_point`] of the appended blinded path.
pub next_blinding_override: Option<PublicKey>,

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.

Why didn't we support this to begin with?

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.

IIRC I was under the impression that this field only applies to onion messages (it's required for OMs), not payments. And no one actually sets it for payments, so it never popped up in interop testing. :/

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.

I imagine no one set it ever, because its only useful for some kind of weird frankenstein trampoline afaict? What's the intended usecase for concatenating blinded paths? I mean I suppose we should just do it, but I'm curious why its there.

@valentinewallacevalentinewallaceAug 7, 2024

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.

I think Rusty pointed out here that it can help prevent the intro node from being aware that it's the intro node: lightning/bolts#1182 (comment)? I think this is clarified in lightning/bolts#1182 but still need to review that.

Edit: it is clarified quite a bit in that PR:
Screenshot 2024-08-07 at 3 18 29 PM

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, so basically its saying we should send onion messages as a blinded path from us to the intro node, prepended to the real blinded path? Do we do that?

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.

Yes, using next_blinding_override in OMs has always been required to prepend the unblinded path to the intro node.

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.

Oops, I think I misread your message. I'm not sure I follow Rusty's logic, actually. It seems like creating a blinded path from us to the intro node trades off the intro node knowing that they're the intro node for the node prior to the intro node knowing that the next hop is the intro node(?). Unless we set next_blinding_override for every hop in our prepended blinded path, which I suppose is possible.

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, I guess I'm still not really understanding why this is here, but its not much complexity to support, sooooo

TheBlueMatt
TheBlueMatt previously approved these changes Aug 14, 2024
@jkczyz
jkczyz self-requested a review August 16, 2024 15:47
jkczyz
jkczyz previously approved these changes Aug 16, 2024
@valentinewallace

Copy link
Copy Markdown
ContributorAuthor

Rebased due to conflicts.

impl_feature_write_without_length!(ChannelTypeFeatures);
impl_feature_write_without_length!(InvoiceRequestFeatures);
impl_feature_write_without_length!(OfferFeatures);
impl_feature_write_without_length!(BlindedHopFeatures);

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.

Had to add this line to the feature ser fix due to changes in commit 0c5922e92a3ec3fdf9226cceeb9057ad9aa9dc19.

jkczyz
jkczyz previously approved these changes Aug 16, 2024
@TheBlueMatt

Copy link
Copy Markdown
Collaborator
error: public documentation for `next_blinding_override` links to private item `BlindedPath`
--> lightning/src/blinded_path/payment.rs:204:20
|
204 | /// Set if this [`BlindedPath`] is concatenated to another, to indicate the
| ^^^^^^^^^^^ this item is private

@valentinewallace

Copy link
Copy Markdown
ContributorAuthor

Had a rebase error, squashed change with the following diff:

diff --git a/lightning/src/blinded_path/payment.rs b/lightning/src/blinded_path/payment.rs
index 10d5d8de0..ca937c57d 100644
--- a/lightning/src/blinded_path/payment.rs+++ b/lightning/src/blinded_path/payment.rs@@ -201,8 +201,8 @@ pub struct ForwardTlvs {
///
/// [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload
pub features: BlindedHopFeatures,
- /// Set if this [`BlindedPath`] is concatenated to another, to indicate the- /// [`BlindedPath::blinding_point`] of the appended blinded path.+ /// Set if this [`BlindedPaymentPath`] is concatenated to another, to indicate the+ /// [`BlindedPaymentPath::blinding_point`] of the appended blinded path.
pub next_blinding_override: Option<PublicKey>,
}
diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs
index 2054e4e8e..e08b45558 100644
--- a/lightning/src/ln/channelmanager.rs+++ b/lightning/src/ln/channelmanager.rs@@ -227,8 +227,8 @@ pub struct BlindedForward {
/// the introduction node.
pub failure: BlindedFailure,
/// Overrides the next hop's [`msgs::UpdateAddHTLC::blinding_point`]. Set if this HTLC is being
- /// forwarded within a [`BlindedPath`] that was concatenated to another blinded path that starts- /// at the next hop.+ /// forwarded within a [`BlindedPaymentPath`] that was concatenated to another blinded path that+ /// starts at the next hop.
pub next_blinding_override: Option<PublicKey>,
}

jkczyz
jkczyz previously approved these changes Aug 19, 2024
@TheBlueMatt

Copy link
Copy Markdown
Collaborator
 error[E0063]: missing field `next_blinding_override` in initializer of `ForwardTlvs`
--> src/invoice_request_deser.rs:104:9
|
104 | tlvs: ForwardTlvs {
| ^^^^^^^^^^^ missing `next_blinding_override`
error[E0063]: missing field `next_blinding_override` in initializer of `ForwardTlvs`
--> src/refund_deser.rs:82:9
|
82 | tlvs: ForwardTlvs {
| ^^^^^^^^^^^ missing `next_blinding_override

This allow us to forward blinded payments where the blinded path that we are
forwarding within was concatenated to another blinded path that starts at the
next hop.
Also allows constructing blinded paths using this override.
We were writing a length redundantly...
No reason to take a reference to a Deref.
@valentinewallace

Copy link
Copy Markdown
ContributorAuthor
diff --git a/fuzz/src/invoice_request_deser.rs b/fuzz/src/invoice_request_deser.rs
index a5db1c4be..3abb0974e 100644
--- a/fuzz/src/invoice_request_deser.rs+++ b/fuzz/src/invoice_request_deser.rs@@ -113,6 +113,7 @@ fn build_response<T: secp256k1::Signing + secp256k1::Verification>(
htlc_minimum_msat: 100,
},
features: BlindedHopFeatures::empty(),
+ next_blinding_override: None,
},
node_id: pubkey(43),
htlc_maximum_msat: 1_000_000_000_000,
diff --git a/fuzz/src/refund_deser.rs b/fuzz/src/refund_deser.rs
index 58dc68eed..17f255081 100644
--- a/fuzz/src/refund_deser.rs+++ b/fuzz/src/refund_deser.rs@@ -91,6 +91,7 @@ fn build_response<T: secp256k1::Signing + secp256k1::Verification>(
htlc_minimum_msat: 100,
},
features: BlindedHopFeatures::empty(),
+ next_blinding_override: None,
},
node_id: pubkey(43),
htlc_maximum_msat: 1_000_000_000_000,

@TheBlueMatt
TheBlueMatt merged commit fb4403f into lightningdevkit:mainAug 19, 2024
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.

3 participants

@valentinewallace@TheBlueMatt@jkczyz
, '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); } })(); })(); Implement route blinding test vectors by valentinewallace · Pull Request #3204 · lightningdevkit/rust-lightning · GitHub
Skip to content

Implement route blinding test vectors - #3204

Merged
TheBlueMatt merged 4 commits into
lightningdevkit:mainfrom
valentinewallace:2024-07-rb-test-vectors
Aug 19, 2024
Merged

Implement route blinding test vectors #3204
TheBlueMatt merged 4 commits into
lightningdevkit:mainfrom
valentinewallace:2024-07-rb-test-vectors

Conversation

@valentinewallace

@valentinewallacevalentinewallace commented Jul 24, 2024

Copy link
Copy Markdown
Contributor

See https://github.com/lightning/bolts/blob/3fffab3b889c9a6818130b56fb6dcfdf6906f90e/bolt04/route-blinding-test.json for test vectors.

This also adds support for next_blinding_override in blinded payment paths, and fixes a ser bug for blinded hop features.

  • Release note

@valentinewallacevalentinewallace mentioned this pull request Jul 24, 2024
60 tasks
@codecov

codecovBot commented Jul 24, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 92.08633% with 22 lines in your changes missing coverage. Please review.

Project coverage is 90.21%. Comparing base (8fe3a56) to head (6f6115f).
Report is 44 commits behind head on main.

FilesPatch %Lines
lightning/src/ln/blinded_payment_tests.rs91.34%7 Missing and 13 partials ⚠️
lightning/src/blinded_path/payment.rs90.00%1 Missing ⚠️
lightning/src/ln/channelmanager.rs91.66%1 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #3204 +/- ##
==========================================
+ Coverage 89.73% 90.21% +0.48% 
==========================================
Files 123 124 +1 Lines 102287 106656 +4369 Branches 102287 106656 +4369 ==========================================
+ Hits 91784 96223 +4439 + Misses 7807 7759 -48 + Partials 2696 2674 -22 

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

@TheBlueMattTheBlueMatt added this to the 0.0.124 milestone Aug 7, 2024

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

Needs to go in a release soon for the features thing, right?

pub features: BlindedHopFeatures,
/// Set if this [`BlindedPath`] is concatenated to another, to indicate the
/// [`BlindedPath::blinding_point`] of the appended blinded path.
pub next_blinding_override: Option<PublicKey>,

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.

Why didn't we support this to begin with?

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.

IIRC I was under the impression that this field only applies to onion messages (it's required for OMs), not payments. And no one actually sets it for payments, so it never popped up in interop testing. :/

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.

I imagine no one set it ever, because its only useful for some kind of weird frankenstein trampoline afaict? What's the intended usecase for concatenating blinded paths? I mean I suppose we should just do it, but I'm curious why its there.

@valentinewallacevalentinewallaceAug 7, 2024

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.

I think Rusty pointed out here that it can help prevent the intro node from being aware that it's the intro node: lightning/bolts#1182 (comment)? I think this is clarified in lightning/bolts#1182 but still need to review that.

Edit: it is clarified quite a bit in that PR:
Screenshot 2024-08-07 at 3 18 29 PM

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, so basically its saying we should send onion messages as a blinded path from us to the intro node, prepended to the real blinded path? Do we do that?

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.

Yes, using next_blinding_override in OMs has always been required to prepend the unblinded path to the intro node.

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.

Oops, I think I misread your message. I'm not sure I follow Rusty's logic, actually. It seems like creating a blinded path from us to the intro node trades off the intro node knowing that they're the intro node for the node prior to the intro node knowing that the next hop is the intro node(?). Unless we set next_blinding_override for every hop in our prepended blinded path, which I suppose is possible.

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, I guess I'm still not really understanding why this is here, but its not much complexity to support, sooooo

TheBlueMatt
TheBlueMatt previously approved these changes Aug 14, 2024
@jkczyz
jkczyz self-requested a review August 16, 2024 15:47
jkczyz
jkczyz previously approved these changes Aug 16, 2024
@valentinewallace

Copy link
Copy Markdown
ContributorAuthor

Rebased due to conflicts.

impl_feature_write_without_length!(ChannelTypeFeatures);
impl_feature_write_without_length!(InvoiceRequestFeatures);
impl_feature_write_without_length!(OfferFeatures);
impl_feature_write_without_length!(BlindedHopFeatures);

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.

Had to add this line to the feature ser fix due to changes in commit 0c5922e92a3ec3fdf9226cceeb9057ad9aa9dc19.

jkczyz
jkczyz previously approved these changes Aug 16, 2024
@TheBlueMatt

Copy link
Copy Markdown
Collaborator
error: public documentation for `next_blinding_override` links to private item `BlindedPath`
--> lightning/src/blinded_path/payment.rs:204:20
|
204 | /// Set if this [`BlindedPath`] is concatenated to another, to indicate the
| ^^^^^^^^^^^ this item is private

@valentinewallace

Copy link
Copy Markdown
ContributorAuthor

Had a rebase error, squashed change with the following diff:

diff --git a/lightning/src/blinded_path/payment.rs b/lightning/src/blinded_path/payment.rs
index 10d5d8de0..ca937c57d 100644
--- a/lightning/src/blinded_path/payment.rs+++ b/lightning/src/blinded_path/payment.rs@@ -201,8 +201,8 @@ pub struct ForwardTlvs {
///
/// [`BlindedHop::encrypted_payload`]: crate::blinded_path::BlindedHop::encrypted_payload
pub features: BlindedHopFeatures,
- /// Set if this [`BlindedPath`] is concatenated to another, to indicate the- /// [`BlindedPath::blinding_point`] of the appended blinded path.+ /// Set if this [`BlindedPaymentPath`] is concatenated to another, to indicate the+ /// [`BlindedPaymentPath::blinding_point`] of the appended blinded path.
pub next_blinding_override: Option<PublicKey>,
}
diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs
index 2054e4e8e..e08b45558 100644
--- a/lightning/src/ln/channelmanager.rs+++ b/lightning/src/ln/channelmanager.rs@@ -227,8 +227,8 @@ pub struct BlindedForward {
/// the introduction node.
pub failure: BlindedFailure,
/// Overrides the next hop's [`msgs::UpdateAddHTLC::blinding_point`]. Set if this HTLC is being
- /// forwarded within a [`BlindedPath`] that was concatenated to another blinded path that starts- /// at the next hop.+ /// forwarded within a [`BlindedPaymentPath`] that was concatenated to another blinded path that+ /// starts at the next hop.
pub next_blinding_override: Option<PublicKey>,
}

jkczyz
jkczyz previously approved these changes Aug 19, 2024
@TheBlueMatt

Copy link
Copy Markdown
Collaborator
 error[E0063]: missing field `next_blinding_override` in initializer of `ForwardTlvs`
--> src/invoice_request_deser.rs:104:9
|
104 | tlvs: ForwardTlvs {
| ^^^^^^^^^^^ missing `next_blinding_override`
error[E0063]: missing field `next_blinding_override` in initializer of `ForwardTlvs`
--> src/refund_deser.rs:82:9
|
82 | tlvs: ForwardTlvs {
| ^^^^^^^^^^^ missing `next_blinding_override

This allow us to forward blinded payments where the blinded path that we are
forwarding within was concatenated to another blinded path that starts at the
next hop.
Also allows constructing blinded paths using this override.
We were writing a length redundantly...
No reason to take a reference to a Deref.
@valentinewallace

Copy link
Copy Markdown
ContributorAuthor
diff --git a/fuzz/src/invoice_request_deser.rs b/fuzz/src/invoice_request_deser.rs
index a5db1c4be..3abb0974e 100644
--- a/fuzz/src/invoice_request_deser.rs+++ b/fuzz/src/invoice_request_deser.rs@@ -113,6 +113,7 @@ fn build_response<T: secp256k1::Signing + secp256k1::Verification>(
htlc_minimum_msat: 100,
},
features: BlindedHopFeatures::empty(),
+ next_blinding_override: None,
},
node_id: pubkey(43),
htlc_maximum_msat: 1_000_000_000_000,
diff --git a/fuzz/src/refund_deser.rs b/fuzz/src/refund_deser.rs
index 58dc68eed..17f255081 100644
--- a/fuzz/src/refund_deser.rs+++ b/fuzz/src/refund_deser.rs@@ -91,6 +91,7 @@ fn build_response<T: secp256k1::Signing + secp256k1::Verification>(
htlc_minimum_msat: 100,
},
features: BlindedHopFeatures::empty(),
+ next_blinding_override: None,
},
node_id: pubkey(43),
htlc_maximum_msat: 1_000_000_000_000,

@TheBlueMatt
TheBlueMatt merged commit fb4403f into lightningdevkit:mainAug 19, 2024
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.

3 participants

@valentinewallace@TheBlueMatt@jkczyz