Skip to content

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 90.76305% with 23 lines in your changes missing coverage. Please review.

Project coverage is 86.04%. Comparing base (f14b92d) to head (ddbe7f0).
Report is 28 commits behind head on master.

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 60.00% 4 Missing ⚠️
.../scala/fr/acinq/eclair/payment/PaymentPacket.scala 96.20% 3 Missing ⚠️
...lair/payment/send/TrampolinePaymentLifecycle.scala 93.33% 3 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.80%   86.04%   +0.23%     
==========================================
  Files         236      237       +1     
  Lines       21299    21842     +543     
  Branches      859      841      -18     
==========================================
+ Hits        18275    18793     +518     
- Misses       3024     3049      +25     
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.16% <ø> (+0.02%) ⬆️
...ain/scala/fr/acinq/eclair/payment/Monitoring.scala 96.87% <100.00%> (+0.04%) ⬆️
...cinq/eclair/payment/receive/MultiPartHandler.scala 93.75% <100.00%> (-0.16%) ⬇️
.../eclair/payment/relay/PostRestartHtlcCleaner.scala 88.77% <100.00%> (+0.05%) ⬆️
.../scala/fr/acinq/eclair/payment/relay/Relayer.scala 88.67% <100.00%> (-1.33%) ⬇️
...r/acinq/eclair/payment/send/PaymentLifecycle.scala 84.13% <100.00%> (+0.80%) ⬆️
...scala/fr/acinq/eclair/payment/send/Recipient.scala 98.03% <100.00%> (+0.08%) ⬆️
...src/main/scala/fr/acinq/eclair/router/Router.scala 93.75% <ø> (-0.03%) ⬇️
.../fr/acinq/eclair/wire/internal/CommandCodecs.scala 88.88% <ø> (-11.12%) ⬇️
... and 6 more

... and 10 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 t-bast force-pushed the trampoline-spec-version branch from d2ad160 to 68d8aa2 Compare April 3, 2025 13:32
@t-bast t-bast force-pushed the trampoline-spec-version branch 2 times, most recently from 0e91113 to d405c1a Compare June 12, 2025 15:17
@t-bast t-bast force-pushed the trampoline-spec-version branch from d405c1a to 0e7d664 Compare June 24, 2025 09:58
@t-bast t-bast force-pushed the trampoline-spec-version branch 2 times, most recently from ddbe7f0 to 7d669ff Compare June 30, 2025 09:35
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 7d669ff to d7739eb Compare October 24, 2025 11:23
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.

3 participants