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

Update trampoline to use official spec values #2819

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

t-bast
Copy link
Member

@t-bast t-bast commented Feb 7, 2024

Use the feature bit and tlvs defined in the official spec PR (lightning/bolts#836) and add support for:

  • fully blinded trampoline payments
  • trampoline error encryption

We also add the official spec test vectors.

We keep backwards-compatibility for current wallet users relying on the legacy trampoline protocol, but will likely drop support at some point. We should notify the Electrum folks and give them enough time to migrate to the new protocol before dropping support for the legacy one.

@codecov-commenter
Copy link

Codecov Report

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

Comparison is base (e66e6d2) 85.86% compared to head (ee178c7) 85.96%.
Report is 2 commits behind head on master.

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

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2819      +/-   ##
==========================================
+ Coverage   85.86%   85.96%   +0.09%     
==========================================
  Files         216      217       +1     
  Lines       18228    18256      +28     
  Branches      772      778       +6     
==========================================
+ Hits        15652    15694      +42     
+ Misses       2576     2562      -14     
Files Coverage Δ
...core/src/main/scala/fr/acinq/eclair/Features.scala 100.00% <100.00%> (ø)
...re/src/main/scala/fr/acinq/eclair/NodeParams.scala 93.41% <100.00%> (+0.02%) ⬆️
...r/acinq/eclair/blockchain/fee/OnChainFeeConf.scala 95.00% <ø> (ø)
...q/eclair/channel/publish/ReplaceableTxFunder.scala 85.56% <100.00%> (+0.59%) ⬆️
.../scala/fr/acinq/eclair/payment/PaymentPacket.scala 91.45% <100.00%> (+1.27%) ⬆️
...la/fr/acinq/eclair/payment/relay/NodeRelayer.scala 100.00% <100.00%> (ø)
.../scala/fr/acinq/eclair/payment/relay/Relayer.scala 89.13% <100.00%> (ø)
...air/payment/send/CompactBlindedPathsResolver.scala 100.00% <100.00%> (ø)
...scala/fr/acinq/eclair/payment/send/Recipient.scala 98.63% <100.00%> (+2.79%) ⬆️
...a/fr/acinq/eclair/wire/protocol/PaymentOnion.scala 99.37% <100.00%> (+3.82%) ⬆️
... and 4 more

... and 4 files with indirect coverage changes

@t-bast t-bast force-pushed the trampoline-spec-version branch from ee178c7 to bd76a24 Compare March 12, 2024 08:52
@t-bast t-bast force-pushed the trampoline-spec-version branch from bd76a24 to d33f661 Compare July 11, 2024 15:56
@t-bast t-bast force-pushed the trampoline-spec-version branch 2 times, most recently from cd8e468 to 3f459d3 Compare November 27, 2024 15:13
@t-bast t-bast force-pushed the trampoline-spec-version branch from b781e95 to 3d5a8fe Compare November 29, 2024 16:44
@t-bast t-bast mentioned this pull request Dec 3, 2024
@t-bast t-bast force-pushed the trampoline-spec-version branch 4 times, most recently from 0291b8e to f8b65bb Compare December 5, 2024 14:45
We add support for the official version of trampoline payments, as
specified in lightning/bolts#836.

We keep supporting trampoline payments that use the legacy protocol
to allow a smooth transition. We hardcode the legacy feature bit 149
in a few places to make this work, which is a bit hacky but simple
and should be removed 6 months after releasing the official version.

We also keep supporting payments from trampoline wallets to nodes that
don't support trampoline: this is bad from a privacy standpoint, but
will be fixed when recipients start supporting Bolt 12.
We add support for trampoline payments to blinded recipients, where
each node of the blinded path is used as trampoline node. This is
particularly useful to include custom TLVs from the payer to the
recipient.
@t-bast t-bast force-pushed the trampoline-spec-version branch from f8b65bb to 90fb0c1 Compare December 5, 2024 15:07
When returning trampoline failures for the payer (the creator of the
trampoline onion), they must be encrypted using the sphinx shared
secret of the trampoline onion.

When relaying a trampoline payment, we re-wrap the (peeled) trampoline
onion inside a payment onion: if we receive a failure for the outgoing
payment, it can be either coming from before the next trampoline node
or after them. If it's coming from before, we can decrypt that error
using the shared secrets we created for the payment onion: depending
on the error, we can then return our own error to the payer. If it's
coming from after the next trampoline onion, it will be encrypted for
the payer, so we cannot decrypt it. We must peel the shared secrets of
our payment onion, and then re-encrypted with the shared secret of the
incoming trampoline onion. This way only the payer will be able to
decrypt the failure, which is relayed back through each intermediate
trampoline node.
@t-bast t-bast force-pushed the trampoline-spec-version branch from 90fb0c1 to c333cd4 Compare December 6, 2024 13:18
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.

2 participants