Clarify fulfillment payload padding requirement - #1353
joostjager wants to merge 3 commits into
Conversation
Require a padding record only when the serialized TLV stream does not already meet the 256-byte bucket requirement.
|
I thought you were also talking about the padding done for failure messages, since your comment didn't include an exact link to the spec. We have weird repeated requirements where the first one says That's why I suggested to open a follow-up PR, I didn't understand that your comment was explicitly scoped to fulfillment payload. Probably worth taking a look at every place where we pad in a similar way? |
|
I think the MUST+SHOULD is a result of But yes, my comment was scoped just to the fulfill payload. It's not that the spec is wrong as is now, but it also isn't completely clear the padding tlv can be omitted. |
Sorry then, I was too trigger-happy when I merged that PR, I didn't understand what you meant!
Yes I think that since we're doing a dedicated PR and it has been quite some time, it's a good opportunity to clean that up now. |
Remove the recommendation to keep padded failure messages at exactly 256 bytes now that senders support longer failure messages.
|
Updated |
|
One unfortunate thing about padding to 256 bytes using only TLV type |
|
Not sure if I am still all that happy with the in-tlv padding |
Why do you think a present but empty padding TLV makes sense (if I understand your scenario correctly - please be more precise if I'm misunderstanding)? Can you detail that scenario? It looks like an edge case that we simply will never reach, doesn't it? |
| @@ -1138,9 +1138,6 @@ which is in turn applied to the `attribution_data` field using `XOR`. | |||
| The _erring node_: | |||
| - MUST construct the return packet such that its total length is no more than 32768 bytes (32 KiB). | |||
| - MUST set `pad` such that the `failure_len` plus `pad_len` is at least 256. | |||
There was a problem hiding this comment.
Do we want to take this opportunity to use multiples of 256 bytes here as well for consistency?
There was a problem hiding this comment.
It can't be a MUST. I could re-add a new SHOULD? 😅
In this touch-up PR I wouldn't want to change anything really, just clarify.
There was a problem hiding this comment.
It is on the sender requirements, so it can definitely be a MUST as long as we don't change the receiver requirements yet? But we can indeed skip it, maybe worth checking with lnd and cln whether they think it makes sense to do.
I was thinking of an otherwise-empty payload as cover traffic, since omitting |
Can't you just include an all-0 fulfillment payload then instead? Or any other unrelated "cover traffic" TLV if necessary? |
A literal all-zero The 256-byte issue is specific to using a one-byte-encoded padding type such as type We could define a separate cover TLV, but having both padding and cover fields in the specification seems redundant? |
|
Can we add some test vectors here? |
Add standalone TLV stream vectors covering omitted and empty padding records, along with BigSize boundaries that require a larger 256-byte multiple. Link the vectors from the BOLT 4 returning success examples.
|
Added test vectors. They show the limitation of type-1 TLV padding pretty clearly: some 256-byte boundaries can't be reached. Not sure whether we still want to change anything about that or just roll with what we have. |
Require a padding record only when the serialized TLV stream does not already meet the 256-byte bucket requirement.