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

28 Commits

Author SHA1 Message Date
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
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
Rusty Russell
6af2ba23a8 tools/extract-formats.py: handle continuous types in tlvs.
We were swallowing the unused line after `data`, but it's
normal to do:

```
1. tlvs: `n1`
2. types:
   1. type: 1 (`tlv1`)
   2. data:
     * [`tu64`:`amount_msat`]
   1. type: 2 (`tlv2`)
   2. data:
     * [`short_channel_id`:`scid`]
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-07-22 23:27:13 +00:00
Rusty Russell
acad3fc8fe tools/extract-formats.py: recognize numerics in field names.
For some reason (typo?) we only allowed "2", not other numbers!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-07-22 23:27:13 +00:00
Conner Fromknecht
bc9570d7b4 tools/spellcheck: ignore code blocks 2019-07-22 15:19:09 -05:00
Rusty Russell
d6e477be43 tools/extract-formats.py: rewrite, change output.
Editing the previous mess was horrific.  I gave up and rewrote using a
generator.

Changes to output:
1. subtypes and tlvs now handled.
2. The output format now has explicit prefixes, so readers don't have
   to rely on number of fields to interpret data.
3. Each field is split into type and count; count is empty if there's
   no '*x'.
4. TLV stream typenames are repeated; TLV record type names are not
   necessarily unique.
5. The unused offset field is removed.
6. No arguments taken: everything is always printed, and you can grep if you
   only want some.

[ Fixup by <niftynei@gmail.com> ]
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-07-09 00:48:46 +00:00
Rusty Russell
b2d1204a9f tools/extract-formats.py: handle option labels on types.
We're about to introduce new messages which are gated by options (not
just single fields).  Ignore them for the purposes of parsing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-06-28 00:21:23 +00:00
Rusty Russell
e76ed893d9 tools: remove --check-alignment option.
Alignment requirements were dropped before 1.0 of the spec.

Closes: #407
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-05-24 04:21:31 +00:00
Janus
9d48f3e52f correct feature flagged message fields syntax, update structured.py to support feature flagged fields, print to right output in extract-formats.py 2018-04-11 07:08:18 +00:00
practicalswift
276337a3cc Fix typo in spellchecker ¯\_(ツ)_/¯ 2017-12-18 19:14:25 +00:00
Rusty Russell
4bb1d7e6be tools: allow `` around option names, strip them
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-11-28 00:09:57 +00: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
Rusty Russell
68d53822bd Spelling: expand wildcard to cover all []() patterns. (#228)
Otherwise it complains about "[BOLT #10](10-dns-bootstrap.md)".

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-08-22 09:53:34 +09:30
Christian Decker
d67a28227c tools: Update formatting of python tools 2017-07-11 12:11:12 +02:00
Janus
22544d7789 Script for extracting structured protocol messages
This changes extract-formats.py so that other scripts can use it, but retains normal functionality.
The new script (structured.py) parses the CSV variant and shows a representation of an OrderedMap.
This could be used to write parsers.
2017-07-11 12:11:12 +02:00
Christian Decker
a11d234e18 tools: Disable alignment check when we have a variable length field
If we have a variable length field we should not check the alignment
of the following fields, the check will be off anyway.
2017-07-11 11:09:03 +02:00
Rusty Russell
01571c1e58 Bolt 11: Invoice Protocol for Lightning Payments (#183)
This specifies a draft invoice protocol for lightning payments.

Particular thanks for detailed feedback from:
* ZmnSCPxj <ZmnSCPxj@protonmail.com>
* @Saicere  
* @kallewoof
* @halseth 
* @cdecker 

Signed-off-by: Rusty Russell <rusty@blockstream.com>
2017-06-27 20:08:13 +09:30
Rusty Russell
8ee57b9773 tools: update for new format.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-05-11 11:20:36 +09:30
Rusty Russell
c7092de08b tools/spellcheck.sh: add --check option, add tests to travis.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-05-03 13:08:07 +09:30
Rusty Russell
c38aec71e0 tools/spellcheck: US English.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-05-03 13:08:07 +09:30
ZmnSCPxj via Lightning-dev
7d3083e79a Add spellcheck tool (requires aspell), also spellcheck.
This is a multi-part message in MIME format.

This patch should apply to http://github.com/lightningnetwork/lightning-rfc

Nonidealities:

Aspell triggers spelling errors on the hexadecimal strings in
the test vectors. I don't have enough aspell-fu to figure
out how to make Aspell ignore these.

There are 2 possible pluralizations of `HTLC`: `HTLCs` and
`HTLC's`. I'd prefer the latter, but for now I support both.
We should standardize pluralization; we can edit the
`.aspell.en.pws` file to remove the pluralization we won't
choose.
2017-05-03 13:08:07 +09:30
Rusty Russell
ed107e4ef0 tools/extract-formats.py: allow fields with _ in them.
eg. BOLT 4.

See also: #141

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-03-31 14:14:29 +10:30
Rusty Russell
06a5e6cbdb tools/bolt3-bitcoind-test.sh: setup to feed BOLT3 test vector txs to bitcoind.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-03-17 11:31:37 +10:30
Rusty Russell
347ce303ce tools/extract-formats.py: accept fields from BOLT 4.
Some have no data, and many use constant names and | in their type numbers.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-28 14:10:04 +01:00
Rusty Russell
85ac709641 tools/extract-formats.py: neaten a little.
If we hand an arg, we should use it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-28 14:10:04 +01:00
Rusty Russell
b228a2e77d BOLT 2: remove attempts to align signatures.
They're really a blob of bytes, and we weren't aligning them correctly in
two cases anyway.  This gets rid of gratuitous padding, too.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-29 12:58:13 +10:30
Rusty Russell
fab307b57d tools/extract-formats.py: extract message definitions and check alignment.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-23 11:54:14 +10:30