From ZmnSCPxj at protonmail.com Sat Apr 29 03:19:07 2017 From: ZmnSCPxj at protonmail.com (ZmnSCPxj) Date: Fri, 28 Apr 2017 23:19:07 -0400 Subject: [Lightning-dev] [PATCH] Add spellcheck tool (requires `aspell`), also spellcheck. Message-ID: 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. --- .aspell.en.prepl | 5 + .aspell.en.pws | 260 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 01-messaging.md | 6 +- 02-peer-protocol.md | 4 +- 03-transactions.md | 4 +- 04-onion-routing.md | 20 ++-- 05-onchain.md | 6 +- 08-transport.md | 8 +- tools/spellcheck.sh | 45 +++++++++ 9 files changed, 334 insertions(+), 24 deletions(-) create mode 100644 .aspell.en.prepl create mode 100644 .aspell.en.pws create mode 100755 tools/spellcheck.sh diff --git a/.aspell.en.prepl b/.aspell.en.prepl new file mode 100644 index 0000000..7011550 --- /dev/null +++ b/.aspell.en.prepl @@ -0,0 +1,5 @@ +personal_repl-1.1 en 0 +paramaters parameters +primage preimage +referece reference +continguous contiguous diff --git a/.aspell.en.pws b/.aspell.en.pws new file mode 100644 index 0000000..27a37de --- /dev/null +++ b/.aspell.en.pws @@ -0,0 +1,260 @@ +personal_ws-1.1 en 259 +secp +sig +unguessable +libsecp +TCP +DER +micropayments +nhops +retransmitted +dev +inflight +tradeoff +mixHeader +uint +hopsData +bitfield +B'th +decrypting +rhokey +rhoKey +buf +millisatoshis +yToX +funder's +IRATEMONK +wpkh +nextHmac +basepoint +streamKey +localkey +paymentPath +SPV +HopData +CSV +xFFFFFFFFFF +plaintext +EQUALVERIFY +AEAD +secretkey +TripleDH +addr +CHECKMULTISIG +decryptWithAD +routable +epk +scriptpubkey +mukey +muKey +sharedSecretSize +DUP +sharedSecrets +firewalled +xFFFFFFFFFFFF +revocationsecretkey +cryptographic +generateSharedSecret +instantiations +deterministically +deduplication +FIPS +responder +UTF +blockchain +nSequence +decrypt +flen +incrementing +feerate +affine +CHECKSEQUENCEVERIFY +nonces +iff +serializeCompressed +prepended +roasbeef +multisig +nodepk +remotesig +hopBlindingFactors +ECDH +addrlen +assocData +blockheight +ActOne +ammag +computeBlindingFactor +wsh +multiScalarMult +onionpacket +OnionPacket +ikm +fillerSize +txinput +init +reconnection +milli +revocationsig +irc +unroutable +NOTIF +txindex +generateHeaderPadding +IPv +ipv +satoshi +delayedsig +hopDataSize +I'th +segwit +htlc +ChaCha +len +ciphertext +endian +C'mon +NewOnionPacket +keypair +preimage +MiTM +mempool +cltv +localfeatures +iteratively +PrivateKey +br +millisatoshi +trustless +ee +eg +hopSize +retransmit +deobfuscating +onchain +BADONION +rightShift +protocolName +hopEphemeralPubKeys +txid +Fn +PublicKey +liveness +ie +shakin +txin +globalfeatures +calcMac +privkey +overpayment +hopSharedSecrets +TimeLocked +timelocked +lc +btcec +localsig +responder's +ripemd +md +ENDIF +blockchains +provisorial +cleartext +streamBytes +WISTFULTOLL +locktime +xFFF +localprivkey +deserialized +pubkey +PubKey +ok +Retransmissions +numHops +failuremsg +byteslen +shortid +se +rk +micropayment +rn +testbit +unparsable +sk +RoutingInfo +funder +Counterintuitively +basepoints +decrypts +sn +generateFiller +unrevoked +bytelen +ss +that'd +retransmitting +ack +deobfuscated +gflen +satoshis +instantiation +HeaderMAC +blindGroupElement +tx +pubkeys +CHECKLOCKTIMEVERIFY +generateCipherStream +XK +lflen +deobfuscates +generateKey +alice +revocationprivkey +PKH +remotekey +HKDF +ooo +repo +num +numStreamBytes +txout +HTLCs +htlcs +HTLC's +retransmission +decrypted +sessionKey +sessionkey +PRIVMSG +routingInfoSize +hostname +rgb +ciphertexts +CHECKSIG +pre +numMaxHops +HMACs +hmac +BIP +hmacSize +ratelimit +Poy +talkin +Freenode +revocationkey +ctlv +msat +func +unencrypted +coinbase +priv +sha +TODO +ChaChaPoly +delayedkey +Diffie +IETF +xFFFFFFFFFFF +FIXME +whitespace +EphemeralKey diff --git a/01-messaging.md b/01-messaging.md index b260a41..96f503c 100644 --- a/01-messaging.md +++ b/01-messaging.md @@ -4,7 +4,7 @@ This protocol assumes an underlying authenticated and ordered transport mechanism that takes care of framing individual messages. [BOLT #8](08-transport.md) specifies the canonical transport layer used in Lightning, though it can be replaced by any transport that fulfills the above guarantees. -The default TCP port is 9735. This corresponds to hexadecimal `0x2607`, the unicode code point for LIGHTNING.[1](#reference-1) +The default TCP port is 9735. This corresponds to hexadecimal `0x2607`, the Unicode code point for LIGHTNING.[1](#reference-1) All data fields are big-endian unless otherwise specified. @@ -143,7 +143,7 @@ or if `channel-id` is zero, it MUST fail all channels and MUST close the connect `len` to the remainder of the packet if it is larger. A receiving node SHOULD only print out `data` verbatim if the string is composed solely of printable ASCII characters. -For referece, the printable character set includes byte values 32 through 127 inclusive. +For reference, the printable character set includes byte values 32 through 127 inclusive. #### Rationale @@ -161,7 +161,7 @@ it leak information, thus the optional data field. In order to allow for the existence of very long-lived TCP connections, at times it may be required that both ends keep alive the TCP connection at the -application level. Such messages also allow obsfusation of traffic patterns. +application level. Such messages also allow obfuscation of traffic patterns. 1. type: 18 (`ping`) 2. data: diff --git a/02-peer-protocol.md b/02-peer-protocol.md index 810ecce..5a403be 100644 --- a/02-peer-protocol.md +++ b/02-peer-protocol.md @@ -173,7 +173,7 @@ The *channel reserve* is specified by the peer's `channel-reserve-satoshis`; 1% The sender can unconditionally give initial funds to the receiver using a non-zero `push-msat`, and this is one case where the normal reserve mechanism doesn't apply. However, like any other on-chain transaction, this payment is not certain until the funding transaction has been confirmed sufficiently (may be double-spent) and may require a separate method to prove payment via on-chain confirmation. -The `feerate-per-kw` is generally only a concern to the sender (who pays the fees), but that is also the feerate paid by HTLC transactions; thus unresonably large fee rates can also penalize the reciepient. +The `feerate-per-kw` is generally only a concern to the sender (who pays the fees), but that is also the feerate paid by HTLC transactions; thus unreasonably large fee rates can also penalize the recipient. #### Future @@ -882,7 +882,7 @@ retransmit any channel messages which may not have been. This is fairly straightforward in the case of channel establishment and close where messages have an explicit order, but in normal -operation acknowlegements of updates are delayed until the +operation acknowledgements of updates are delayed until the `commitment_signed` / `revoke_and_ack` exchange, so we cannot assume the updates have been received. This also means that the receiving node only needs to store updates upon receipt of `commitment_signed`. diff --git a/03-transactions.md b/03-transactions.md index d2afc03..cdca943 100644 --- a/03-transactions.md +++ b/03-transactions.md @@ -358,11 +358,11 @@ Each commitment transaction uses a unique set of keys; `localkey` and `remotekey Keys change because of the desire for trustless outsourcing of watching for revoked transactions; a _watcher_ should not be able to determine what the contents of commitment transaction is, even if -given the transaction ID to watch for and can make a resonable guess +given the transaction ID to watch for and can make a reasonable guess as to what HTLCs and balances might be included. Nonetheless, to avoid storage for every commitment transaction, it can be given the `per-commitment-secret` values (which can be stored compactly) and the -`revocation-basepoint` and `delayed-payment-basepoint` to regnerate +`revocation-basepoint` and `delayed-payment-basepoint` to regenerate the scripts required for the penalty transaction: it need only be given (and store) the signatures for each penalty input. diff --git a/04-onion-routing.md b/04-onion-routing.md index 48166de..bd0ddd5 100644 --- a/04-onion-routing.md +++ b/04-onion-routing.md @@ -77,7 +77,7 @@ The packet consists of 4 parts: as they forward the message. - A 32-byte `HMAC` used to verify the packet's integrity. -The overall structure of the packet is depicted below. The network format of the packet consists of the individual parts being serialized into one continguous byte-stream and then transferred to the recipient of the packet. Due to the fixed size of the packet it does not need to be prefixed by its length when transferred over a connection. +The overall structure of the packet is depicted below. The network format of the packet consists of the individual parts being serialized into one contiguous byte-stream and then transferred to the recipient of the packet. Due to the fixed size of the packet it does not need to be prefixed by its length when transferred over a connection. ~~~~ +------------------+-----------------------+------------------------+-----------------+ @@ -130,11 +130,11 @@ Field Description: processing an incoming Sphinx packet along with the HTLC message it's encapsulated within, if the following inequality doesn't hold, then the HTLC should be rejected as it indicates a prior node in the path has - deviated from the specified paramters: + deviated from the specified parameters: incoming_htlc_amt - fee >= amt_to_forward - Where `fee` is calculated according to the receving node's advertised fee + Where `fee` is calculated according to the receiving node's advertised fee schema as described in [BOLT 7](https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#htlc-fees), or 0 if this node is the final hop. @@ -144,7 +144,7 @@ Field Description: cltv-expiry - cltv-expiry-delta = outgoing_cltv_value Inclusion of this field allows a node to both authenticate the information - specified by the original sender and the paramaters of the HTLC forwarded, + specified by the original sender and the parameters of the HTLC forwarded, and ensure the original sender is using the current `cltv-expiry-delta` value. If there is no next hop, `cltv-expiry-delta` is zero. If the values don't correspond, then the HTLC should be failed+rejected as @@ -322,7 +322,7 @@ The sessionkey is a 32 byte EC private key. The shared secret creation receives a public key and a 32 byte secret as input and returns a 32 byte secret as output. In the packet generation phase the secret is the `sessionkey` and the public key is the node's public key, blinded with all previous blinding factors. -In the pocessing phase the secret is the node's private key and the public key is the ephemeral public key from the packet, which has been incrementally blinded by the predecessors. +In the processing phase the secret is the node's private key and the public key is the ephemeral public key from the packet, which has been incrementally blinded by the predecessors. The public key is multiplied by the secret, using to the `secp256k1` curve. The DER compressed representation of the multiplication result is serialized and hashed using `SHA256`. @@ -713,27 +713,27 @@ We use the same parameters (node ids, shared secrets ,...) as above payload = 00022002007e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 um_key = 4da7f2923edce6c2d85987d1d9fa6d88023e6c3a9c3d20f07d3b10b61a78d646 raw_error_packet = 807890139cc04c1fdea98b22ebda0a831d1beebe00022002007e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 - # forwaring error packet + # forwarding error packet shared_secret = b5756b9b542727dbafc6765a49488b023a725d631af688fc031217e90770c328 ammag_key = 2f36bb8822e1f0d04c27b7d8bb7d7dd586e032a3218b8d414afbba6f169a4d68 stream = e9c975b07c9a374ba64fd9be3aae955e917d34d1fa33f2e90f53bbf4394713c6a8c9b16ab5f12fd45edd73c1b0c8b33002df376801ff58aaa94000bf8a86f92620f343baef38a580102395ae3abf9128d1047a0736ff9b83d456740ebbb4aeb3aa9737f18fb4afb4aa074fb26c4d702f42968888550a3bded8c05247e045b866baef0499f079fdaeef6538f31d44deafffdfd3afa2fb4ca9 error packet for node 4: 69b1e5a3e05a7b5478e6529cd1749fdd8c66da6ffa31d2eb0f2dbbf4394713c6a8c9b16ab5f12fd45edd73c1b0c8b33002df376801ff58aaa94000bf8a86f92620f343baef38a580102395ae3abf9128d1047a0736ff9b83d456740ebbb4aeb3aa9737f18fb4afb4aa074fb26c4d702f42968888550a3bded8c05247e045b866baef0499f079fdaeef6538f31d44deafffdfd3afa2fb4ca9 - # forwaring error packet + # forwarding error packet shared_secret = 21e13c2d7cfe7e18836df50872466117a295783ab8aab0e7ecc8c725503ad02d ammag_key = cd9ac0e09064f039fa43a31dea05f5fe5f6443d40a98be4071af4a9d704be5ad stream = 617ca1e4624bc3f04fece3aa5a2b615110f421ec62408d16c48ea6c1b7c33fe7084a2bd9d4652fc5068e5052bf6d0acae2176018a3d8c75f37842712913900263cff92f39f3c18aa1f4b20a93e70fc429af7b2b1967ca81a761d40582daf0eb49cef66e3d6fbca0218d3022d32e994b41c884a27c28685ef1eb14603ea80a204b2f2f474b6ad5e71c6389843e3611ebeafc62390b717ca53 error packet for node 3: 08cd44478211b8a4370ab1368b5ffe8c9c92fb8398715ffdcba31d358e842c21a0839ab361940011585323930fa5b9fae0c85770a2279ff59ec427ad1bbff9001c0cd1497004bd2a0f68b50704cf6d6a4bf3c8b6a0833399a24b3456961ba00736785112594f65b6b2d44d9f5ea4e49b5e1ec2af978cbe31c67114440ac51a62081df0ed46d4a3df295da0b0fe25c0115019f03f15ec86fa - # forwaring error packet + # forwarding error packet shared_secret = 3a6b412548762f0dbccce5c7ae7bb8147d1caf9b5471c34120b30bc9c04891cc ammag_key = 1bf08df8628d452141d56adfd1b25c1530d7921c23cecfc749ac03a9b694b0d3 stream = 6149f48b5a7e8f3d6f5d870b7a698e204cf64452aab4484ff1dee671fe63fd4b5f1b78ee2047dfa61e3d576b149bedaf83058f85f06a3172a3223ad6c4732d96b32955da7d2feb4140e58d86fc0f2eb5d9d1878e6f8a7f65ab9212030e8e915573ebbd7f35e1a430890be7e67c3fb4bbf2def662fa625421e7b411c29ebe81ec67b77355596b05cc155755664e59c16e21410aabe53e8040 # error packet for node 2: 6984b0ccd86f37995857363df13670acd064bfd132c517b23a7dfb4470e7d16aff98e25d41d3dfb7466e74f81b3e545563cdd8f5524dae873de61d7bdfccd496af2584930d2b566b4f8d3881f8c043df92224f38cf094cfc09d92655989531524593ec6d6caec1863bdfaa79229b5020acc034cd6deeea1021c50586947b9b8e6faa83b81fbfa6133c0af5d6b07c017f7158fa94f0d206ba - # forwaring error packet + # forwarding error packet shared_secret = a6519e98832a0b179f62123b3567c106db99ee37bef036e783263602f3488fae ammag_key = 59ee5867c5c151daa31e36ee42530f429c433836286e63744f2020b980302564 stream = 0f10c86f05968dd91188b998ee45dcddfbf89fe9a99aa6375c42ed5520a257e048456fe417c15219ce39d921555956ae2ff795177c63c819233f3bcb9b8b28e5ac6e33a3f9b87ca62dff43f4cc4a2755830a3b7e98c326b278e2bd31f4a9973ee99121c62873f5bfb2d159d3d48c5851e3b341f9f6634f51939188c3b9ff45feeb11160bb39ce3332168b8e744a92107db575ace7866e4b8 # error packet for node 1: 669478a3ddf9ba4049df8fa51f73ac712b9c20389b5fb185663f16115045868ab7dd8db956128dae8857add94e6702fb4c3a4de22e2e669e1ed926b04447fc73034bb730f4932acd62727b75348a648a1128744657ca6a4e713b9b646c3ca66cac02cdab44dd3439890ef3aaf61708714f7375349b8da541b2548d452d84de7084bb95b3ac2345201d624d31f4d52078aa0fa05a88b4e202 - # forwaring error packet + # forwarding error packet shared_secret = 53eb63ea8a3fec3b3cd433b85cd62a4b145e1dda09391b348c4e1cd36a03ea66 ammag_key = 3761ba4d3e726d8abb16cba5950ee976b84937b61b7ad09e741724d7dee12eb5 stream = 3699fd352a948a05f604763c0bca2968d5eaca2b0118602e52e59121f050936c8dd90c24df7dc8cf8f1665e39a6c75e9e2c0900ea245c9ed3b0008148e0ae18bbfaea0c711d67eade980c6f5452e91a06b070bbde68b5494a92575c114660fb53cf04bf686e67ffa4a0f5ae41a59a39a8515cb686db553d25e71e7a97cc2febcac55df2711b6209c502b2f8827b13d3ad2f491c45a0cafe7 diff --git a/05-onchain.md b/05-onchain.md index 179efcd..3b05a27 100644 --- a/05-onchain.md +++ b/05-onchain.md @@ -2,7 +2,7 @@ ## Abstract -Lightning allows for two parties (A and B) to make transactions off-chain, by both holding a cross-signed *commitment transaction*, which describes the current state of the channel (basically the current balance). This *commitment transaction* is updated everytime a new payment is made, and is spendable at all times. +Lightning allows for two parties (A and B) to make transactions off-chain, by both holding a cross-signed *commitment transaction*, which describes the current state of the channel (basically the current balance). This *commitment transaction* is updated every time a new payment is made, and is spendable at all times. There are three ways a channel can end: @@ -118,7 +118,7 @@ When node A sees its own *commitment transaction*: output is spent (as recommended), the output is *resolved* by the spending transaction, otherwise it is considered *resolved* by the *commitment transaction* itself. 2. _B's main output_: No action required, this output is considered *resolved* - by the *commitment transaction* utself. + by the *commitment transaction* itself. 3. _A's offered HTLCs_: See "On-chain HTLC Output Handling: Our Offers" below. 4. _B's offered HTLCs_: See "On-chain HTLC Output Handling: Their Offers" below. @@ -183,7 +183,7 @@ as described in "On-chain HTLC Transaction Handling". If the commitment transaction is theirs, the only way to spend the HTLC output using a payment preimage is for them to use the HTLC-success transaction. If the commitment transaction is ours, they -could create any transaction using the primage. +could create any transaction using the preimage. The payment preimage either serves to prove payment (if this node diff --git a/08-transport.md b/08-transport.md index 34ac81e..a1430fe 100644 --- a/08-transport.md +++ b/08-transport.md @@ -86,7 +86,7 @@ chosen as the hash function, `secp256k1` as the elliptic curve, and finally `ChaChaPoly-1305` as the `AEAD` construction. The composition of `ChaCha20` and `Poly1305` used MUST conform to `RFC 7539`[1](#reference-1). With this laid out, the official Noise protocol name for our variant is: -`Noise_XK_secp256k1_ChaChaPoly_SHA256`. The ascii string representation of +`Noise_XK_secp256k1_ChaChaPoly_SHA256`. The ASCII string representation of this value is hashed into a digest used to initialize the starting handshake state. If the protocol names of two endpoints differ, then the handshake process fails immediately. @@ -126,7 +126,7 @@ The following functions will also be referenced: * `ECDH(rk, k)`: Performs an Elliptic-Curve Diffie-Hellman operation using `rk` which is a `secp256k1` public key and `k` which is a valid private key - within the finite field as defined by the curve paramters. + within the finite field as defined by the curve parameters. * The returned value is the SHA256 of the DER compressed format of the generated point. @@ -166,13 +166,13 @@ state as follows: 1. `h = SHA-256(protocolName)` * where `protocolName = "Noise_XK_secp256k1_ChaChaPoly_SHA256"` encoded as - an ascii string. + an ASCII string. 2. `ck = h` 3. `h = SHA-256(h || prologue)` - * where `prologue` is the ascii string: `lightning`. + * where `prologue` is the ASCII string: `lightning`. As a concluding step, both sides mix the responder's public key into the diff --git a/tools/spellcheck.sh b/tools/spellcheck.sh new file mode 100755 index 0000000..63dbaba --- /dev/null +++ b/tools/spellcheck.sh @@ -0,0 +1,45 @@ +#!/bin/sh +# spellcheck.sh +# by ZmnSCPxj +# Simple script to spellcheck files. +# +# ZmnSCPxj puts this script into the public domain. + +# Check if dirname works. +if (test_dir=`dirname -- /` && test "X"$test_dir = "X/") +then + my_dirname=dirname +else + my_dirname=false +fi + +# Find the path to this script. +# We assume sed works on most systems, since it's very old. +my_dir=`$my_dirname -- "$0" || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# This script should be in the tools/ directory of the +# repository. +homedir="$my_dir"/.. + +for f +do + aspell --home-dir ${homedir} -c $f +done -- 2.11.0 -------------- next part -------------- An HTML attachment was scrubbed... URL: