Skip to content

Update trampoline to use official spec values #2819

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

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-commenter commented Feb 7, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

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

Project coverage is 85.79%. Comparing base (b4e938d) to head (d2ad160).

Files with missing lines Patch % Lines
...cala/fr/acinq/eclair/payment/relay/NodeRelay.scala 74.46% 12 Missing ⚠️
...fr/acinq/eclair/wire/protocol/FailureMessage.scala 55.55% 4 Missing ⚠️
...lair/payment/send/TrampolinePaymentLifecycle.scala 92.50% 3 Missing ⚠️
.../scala/fr/acinq/eclair/payment/PaymentPacket.scala 94.87% 2 Missing ⚠️
...r/acinq/eclair/payment/relay/OnTheFlyFunding.scala 66.66% 1 Missing ⚠️

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

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2819      +/-   ##
==========================================
- Coverage   85.79%   85.79%   -0.01%     
==========================================
  Files         235      235              
  Lines       21261    21372     +111     
  Branches      847      904      +57     
==========================================
+ Hits        18241    18336      +95     
- Misses       3020     3036      +16     
Files with missing lines Coverage Δ
...core/src/main/scala/fr/acinq/eclair/Features.scala 100.00% <100.00%> (ø)
...re/src/main/scala/fr/acinq/eclair/NodeParams.scala 92.12% <ø> (-0.03%) ⬇️
...ain/scala/fr/acinq/eclair/payment/Monitoring.scala 96.87% <100.00%> (+0.04%) ⬆️
...cinq/eclair/payment/receive/MultiPartHandler.scala 93.93% <100.00%> (+0.03%) ⬆️
.../eclair/payment/relay/PostRestartHtlcCleaner.scala 91.57% <100.00%> (+0.04%) ⬆️
.../scala/fr/acinq/eclair/payment/relay/Relayer.scala 90.00% <100.00%> (ø)
...scala/fr/acinq/eclair/payment/send/Recipient.scala 98.03% <100.00%> (+0.08%) ⬆️
.../fr/acinq/eclair/wire/internal/CommandCodecs.scala 100.00% <ø> (ø)
...a/fr/acinq/eclair/wire/protocol/PaymentOnion.scala 99.52% <100.00%> (+0.09%) ⬆️
...r/acinq/eclair/payment/relay/OnTheFlyFunding.scala 89.91% <66.66%> (-0.77%) ⬇️
... and 4 more

... and 9 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@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 6 times, most recently from 90fb0c1 to c333cd4 Compare December 6, 2024 13:18
@t-bast t-bast force-pushed the trampoline-spec-version branch 3 times, most recently from 18dc4e1 to d2ad160 Compare March 26, 2025 15:09
t-bast added 3 commits April 3, 2025 14:04
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.
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 d2ad160 to 68d8aa2 Compare April 3, 2025 13:32
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