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

Improve blinded route data structure #2025

Closed
wants to merge 1 commit into from
Closed

Conversation

thomash-acinq
Copy link
Member

Change the blinded route structure to better suit our needs:

  • We need the blinded node ids of all nodes, including the introduction node.
  • We only need the blinding ephemeral key for the first node, not the other ones. And in the case where we didn't build the blinded route ourselves we can't have access to them anyway. By only storing the first ephemeral key we can use the same data structure to represent blinded routes that we receive from our peers.

@codecov-commenter
Copy link

Codecov Report

Merging #2025 (8328a09) into master (bdef833) will increase coverage by 0.04%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #2025      +/-   ##
==========================================
+ Coverage   87.70%   87.74%   +0.04%     
==========================================
  Files         161      161              
  Lines       12562    12560       -2     
  Branches      534      524      -10     
==========================================
+ Hits        11017    11021       +4     
+ Misses       1545     1539       -6     
Impacted Files Coverage Δ
...src/main/scala/fr/acinq/eclair/crypto/Sphinx.scala 100.00% <100.00%> (ø)
...ala/fr/acinq/eclair/balance/ChannelsListener.scala 93.10% <0.00%> (-3.45%) ⬇️
...c/main/scala/fr/acinq/eclair/channel/Channel.scala 88.83% <0.00%> (-0.08%) ⬇️
...clair/channel/publish/ReplaceableTxPublisher.scala 87.35% <0.00%> (+1.14%) ⬆️
...main/scala/fr/acinq/eclair/router/Validation.scala 92.30% <0.00%> (+1.53%) ⬆️
...cala/fr/acinq/eclair/payment/relay/NodeRelay.scala 97.56% <0.00%> (+1.62%) ⬆️

@t-bast
Copy link
Member

t-bast commented Oct 22, 2021

And in the case where we didn't build the blinded route ourselves we can't have access to them anyway.

Good point!

I don't think we should throw the ephemeral keys away though, other schemes than onion messages may need it and it's useful to test them against reference test vectors (and I don't like throwing information away).

I updated my initial PR to separate the ephemeral keys from the route itself, let me know what you think.
Also it seems like you've removed the encrypted payload for the introduction node here, was that intended?

@thomash-acinq
Copy link
Member Author

Also it seems like you've removed the encrypted payload for the introduction node here, was that intended?

No, it's still there: blinded.route.encryptedPayloads.head

@t-bast
Copy link
Member

t-bast commented Oct 22, 2021

Oh that's because you put the introduction node back into the blindedNodes field. I think it's messy as it has its data split between its BlindedNode representation and the additional fields you added. I prefer explicitly singling it out, WDYT?

@thomash-acinq
Copy link
Member Author

Can you give me an example usage where you would want to process the introduction node separately? For onion messages I don't.
I'm actually thinking that the val nodeIds: Seq[PublicKey] = introductionNodeId +: blindedNodes.tail.map(_.blindedPublicKey) is not useful and should be replaced by val blindedPublicKeys: Seq[PublicKey] = blindedNodes.map(_.blindedPublicKey)

@thomash-acinq thomash-acinq deleted the blinded-route branch November 5, 2021 14:46
Sign up for free to 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