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

73 Commits

Author SHA1 Message Date
Bastien Teinturier
f38f559244
Revert "Bolt 1: Specify that extensions to existing messages must use TLV (#714)" (#753)
This reverts commit 6ac177f95c.
2020-02-29 15:00:42 +01:00
Bastien Teinturier
6ac177f95c
Bolt 1: Specify that extensions to existing messages must use TLV (#714)
The spec already prepared a hook to add additional information to existing
messages (additional bytes at the end of a message must be ignored).

Since we're using TLV in many places, it makes sense to use that optional
additional space at the end of each message to allow an optional tlv stream.

This requires making a few previously optional fields mandatory:

- channel_reestablish commitment points: it makes sense to always include those
  regardless of whether `option_dataloss_protect` or `option_static_remotekey` are set.
- option_upfront_shutdown_script: if you're not using one, just set the length to 0.
  That field is moved to a TLV record because luckily, the resulting bytes are the same.
  This provides more flexibility to later remove the requirement of making this field mandatory.

No need to change the `channel_update`'s `htlc_maximum_msat` because
the `message_flags` encode its presence/absence.
It can still be either included or omitted without causing issues to the extension stream.
2020-02-28 10:25:44 +01:00
Rusty Russell
7b0169263e
BOLT 1: add networks to init message. (#682)
Add networks to init message via TLV extension.
This prevents accidentally connecting a testnet node to mainnet or the other way around.
2020-02-18 09:46:58 +01:00
kiminuo
75f46ba89b
Update 01-messaging.md (#732)
Add missing parenthesis in link.
2020-01-29 10:11:46 +01:00
Bastien Teinturier
caca4375e6 BOLT 1: Define custom message type range 2020-01-21 13:39:27 +01:00
Conner Fromknecht
4c638b7353 09+11: require transitive feature dependencies
This commit:
 - Adds a new Dependencies column to the BOLT 9 feature table
   populated with existing feature dependencies.
 - Requires that all valid feature vectors set transitive dependencies.
 - Requires checking transitive dependencies when validating init
   messages and payment request.
 - Removes transitive feature requiremetns from the BOLT 11 writer, now
   that they are implicit by needing to comply with the BOLT 9 origin
   requirements.
2020-01-21 13:26:49 +01:00
Rusty Russell
206084c939 BOLT 9: flatten feature fields.
We simply specify, in each case, where they will appear ("Context").

Because `globalfeatures` is already in use, we fold that into the
renamed `localfeatures` field to unify them (now called `features`),
but dissuade further use.

Note also: we REQUIRE minimal `features` field in
channel_announcement, since otherwise both sides of channel will not
agree and not be able to create their signatures!

Consider these theoretical future features:

`opt_dlog_chan`: a new channel type which uses a new discrete log HTLC
type, but can't support traditional HTLC:

* `init`: presents as odd (optional) or even (if traditional channels
  not supported)
* `node_announcement`: the same as above, so you can seek suitable peers.
* `channel_announcement`: presents as even (compulsory), since users need
  to use the new HTLCs.

`opt_wumbochan`: a node which allows channels > 2^24 satoshis:

* `init`: presents as odd (optional), or maybe even (if you only want
  giant channels)
* `node_announcement`: the same as above, so you can seek suitable peers.
* `channel_announcement`: not present, since size of channel indicates
  capacity.

`opt_wumbohtlc`: a channel which allows HTLCs > 2^32 millisatoshis:

* `init`: presents as odd (optional), or even (compulsory)
* `node_announcement`: the same as above, so you can seek suitable peers.
* `channel_announcement`: odd (optional) since you can use the channel
  without understanding what this option means.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Co-Authored-By: Bastien Teinturier <31281497+t-bast@users.noreply.github.com>
2019-11-25 19:34:23 +00:00
ueno
efd16b9b20 fix <id> tag 2019-11-20 00:12:20 +00:00
Joost Jager
3d60581a7a BOLT 1: Define custom tlv record range (#660) 2019-10-28 12:11:31 -07:00
Chris Shucksmith
7078c9141a minimally encoded explanation needs inverting (#685) 2019-10-21 09:44:46 +02:00
Dimitris Apostolou
3476c9b25a Fix typos 2019-09-26 06:12:41 +00:00
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