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

Onion Updates to Match Latest Spec (and test vectors!) #4921

Merged

Conversation

rustyrussell
Copy link
Contributor

@rustyrussell rustyrussell commented Nov 18, 2021

Once again, we support old and new onions. First I remove the old-old spec versions. Then I rename the new to obs2. Then add the new ones. Then make sure we send and receive both OK.

This should comply with the latest route blinding lightning/bolts#765 and onion message lightning/bolts#759 proposals.

Thanks to @t-bast and @thomash-acinq and @joostjager for all the feedback!

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.

LGTM, Github action point me out an error, where I don't know if there are any better solutions than the ones that I proposed in the comment.

Anyway, it is only a comments

tests/test_pay.py Outdated Show resolved Hide resolved
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.

I think here the mistake it is the space and not the end line, if I'm not wrong python have 2 end-line conventions between function.

So, in this case, looks good the change, but I think in the file there is a space " "

@rustyrussell rustyrussell force-pushed the guilt/onion-testvectors branch 3 times, most recently from fde2140 to e480712 Compare November 28, 2021 00:45
@rustyrussell
Copy link
Contributor Author

Rebase to fix flakes...

@vincenzopalazzo
Copy link
Collaborator

I think we have a list part to migrate in the new spec version, that it is test_pay.py

lightning/tests/test_pay.py

Lines 3284 to 3301 in 35c6f90

route = [{'id': l2.info['id'],
'channel': l1.get_channel_scid(l2),
'amount_msat': Millisatoshi(1002),
'delay': 21,
'blinding': blinding,
'enctlv': p1enc},
{'id': p2,
'amount_msat': Millisatoshi(1001),
'delay': 15,
# FIXME: this is a dummy!
'channel': '0x0x0',
'enctlv': p2enc},
{'id': p3,
# FIXME: this is a dummy!
'channel': '0x0x0',
'amount_msat': Millisatoshi(1000),
'delay': 9,
'style': 'tlv'}]

@thomash-acinq
Copy link

This PR is compatible with ACINQ/eclair@59b4035, eclair and c-lightning can send and relay messages to each other.

@rustyrussell
Copy link
Contributor Author

I think we have a list part to migrate in the new spec version, that it is test_pay.py

lightning/tests/test_pay.py

Lines 3284 to 3301 in 35c6f90

route = [{'id': l2.info['id'],
'channel': l1.get_channel_scid(l2),
'amount_msat': Millisatoshi(1002),
'delay': 21,
'blinding': blinding,
'enctlv': p1enc},
{'id': p2,
'amount_msat': Millisatoshi(1001),
'delay': 15,
# FIXME: this is a dummy!
'channel': '0x0x0',
'enctlv': p2enc},
{'id': p3,
# FIXME: this is a dummy!
'channel': '0x0x0',
'amount_msat': Millisatoshi(1000),
'delay': 9,
'style': 'tlv'}]

Yes. While HTLCs with blinded routing are not completely specced, they're pretty obvious. I'll see if it's better to implement or just disable for now...

Not all plugins depended on their headers.  Keep it simple: all
plugins depend on all plugin headers.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Temporarily disable sendpay_blinding test which uses obsolete onionmsg;
there's still some debate on the PR about how blinded HTLCs will work.

Changelog-EXPERIMENTAL: onionmessage: removed support for v0.10.1 onion messages.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Yes, we changed the spec again.  Hopefully for the last time!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This is from 6e99c5feaf60cb797507d181fe583224309318e9

We renamed the enctlv field to encrypted_recipient_data in the spec, and the
new onion_message is message 513.  We don't handle it until the next patch.

Two renames:
1. blinding_seed -> blinding_point.
2. enctlv -> encrypted_recipient_data.

We don't do a compat cycle for our JSON APIs for these experimental
features only used by our own plugins, we just rename.

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

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
It's very similar to the previous, but there are a few changes:

1. The enctlv fields are numbered differently.
2. The message itself is a different number.

The onionmsg_path type is the same, however, so we keep that constant
at least.

The result is a lot of cut & paste, but we will delete the old one
next release.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
And wire it through to the hook; update the plugins to recognize
modern vs obs2 onions.

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

And include the final destination enctlv.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This builds on the enctlv vectors, but actually goes all the way
to creating a modern onionmessage.

Thanks to Thomas H for corrections!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
As noted by Joost.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
As of 2b923a0367c5f9154fcec706e3302cc4658dd889.

Recurrence quotes need to be marked separately, since they're no longer
in offers main bolt.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
We also move recurrence fields into a separate spec patch.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This has been here for a while: self_id hangs around while we're
calling the hook, but now it triggers sometimes.

```
E           ValueError: 
E           Node errors:
E           Global errors:
E            - Node /tmp/ltests-3mcyp67u/test_dev_rawrequest_1/lightning-1/ has memory leaks: [
E               {
E                   "backtrace": [
E                       "ccan/ccan/tal/tal.c:442 (tal_alloc_)",
E                       "gossipd/gossipd_wiregen.c:528 (fromwire_gossipd_got_onionmsg_to_us)",
E                       "lightningd/onion_message.c:152 (handle_onionmsg_to_us)",
E                       "lightningd/gossip_control.c:137 (gossip_msg)",
E                       "lightningd/subd.c:548 (sd_msg_read)",
E                       "ccan/ccan/io/io.c:59 (next_plan)",
E                       "ccan/ccan/io/io.c:407 (do_plan)",
E                       "ccan/ccan/io/io.c:417 (io_ready)",
E                       "ccan/ccan/io/poll.c:453 (io_loop)",
E                       "lightningd/io_loop_with_timers.c:21 (io_loop_with_timers)",
E                       "lightningd/lightningd.c:1164 (main)"
E                   ],
E                   "label": "gossipd/gossipd_wiregen.c:528:struct secret",
E                   "parents": [
E                       "lightningd/onion_message.c:149:struct onion_message_hook_payload",
E                       "lightningd/plugin_hook.c:81:struct hook_instance *[]"
E                   ],
E                   "value": "0x55cf3cbc9458"
E               }
E           ]

```
@rustyrussell
Copy link
Contributor Author

Re-rebased on master.

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 afb91fd

@rustyrussell rustyrussell merged commit e2698c5 into ElementsProject:master Nov 30, 2021
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