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

829 Commits

Author SHA1 Message Date
ueno
efd16b9b20 fix <id> tag 2019-11-20 00:12:20 +00:00
Thorkil Værge
a5b3818204
Specify that resolution of amount is msat
When the `p` multiplier is used, the amount MUST be divisible
by 10 since the resolution used internally is millisatoshi.

This addresses but does not close #692.
2019-11-14 08:38:53 +01:00
Tim Ruffing
35f6376f20 pubkeys live on the curve, not in the finite field 2019-11-04 06:00:50 +01: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
Rusty Russell
78bc516f96 BOLT 2: specify that you can't send funding_locked until you've checked the tx.
We might argue this does not apply if you set `minimum_depth` to 0, since
you're assuming trust (TurboChannels-style), but it needs to be specified.

See: CVE-2019-12998 / CVE-2019-12999 / CVE-2019-13000
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-10-03 00:41:12 +00:00
Rusty Russell
3154157459 BOLT 7: gossip_query_ex typos. (#673)
* BOLT 7: fix cut & paste typo.

This is `reply_channel_range_tlvs`: `query_channel_range_tlvs` is defined
above.  Somehow this fix got lost in the merge process, and breaks
our spec parsing.

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

* BOLT 7: add missing `encoding_type` field in query_short_channel_ids_tlvs / reply_channel_range_tlvs

The implementations have it, and the requirements refer to it,
but it's not actually in the description!

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

* BOLT 7: clarify specification.

As agreed in http://www.erisian.com.au/meetbot/lightning-dev/2019/lightning-dev.2019-08-05-20.03.html,
checksums are not encoded as encoding_type + byte, but as a straight
array.  Referring to them as `*byte` is thus underspecifying them:
they are literally `*channel_update_checksums`.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-09-30 13:50:47 +02:00
Rusty Russell
2afe3559e8 option_static_remotekey: final draft.
This separates out the static remotekey changes from the more ambitious
option_simplified_commitment (which also included pushme outputs and
bring-your-own-fee for HTLC outputs).

As per http://www.erisian.com.au/meetbot/lightning-dev/2019/lightning-dev.2019-09-02-20.06.html

Thanks to everyone for feedback: @araspitzu @roasbeef @bitconner

Suggested-by: @roasbeef
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-09-26 06:19:58 +00:00
Dimitris Apostolou
3476c9b25a Fix typos 2019-09-26 06:12:41 +00:00
sstone
c8e53fe5bf BOTL 7: fixup: clarify when to reply with a node_announcement
Do not reply with a node_announcement if the query includes an optional query flag that does not request it.
The current wording could be interpreted as "always follow with node announcements whenever
you reply with a channel announcements" which defeats the point of using query flags (if you want the node
announcements just set the corresponding bits).
2019-09-16 22:36:59 +02:00
sstone
313c0f290e Add test vector for extended queries 2019-09-16 22:36:59 +02:00
sstone
30485af1df Define a feature bit for extended gossip queries 2019-09-16 22:36:59 +02:00
Fabrice Drouin
2f3514fe75 TLV Formatting changes
We use the more tool-friendly `...*` description for TLV extensions.
Checksums are now serialized as raw arrays, as using zlib compression here would not help.
2019-09-16 22:36:59 +02:00
sstone
2ba49eb467 Fixup: address review comments 2019-09-16 22:36:59 +02:00
sstone
1f95ea95bc Spelling fixes 2019-09-16 22:36:59 +02:00
Rusty Russell
9d6f969722 BOLT 7: fixup: specify exactly which version of CRC32.
This is the one in SSE4, FWIW, and the iSCSI RFC contains test
vectors.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-09-16 22:36:59 +02:00
Rusty Russell
62dcf0fced BOLT 7: fixup: add missing encoding_type in checksums_tlv.
Since some can be zero (missing updates), it's probably worth
doing the compression thing optionally.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-09-16 22:36:59 +02:00
Rusty Russell
420d740311 BOLT 7: fix up TLV formatting for modern parser.
Formatting changes only.

This make tools/extract-formats.py work (well, it misses some stuff
until the tlv-testcases merge, but then it's OK).

We use `tlvs` (for tlv stream), and we refer to TLV records as "being
included" rather than re-using the TLV name.

We even use subtypes for the pairs of checksums and timestamps.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-09-16 22:36:59 +02:00
sstone
fc44a58a93 BOLT7: query_channel_range: allow requesting timestamps & checksums (folded)
Nodes that support extended queries will append an additional extended query flag to
their `query_channel_range` queries. If the receiver supports extended queries and
understands this flag, it will append the required additional data to its
`reply_channel_range` message.

There is currently only one type of additional data: one timestamp and one checksum
per `channel_update`.
The checksum is a CRC32 checksum computed over the `channel_update`
with `timestamp` and `signature` omitted.

Along with query_short_channel_ids extension, this can be used to
avoid querying `channel_updates` that are older than the ones you
already have, or that are newer but don't include new information.
2019-09-16 22:36:59 +02:00
sstone
0b5ba0cd4e BOLT7: query_short_channel_ids: allow requesting specific information (folded)
Nodes can append additional data to their `query_short_channel_ids`
messages, which consists in one flag per short channel id and
specifies what they would like to receive (`node_announcement`,
`channel_announcement`, or/and one `channel_update` or both).
2019-09-16 22:36:59 +02:00
Darosior
6e1bea0d48 bolt04: Correct some typos (#667) 2019-09-06 08:39:16 +00:00
Darosior
d669b01ba7 BOLT #3: Use space to indent in key derivation algorithms (#665) 2019-09-05 07:44:38 +00:00
Bastien Teinturier
db92932a9f
BOLT 04: Add failure code for invalid payload. (#627)
The specification currently doesn't specify the case where the onion per-hop
payload can't be correctly decoded.

This is somewhat fine with the fixed frames because every field of the payload
can always be interpreted as a numeric value from the input bytes, so it leads
to application errors in upper layers when those values are actually
interpreted (and we realize that for instance we have an invalid
short_channel_id` value).

With variable-length tlv streams in the onion payloads, we will encounter
decoding errors (duplicate tlv types, invalid ordering, etc) and the spec
should define the failure code to use in that case.
2019-09-03 06:54:13 +00:00
Rusty Russell
03fd18e5bc fixup! BOLT 11: Add test vectors for feature bitfield. 2019-09-03 01:00:47 +00:00
Rusty Russell
2eea93e133 BOLT 11: Add test vectors for feature bitfield.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-09-03 01:00:47 +00:00
Rusty Russell
b93b3bf518 BOLT 11: Add feature bits.
Most obviously, we want this for BASE AMP, but it's useful in future.

Even though even bits won't cause existing implementations to know
they can't pay the invoice, it will allow it in future once everyone
has upgraded.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-09-03 01:00:47 +00:00
ueno
aba7a8fe46 BOLT7: channel_update after exchange funding_locked (#657)
If a node sends its own `channel_update` to a peer node before receiving a `funding_lock`, the peer node may discard because it has not `short_channel_id` yet.
2019-09-02 20:09:59 +00:00
Nadav Kohen
8555709811 BOLT 3: Explicit description of implicitly enforced timelocks on HTLC outputs (#601)
* Added descriptions of how a 2-of-2 multisignature verification is used for enforcing timelocks when timing out on-chain offered HTLCs as well as spending on-chain received HTLCs in the success case.
2019-08-19 21:52:09 +00:00
Joost Jager
6729755f0c BOLT 4: Merge final_expiry_too_soon into incorrect_or_unknown_payment_details (#608)
In commit 914ebab908 the
incorrect_payment_amount error was merged into
incorrect_or_unknown_payment_details to prevent a probing attack
that allowed intermediate nodes to learn the final destination of
a payment.

A similar attack is possible using the htlc expiry value. By trying
payments with the correct amount but low expiry values to candidate
destinations, an incorrect_or_unknown_payment_details error can be
elicited. This would signal that the probe payment was sent to the
final destination.

For the intermediate node to determine the correct amount, an estimate
must be calculated. A logical choice would be the outgoing amount of the
intermediate node plus some allowance for routing fees that would
otherwise be paid to subsequent nodes along the path.

Picking a low enough - but not too low - expiry value is more tricky.
A reasonable guess could be made using external knowledge of the
final destination's implementation defaults or the type of invoice that
is paid to. Especially in the case of an hodl invoice that typically has
a large expiry delta, it is easier to make a correct guess.

This form of attack is arguably harder to realize than the amount probe
that was previously possible. The attacker may accidentally
pay the invoice if the expiry value guess satisfies the invoice
final cltv requirement. In that case, the attacker still has the
incoming htlc to pull which limits the loss.
2019-08-19 13:12:52 -07:00
lisa neigut
300f7a6e61 option_data_loss_protect: concretely define
`my_current_per_commitment_point`

Make it more obvious what the expected value of
`my_current_per_commitment_point` is.
2019-08-09 12:39:18 -05:00
Rusty Russell
d498d2ac56 tools/extract-formats.py: allow '.' in length fields.
In practice, using '...*type' is the clearest and simplest way to specify
the common case of "the rest of the TLV is an array of 'type'", rather
than some arbitrary expression with a made-up length field.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-08-06 00:18:49 +00:00
Rusty Russell
9491348d27 tools/extract-formats.py: allow '*' as well as '1.'/'2.'
The format for TLV types looked pretty, but @ZmnSCPxj points out that
successive ordered lists in markdown get merged into one megalist.

If we allow ordered or unordered lists, we're a bit more futureproof
against formatting changes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-08-06 00:18:49 +00:00
Bastien Teinturier
8b2cf00546
Bolt 04: fix a few left-over spelling / clean-up nits (#653)
* Fix a few left-over spelling / clean-up nits
* Bolt 09: fix spec links
2019-07-31 07:21:38 +00:00
Hiroki Gondo
44c6071d18 BOLT 2: correct next_remote_revocation_number to next_revocation_number (#652) 2019-07-29 07:31:07 +00:00
Rusty Russell
3da8923453 spelling: check all the .md files
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-07-28 07:03:19 +00:00
Rusty Russell
4f68ed4d6e CONTRIBUTING.md: first draft of how to write and change spec.
Thanks to feedback from @t-bast and @ariard, and Michael Kerrisk
who helped me find the 1999(!) man page text.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-07-28 07:03:19 +00:00
Christian Decker
d23f4b056c bolt04: Remove TLV based termination signal
As discussed during the IRC meeting on 2019-07-22 this would have been a
duplication of signals. It was decided to use one for now, with the option of
coming back should we ever need the last 32 bytes of the onion.
2019-07-26 11:38:33 +02:00
Christian Decker
15299bd57a bolt09: Cleanup the feature bits tables and extract URLs into footer
The tables were a bit unreadable in the source view, and the globalfeatures
table was not rendering correctly. This is just a minor cleanup pass.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
Suggested-by: Janus Troelsen <@ysangkok>
2019-07-26 11:38:33 +02:00
Christian Decker
0616c29bed bolt04: Introduce the destination_signal to the tlv_payload
As discussed during the spec meeting this allows us not to use the 32 byte
HMAC to identify the last hop, and use a 2-byte signal instead.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-07-26 11:38:33 +02:00
Christian Decker
6120510dd3 bolt07: Add feature bits for multi-frame support 2019-07-26 11:38:33 +02:00
Christian Decker
4ac1bcc99b bolt04: Shut the spellchecker up 2019-07-26 11:38:33 +02:00
Christian Decker
6cdbedb649 bolt04: Add the TLV types for the new payload format
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-07-26 11:38:33 +02:00
Christian Decker
10c345bcf4 bolt04: Remove in-spec test vector in favor of JSON test vector
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-07-26 11:38:33 +02:00
Christian Decker
ecaf591bca bolt04: Amend the filler generation and onion decoding to varpayload
This actually introduces the variable size shift and filler generation.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-07-26 11:38:33 +02:00
Christian Decker
a148abbad5 bolt04: Describe the variable size hop_payload
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-07-26 11:38:33 +02:00
Christian Decker
3ac0091ef9 bolt04: Formatting cleanup and fold clarifications into conventions
The clarifications were tacked on after the fact, but they should really be
part of the conventions. I also updated the links to use the reference style,
which results in better text flow and makes it easier to read the source.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2019-07-26 11:38:33 +02:00
Ugam Kamat
1810eaf4c8 BOLT #7: Correct indentation typo in channel_update message (#649) 2019-07-23 09:27:29 +02:00
ueno
11650d7ebe BOLT7: (announcement_signatures) Fail channel if short_channel_id not correct. (#635) 2019-07-23 09:25:59 +02: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
2fe6af8567 spellcheck: allow space-separated hex, and a few new terms.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-07-22 23:27:13 +00:00