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

Clarify onion failure data encoding #979

Merged
merged 3 commits into from
May 19, 2022

Conversation

TheBlueMatt
Copy link
Collaborator

No description provided.

Copy link
Contributor

@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!

@@ -853,7 +853,9 @@ The top byte of `failure_code` can be read as a set of flags:
* 0x1000 (UPDATE): new channel update enclosed

Please note that the `channel_update` field is mandatory in messages whose
`failure_code` includes the `UPDATE` flag.
`failure_code` includes the `UPDATE` flag. It is encoded as only the bytes
which would appear in the message body, *not* including the `0x0102` message
Copy link
Collaborator

@t-bast t-bast Apr 19, 2022

Choose a reason for hiding this comment

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

Right now eclair supports decoding both cases, but encodes with the 0x0102 message prefix (IIRC one implementation only supported reading that case at some point so it was the right choice to maximize compatibility). I'm happy to change it if everyone supports it today.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe lnd and we do not use the message type prefix, CLN and y'all do. I'm happy with either, I don't really care, I'm also happy to flip a coin.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd rather drop the message prefix as you propose, I think it makes more sense without it, I just need to make sure that latest versions of all implementations will know how to decode that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Whether they do or not, no-type-prefix is, from what I've seen, by far the most common version on the network, likely because its what lnd does.

* [`u16`:`len`]
* [`len*byte`:`channel_update`]

The channel from the processing node has been disabled.
No flags for `disabled_flags` are currently defined, thus it is currently
Copy link
Collaborator

Choose a reason for hiding this comment

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

In eclair this is actually the channel_update.message_flags byte followed by the channel_update.channel_flags byte, so it won't be 0x0000. It is redundant with the contents of the channel_update though, so I really don't know why a separate field was included in that error.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yea, honestly it seems like an oversight that there's extra bytes here, but given its otherwise redundant I see no reason to copy the channel update flags, better to just set them to 0 and move on.

@Roasbeef
Copy link
Collaborator

lnd doesn't write the type byte today, but all nodes are able to decode both. So either way, if we start to write the type byte, we shouldn't have any propagation/decoding issues.

Apparently not all implementations implemented the onion encoding
the same, causing vastly differing onion failure packets. This
should unify them somewhat.

CC ElementsProject/lightning#5154
@TheBlueMatt
Copy link
Collaborator Author

After meeting discussion I swapped it - the change now says we have to add the message type bytes, not skip them.

Copy link
Collaborator

@t-bast t-bast left a comment

Choose a reason for hiding this comment

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

ACK ef8cead

04-onion-routing.md Show resolved Hide resolved
...well, okay, do today, but by the time anyone is reading this
it'll be "used to".
@TheBlueMatt
Copy link
Collaborator Author

Okay, added a little historical note.

Copy link
Collaborator

@t-bast t-bast left a comment

Choose a reason for hiding this comment

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

ACK a4646fe

@Roasbeef does this look good to you?

@t-bast
Copy link
Collaborator

t-bast commented May 18, 2022

Should we merge this, as discussed during the last spec meeting? @Roasbeef is the historical note good enough for you?

Copy link
Collaborator

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

LGTM 🍣

@remyers
Copy link

remyers commented Nov 21, 2022

You can also close #545 when you close this PR.

morehouse added a commit to morehouse/lnd that referenced this pull request May 3, 2023
For about a year [1], the spec has prescribed encoding channel_updates
with their type prefix (0x0102) in onion failure messages. LND can
decode correctly with or without the prefix but hasn't been writing the
prefix during encoding. This commit starts writing the prefix.

[1] lightning/bolts#979
Roasbeef pushed a commit to lightningnetwork/lnd that referenced this pull request Oct 6, 2023
For about a year [1], the spec has prescribed encoding channel_updates
with their type prefix (0x0102) in onion failure messages. LND can
decode correctly with or without the prefix but hasn't been writing the
prefix during encoding. This commit starts writing the prefix.

[1] lightning/bolts#979
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.

5 participants