1
0
mirror of https://github.com/lightning/bolts.git synced 2024-11-19 01:50:03 +01:00
Commit Graph

62 Commits

Author SHA1 Message Date
Rusty Russell
aa33af0c4d BOLT 1: Add test vectors.
These are based on @t-bast's vectors from #607, with a few more
cases:

1. Explicitly test encodings for 253, 254 and 255.
2. Use BigSize and make sure tests break badly if endian parsing is wrong.'
3. Test wrap-around of type encodings in stream.

Many thanks to @t-bast and @cfromknecht for their contributions and testing

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-07-22 23:27:13 +00:00
Rusty Russell
f3fb4ec9c4 BOLT 1: explicitly disallow trailing data, require minimal values.
We didn't explicitly say that the TLV is bad if length exceeds
the message length!

We didn't specify whether to ignore extra bytes: we should.
Similarly, contents of values must be minimal (i.e. tu64 etc).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-07-22 23:27:13 +00:00
Conner Fromknecht
65784f755f BOLT01: swap CompactSize for BigSize in TLV format
This commit modifies the varint encoding used for TLV types and lengths
to use a custom format called BigSize. The format is identical to
bitcoin's CompactSize, except it replaces the use of little-endian
encodings for multi-byte values with big-endian. This is done to prevent
mixing endianness within the protocol, since otherwise CompactSize would
be the first introduction of little-endian encodings.
2019-07-22 15:19:09 -05:00
Rusty Russell
76d4ab9f1a BOLT 1: Remove git conflict marker (#628)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-07-09 09:37:03 +02:00
Rusty Russell
6f6ea63233 BOLT 1,2,4,7: remove pubkey fundamental type in favor of point.
And remove `secret` and `preimage` types in favor of open-coding.

Agreed-at: http://www.erisian.com.au/meetbot/lightning-dev/2019/lightning-dev.2019-07-08-20.05.html

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-07-09 00:48:46 +00:00
Rusty Russell
72ed1b2214 BOLT 1: add TLV types.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-07-09 00:48:46 +00:00
Rusty Russell
6639cef095 Spec: use explicit types, not just bytelengths for fields.
It's trivial to make types->lengths, but not so much the other way.

The types I used here are the ones I found useful in implementation, and
I think add some clarity, though we can certainly argue about them.

There's no normative changes to the spec in here.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-07-09 00:48:46 +00:00
Conner Fromknecht
779664cd82
BOLT01: add TLV spec 2019-06-12 15:14:55 -07:00
Pierre-Marie Padiou
1fd1e76f9e clarify that error should target the unkown channel 2018-10-18 05:15:22 +00:00
Pierre-Marie Padiou
1de095a0b3 reply to unknown channels with an error 2018-10-18 05:15:22 +00:00
Rusty Russell
a8207ec316 BOLT 1: options must be included if negotiated, not if understood.
Obviously you can't include fields you don't understand, but importantly
if the other side doesn't agree, you don't need to include them.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-06-28 00:21:23 +00:00
Rusty Russell
6ea6418a92 BOLT 1: dont close channels with other nodes.
Seems obvious, but the spec should spell it out!

Closes: #418
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-05-24 04:21:49 +00:00
ueno
4ef035f8c2 fix #385 2018-02-22 00:15:22 +00:00
practicalswift
a820356da8 Redundancy. Drop redundant use of "very". 2018-01-30 03:34:22 +00:00
MeshCollider
4b5379b2ac Fix formatting of BOLT links 2018-01-22 14:02:01 +01:00
practicalswift
2d9a0b5793 Add missing closing parenthesis 2018-01-08 02:30:34 +00:00
Pierre-Marie Padiou
b46aa422dd do not print DEL character 2017-12-11 23:10:39 +00:00
RodneyNeilMorris
e64a738f62 Update 01-messaging.md
Clarified, wording to match that used in Requirements section.
2017-12-10 23:47:48 +00:00
Landon Mutch
5db55df16a BOLT 1,2,3: apply updated stylesheet guidelines for list capitalization, punctuation 2017-12-07 02:36:10 +00:00
Landon Mutch
4cc95f8190 BOLT 2: apply updated stylesheet guidelines for data measurements; 2017-12-07 02:36:10 +00:00
Rusty Russell
be557e32a0 BOLT 1: options are no longer numbered.
I named the first option `option209` but that was too ugly to live.
Nonetheless, this wording lived on.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-11-28 23:12:20 +00:00
Landon Mutch
f23e3dd56b BOLT 1,2,3: first pass copy-edit;
BOLT 1,2: minor header spacing fixes
BOLT 3: first pass copy edit, according to capitalization, formatting stylesheet guidelines;
2017-11-28 23:11:55 +00:00
Shannon Appelcline
287a2c4422 Minor line edits 2017-11-27 23:38:01 +00:00
Landon Mutch
c89a54a7da BOLT 0,1,2: fix requested changes;
update stylesheet to reflect appropriate structure of Requirement sub-items and format of digits, numerations, and quantities;
copy edit BOLTs 0,1,2 to adhere to these changes;
2017-11-15 02:55:16 -08:00
landonmutch
3d67c79235
Merge branch 'master' into master 2017-11-13 17:48:03 -08:00
Rusty Russell
a759dff029 BOLT 1, tools: add support for our first optional field.
We've always specified that fields can be appended, and we're about to
do our first.  Make it clear that you can't just send one if we add several
fields as part of the same option.

Change extract-formats to have an optional new field appended: the
input format is to simply add ' (optionname)' in the data
specification.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-11-13 11:10:32 -08:00
Landon Mutch
03197f2959 BOLT 1, 2: copy edit
BOLT 1: minor list formatting fix;
BOLT 2: copy edit up to line 955;
2017-11-10 18:14:27 -08:00
Landon Mutch
441da24462 Merge branch 'master' into copy-edit-bolts 2017-11-10 14:09:05 -08:00
Landon Mutch
b475639f48 BOLT 0, 1, 2: copy edit
add stylesheet item: prefer typed, not written numbers;
updated BOLT 0, 1 to reflect change;
copy edit BOLT 2 up to line 674;
2017-11-10 14:05:21 -08:00
Landon Mutch
4e70a8b607 update stylesheet checklist
fix stylesheet formatting; add passive voice item to stylesheet checklist; apply passive voice change to BOLT 1;
2017-11-10 11:49:19 -08:00
Landon Mutch
e885a631e8 BOLT 1: change HTML tags to markdown 2017-11-09 23:23:53 -08:00
Landon Mutch
20fca8b90c fix 01-messaging missed unordered list spacing 2017-11-09 19:03:08 -08:00
Landon Mutch
919df997a3 fix 01-messaging unordered list spacing so formats correctly in githubs markdown 2017-11-09 18:55:40 -08:00
Landon Mutch
c3ef4cabe5 fix 00-introduction, 01-messaging section spacings for format consistency 2017-11-09 18:32:52 -08:00
Landon Mutch
2d829756e1 Amend: Make pull request changes; re-structure requirements; correct grammar
Implement changes requested by @rustyrussell: wording change, structure requirements according to whether nodes are sending or receiving;
Correct grammar, punctuation, capitalization, and style for correctness, concision, clarity, comprehension, and consistency;
2017-11-09 15:26:26 -08:00
Landon Mutch
531317b3b4 Further clarify 01-messaging requirement structures by deepening branches. 2017-11-04 18:53:46 -07:00
Landon Mutch
5450ec193a Organize 01-messaging requirements into unordered lists
Requirements were difficult to follow in existing sentence form, so I reordered them into hopefully more intuitive groups of unordered lists.
2017-11-04 14:43:56 -07:00
Landon Mutch
34878c0d96 copy-edit 01-messaging for appropriate grammer, punctuation, and style
Edit 01-messaging copy for clarity (minor rephrasing, punctuation),
    correctness (grammar, capitalization, punctuation),
    consision (minimizing wordiness, redundancy),
    and consistency (document style, e.g. 1 space between sentences,
    capitalization of headers, etc.)
2017-11-04 09:32:50 -07:00
Rusty Russell
1e228bcf8f Clarify init-message description
This is based on a series of patches from @EmelyanenkoK which makes the treatment of feature bits clearer and adds rationale so that future extensions can be made wisely.

Thanks to all involved!

Closes: #156 
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-05-25 09:43:31 +09:30
Rusty Russell
4f585fe2d0 BOLT 1: underscores and backticks everywhere.
Typo fix: bytelen -> byteslen

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-05-11 11:20:36 +09:30
Rusty Russell
6849b2bbc6 BOLT 1: misc typo fixes.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-05-03 13:08:07 +09:30
Pierre-Marie Padiou
440c2de107 specify when the temporary_channel_id->channel_id switch occurs 2017-05-01 13:45:34 +09:30
Takaya Imai
f6186dba00 Fix brackets 2017-04-26 06:02:24 +09:30
Rusty Russell
9c050b91d7 BOLT 1: max requested pong length is 65531, not 65533, add rationale.
Forgot the type field.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-04-10 18:26:15 -07:00
Pierre-Marie Padiou
8f57038337 expanded definition of setup messages 2017-04-08 03:23:31 +09:30
Olaoluwa Osuntokun
f048a2c298 BOLT 1: introduce ping and pong control messages (#134)
Connections between nodes within the network may be very long lived as
payment channels have an indefinite lifetime. However, it’s likely that
for a significant portion of the life-time of a connection, no new data
will be exchanged. Additionally, on several platforms it’s possible that
Lightning clients will be put to sleep without prior warning. As a
result, we use a distinct ping message in order to probe for the
liveness of the connection on the other side, and also to keep the
established connection active.

This commit adds two new control messages to the protocol: `ping` and
`pong`. Their usage within the network is similar to the usage of such
message within other established protocols: `ping` messages specify a
number of bytes to be contained in the payload of a `pong` message, and
`pong` messages are to be sent in response to receiving a `ping` message.

Additionally, the ability for a sender to request that the receiver send
a response with a particular number of bytes enables nodes on the
network to create synthetic traffic. Such traffic can be used to
partially defend against packet and timing analysis as nodes can fake
the traffic patterns of typical exchanges, without applying any true
updates to their respective channels.

When combined with the onion routing protocol defined in BOLT#4, careful
statistically driven synthetic traffic can serve to further bolster the
privacy of participants within the network.

As a bonus, the usage of periodic `ping` message ensures frequent key
rotation between connected nodes.

[ The result is a bikeshed of every possible color! -- RR ]
2017-04-04 12:54:50 +09:30
Rusty Russell
4af8e18411 BOLT 0,1,2,7: use txout not channel-id for demuxing. (#119)
At cost of a few extra bytes between peers, this avoids the whole "oops, we were on a chain fork" problem, and simplifies generation of temporary channel-ids (just pick a random one).

Now we move the announcement_signature exchange to at least 6 confirms, which makes re-xmit tricky; I resolved that by insisting on reconnect that we send if we haven't received, and reply to the first one.

The term "channel shortid" wasn't used anywhere, so I removed it; it's now a gossip-only thing anyway.

One subtle change: pkt_error on unknown channels is now "MUST ignore"; this section was reworked anyway, and we'll want this if the #120 goes through, where one side might have forgotten unformed channels).

Closes: #114
Suggested-by: Olaoluwa Osuntokun <laolu32@gmail.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

* FIXUP! Two bytes for funding-output-index.

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

* FIXUP! Channel-id rework, temp ids, 32 bits only.

Re-add the idea of temporary channel ids: far simpler since they're now
big enough we can just fill with noise.

Remove the alignment issues by combining txid and outnum using XOR; we
could reduce to 128 bit if we really wanted to, but we don't.

Error handling is now simple again, but while editing I changed the
behaviour for unknown channels to MUST ignore (this is important for

Change the 8-byte gossip channel id to `short-channel-id`.

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

* FIXUP!  Minor text tweaks from Pierre-Marie and Christian

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-03-02 14:50:13 +10:30
sstone
a72b357ee6 BOLT 1: specify connection handling
see #109
2017-02-16 10:14:34 +10:30
Rusty Russell
614af24071 BOLT 2: Message retransmission and reconnect semantics.
1) Make it clear that `init` needs to be sent every time.
   - This means if you upgrade and no longer support an old connection, it's
     clear, plus it simplifies the question of re-transmission of `init`.
2) Spell out the retransmission requirements for reconnection.
   - We agreed in Milan to simply use retransmit and ignore-dups.
   - This needs actual testing by implementations, but this is my best guess
     on exactly how far back to retransmit.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-24 06:51:06 +10:30
Christian Decker
828eda61df BOLT01: Further specifying what it means to be printable
ASCII character set seems apropriate, since it acts a lowest common
denominator, and who'd stuff emojis in an error message anyway?

Fixes #68
2017-01-03 10:27:44 +10:30