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

Part 3: offers with paths #7456

Merged

Conversation

rustyrussell
Copy link
Contributor

@rustyrussell rustyrussell commented Jul 8, 2024

(Based on #7455) Merged!

We unify our onion_message construction routines and use them with the new "injectonionmessage" RPC. This means we properly support routing where the start of the blinded path is not an immediate peer, which will happen more as the network of onion-message-enabled nodes expands.

We also, finally, add support for offers which use blinded paths, though we don't create them ourselves (except via a dev parameter for testing).

@rustyrussell rustyrussell added this to the v24.08 milestone Jul 8, 2024
Copy link
Collaborator

@niftynei niftynei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK b53f156

@@ -956,11 +1050,8 @@ static struct command_result *createinvoice_done(struct command *cmd,
* - MUST use `offer_paths` if present, otherwise MUST use
* `invreq_payer_id` as the node id to send to.
*/
/* FIXME! */
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

Comment on lines +36 to +37
static const struct pubkey *
get_nodeid(const struct tlv_encrypted_data_tlv **tlvs,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really do not like the name of the function formatted in this way 😸

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice refactoring, this is not more clear, thanks!

Comment on lines +449 to +491
/* FIXME: Maybe we should allow this? */
if (tal_count(path) == 1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I have some work that I wrote in Austin to allow this, I can rebase on top of your work when you are done

vincenzopalazzo@daa5d1d

Copy link
Collaborator

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK till 72cb5cd

I will continue tomorrow, this is a big beast, but I think in the meanwhile a rebase will help others too?

Copy link
Collaborator

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 03c07bb

Rebasing on master because the following failure on my system if not failing

===End Flaky Test Report===
=========================== short test summary info ============================
FAILED tests/test_pay.py::test_offer_needs_option - AssertionError: Regex pattern did not match.
 Regex: 'experimental-offers not enabled'
 Input: 'RPC call failed: method: fetchinvoice, payload: {\'offer\': \'lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrcgqyqs5pr5v4ehg93pqfnwgkvdr57yzh6h92zg3qctvrm7w38djg67kzcm4yeg8vc4cq63s\'}, error: {\'code\': -32602, \'message\': \'offer: Unparsable offer: wrong chain: invalid token \\\'"lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrcgqyqs5pr5v4ehg93pqfnwgkvdr57yzh6h92zg3qctvrm7w38djg67kzcm4yeg8vc4cq63s"\\\'\'}'
FAILED tests/test_pay.py::test_fetchinvoice - AssertionError: Regex pattern did not match.
 Regex: 'Offer no longer available'
 Input: "RPC call failed: method: fetchinvoice, payload: {'offer': 'lno1qgsflplttq9euhc3mss3a8akd2andxvejpz03ls5dqq3vgunxepgd3sgqyqs5rmnd9hxwmr9946hxefqw3jhxaqkyyp462c3jt0m5y6wzrj5pp6axehtez7r20265antsrqfpvuu8fwcshg'}, error: {'code': 1005, 'message': 'Timeout waiting for response'}"

This means only a single gossmap, and they already share the fetchinvoice-noconnect option
and autoconnect code.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: Plugins: the `fetchinvoice` plugin has been combined into the `offers` plugin.
We already parse some fields, so hand them directly rather than
having fetchinvoice behave as if it's a raw hook.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…on messages.

This is complicated, and I needed to write it down.  All the current routines
are spread through the code, and I wanted it all in one place.

This implementation also support *joining* two paths together, which we
previously didn't.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This will obsolete the existing calls to RPC "sendonionmessage", but
we transition by introducing it separately.  It's designed to work with
the common/onion_message routines and "injectonionmessage".

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…handling.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…ctions.

And make it use inject_onionmessage.  This means we have to be more careful
in createinvoice_done where we had a payload field allocated off tmpctx.

The new code correctly handles the case where we find a path (not just
a peer!) to the start of a blinded path, and need to join the paths.

It worked before if we had to connect directly, just not in the case
where we actually found a usable route of more than 1 hop.

Changelog-EXPERIMENTAL: fixed: onionmessage replies now work even if we need to route to the start of the blinded reply path.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…oice_request

send_onion_reply() does that for us now, so we don't need to do it up-front.

Simplifies the code quite a bit.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This is significantly simpler, too.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Simplification.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We iterate through the blinded paths until we can use one, and because we use
the modern code, we properly join paths if we need to route more than one hop
to reach the start of the blinded path.

Changelog-EXPERIMENTAL: fixed: fetchinvoice tries all blinded paths until one is usable, and handles case where we have to route more than one hop to reach the entry point.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…sage does it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…ths.

This will let us test, at least, as we implement fetching invoices from
them.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Now we can specify a blinded path in an offer, we have to check they
used it (or didn't use it, if we didn't have one!).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We only need a connection with a peer, not an actual channel.  So
add all peers to the local gossmap.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We generate a reply path by simply reversing the outgoing path:

	A->B->C gives reply path B->A
	A->B gives reply path A

But if we are not a public node, we can't use ourselves as the first
entry of the reply path: this happens if we directly connect to the
head of a blinded path (as we now support).

In this case, give the entire path as a blinded path.  We could do
this all the time, but there are some cases where nodes don't like
sending replies where the node itself is the head of the blinded
path (like CLN v24.05 or before!).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
@rustyrussell
Copy link
Contributor Author

Fixed test which is now not compatible with liquid

@vincenzopalazzo
Copy link
Collaborator

Looks like that inside the CI there is a mem leak, I will be able to look at it only later in the week, otherwise the PR looks good to go to me

@rustyrussell
Copy link
Contributor Author

Looks like that inside the CI there is a mem leak, I will be able to look at it only later in the week, otherwise the PR looks good to go to me

Was actually a crash, caused by us trying to use the latest BOLT master test vectors (I just merged an update which renamed some fields). We should be running against BOLTVERSION, so I fixed that!

Copy link
Collaborator

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 3428a7e

We check out the master bolts branch, and that recently changed test vectors
causing our CI to change.  We should test them against our current BOLTVERSION,
which is in .tmp.lightningrfc/

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
@vincenzopalazzo vincenzopalazzo merged commit 6bf41f4 into ElementsProject:master Jul 17, 2024
35 of 36 checks passed
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