Commit Graph

13908 Commits

Author SHA1 Message Date
ShahanaFarooqui 91eb184141 lightningd/runes: Added last_time_check for validating rune for `per` restriction
Changelog-Added: runes: `per=Nsec/min/hour/msec/usec/nsec` for general ratelimiting
2023-09-21 13:31:34 +09:30
ShahanaFarooqui 3f95597a5e common: make json_add_timeabs full precision & renamed json_add_time
json_add_timeabs only printed in milliseconds and json_add_time outputs a string which is weird

Changelog-Changed: JSON-RPC time fields now have full nanosecond precision (i.e. 9 decimals not 3): `listfowards` `received_time` `resolved_time` `listpays`/`listsendpays` `created_at`.
2023-09-21 13:31:34 +09:30
ShahanaFarooqui d745323f74 lightning/runes: added last_used in showrunes
Changelog-Added: JSON-RPC: `showrunes` new field `last_used`
2023-09-21 13:31:34 +09:30
ShahanaFarooqui db55deae2a lightningd/runes: update last_used timestamp when a rune successfully used 2023-09-21 13:31:34 +09:30
ShahanaFarooqui eacf0b502c wallet: add last_used_nsec in runes table
We will use this for better rate limiting
2023-09-21 13:31:34 +09:30
Rusty Russell 4e39dc0c9b common: add test to check bolt12/offers-test.json test vectors.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-21 13:31:03 +09:30
Rusty Russell c8c6dd183d common/bolt12: roll all necessary checks into offer_decode.
Some of these were done by fetchinvoice (and it did some that
offer_decode already did).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-21 13:31:03 +09:30
Rusty Russell fea4eb8968 common: helper to generate bolt12 test vector bolt12/offers-test.json.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-21 13:31:03 +09:30
Rusty Russell 16e0d38fff bolt12-cli: add encode routine to make bolt12 vectors.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-21 13:31:03 +09:30
Rusty Russell 1663b8d5d7 wallet: re-run update-mocks.
Some functions have vanished in master, and it's confusing to
see this change when we run `make update-mocks` later in the
series.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-21 13:31:03 +09:30
ShahanaFarooqui 5ecf1abe5a docker: Deleting redundant arm64v8 and arm32v7 Dockerfiles
Changelog-None
2023-09-20 14:08:34 +09:30
ShahanaFarooqui 8906e22f52 script: Updated build-release script
- Removed tarball and deb targets
- Added `TARBALL_ARCH` for bitcoin, litecoin image downloads
2023-09-20 14:08:34 +09:30
ShahanaFarooqui ca96cffde8 script: Fixed bitcoin and litecoin archs used with buildx 2023-09-20 14:08:34 +09:30
Rusty Russell da498c55bc doc: update to BOLT 6e85df448bfee7d10f26aabb06b8eba3d7505888 "BOLT2: change "reject" to "fail" in channel opening requirements (#1104)"
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-20 13:56:46 +09:30
Rusty Russell 4dfbaa3ebe bolt11: update to BOLT 7dda8f84edb8655766d83619cb41110c1bf43f85 "Bolt11: min_final_cltv_expiry_delta is optional, not required (#1100)"
Since we changed the default, it used to be required to set it.  That was a while ago, though, so we can make it optional again.

Changelog-Changed: Protocol: `invoice` no longer explicitly encodes `c` if it's the default (18)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-20 13:56:46 +09:30
Rusty Russell 98d2dc2d4c wire: update to BOLT 17ceba42dc6607b637a713a9bc051f63c1357edd "BOLT 4: onion message support."
We don't need to patch it in anymore, now it's merged.  However, we do
move the message itself from onion_wire.csv to peer_wire.csv (we
should get more sophisticated with our parsing, but this works for
now!).

The resulting peer_wire.csv is identical, the onion_wire.csv file is
slightly reordered.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-20 13:56:46 +09:30
Rusty Russell b22202dccd doc: update to BOLT cded2df1fd0095c947af02a52e28b16c66bdfc5c "Fix undeclared reference in onion-routing"
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-20 13:56:46 +09:30
Rusty Russell 68a6084bab lightningd: update to BOLT 7d3ef5a6b20eb84982ea2bfc029497082adf20d8 "Allow unset `onion_hash` in `invalid_onion_blinding` (#1093)"
Explicitly allow all-zero in the onion_hash: we didn't do anything except log if it was unexpected anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-20 13:56:46 +09:30
Rusty Russell 6a2632d50b doc: update to BOLT 7f53a3e46ed59f19463447d5fa63b3e484c708a5 "BOLT 8: make it clear that there are *two* chaining keys."
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-20 13:56:46 +09:30
Rusty Russell 4413bfa6be wire: update to BOLT aad959a297ff66946effb165518143be15777dd6 "tools: remove option handling now last optional field was removed."
No effect on us, we didn't use this field anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-20 13:56:46 +09:30
Rusty Russell df80a2c056 doc: update to BOLT 3747ba83022cd385093df2696ed342f1e41e31b3 "Remove requirements to disconnect on warnings"
Now we don't do that anymore (at least, for sending) we can update bolt quotes to match.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-20 13:56:46 +09:30
Rusty Russell 468d3fd387 connectd: also don't disconnect on "all-channel" warnings.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-20 13:56:46 +09:30
Rusty Russell 48522f3e9e common: don't hang up when we receive a warning.
We were allowed to, but the spec removed that.  So we handle warnings
differently from errors now.

This also means the LND "internal error" workaround is done in
lightningd (we still disconnect, but we don't want to close channel).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: Protocol: we no longer disconnect every time we receive a warning message.
2023-09-20 13:56:46 +09:30
Rusty Russell 1bb83a1ae6 common: don't send channel_id on peer error.
It's unused: they know what channel it is.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-20 13:56:46 +09:30
Rusty Russell aca2aa9ae6 common: remove channel_id check.
connectd demuxes for us, so this can never trigger.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-20 13:56:46 +09:30
Rusty Russell 821d5f48ea doc: update to BOLT 50b2df24a27879e8329712c275db78876fd022fe "Update onion errors since we allow overpaying or under-CLTVing"
We already do this behaviour, we just didn't adjust comments.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-20 13:56:46 +09:30
Rusty Russell 0d70daa5ee doc: update to BOLT 29c14c6e12cbdf33f6b724094c81658a614d2e02 "fix typos"
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-20 13:56:46 +09:30
Rusty Russell cfca4e010f common: rename tlv_payload's "blinding_point" to "current_blinding_point" as per spec.
Simple rename in a few internal places.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-20 13:56:46 +09:30
Rusty Russell cc2c720dd9 wire: fix up messy patches (make extract-onion-csv)
These patches are no longer necessary now blinded payments were
merged into the spec.

However, the spec did rename "blinding_point" inside `payload` to
"current_blinding_point" so we temporarily add a patch to change it back.

You can see wire/onion_wire.csv is reordered, but unchanged.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-20 13:56:46 +09:30
Rusty Russell 232fba878e wire: fix up messy patches (make extract-peer-csv)
They didn't actually apply properly!

I regenerated the dual-funding CSV from the latest commit
(091397fc0798c4b2bdb36dbaa9f5b4b1d4a463e1) and made it a single patch.

I tried doing the same for splicing, but the implementation has drifted
far from the spec, so I simply opted for a patch which didn't change anything.

You can see the resulting "wire/peer_wire.csv" is the same, except fields
are now in a less-random order!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-20 13:56:46 +09:30
Chase Sillevis 9c95761740 docker: make available bitcoind binary 2023-09-19 14:34:25 +02:00
ShahanaFarooqui 1a18f610b2 docs: Update documents with `rest-csp` option
Changelog-Added: New configurable Content-Security-Policy (CSP) header for clnrest
2023-09-19 11:40:15 +09:30
ShahanaFarooqui 3108ff93b8 plugins/clnrest: Update content security policy for server 2023-09-19 11:40:15 +09:30
ShahanaFarooqui 51578e1f77 plugins/clnrest: Add `rest-csp` option for config 2023-09-19 11:40:15 +09:30
ShahanaFarooqui eca3a33e69 plugins/clnrest: Update Websocket server to dynamically add CORS settings
Changelog-Added: New configurable Cross-Origin-Resource-Sharing(CSP) header for clnrest
2023-09-19 11:40:15 +09:30
ShahanaFarooqui f0edc878e6 docs: Update documents with `rest-cors-origins` option 2023-09-19 11:40:15 +09:30
ShahanaFarooqui b0430cc897 plugins/clnrest: Update App server to dynamically add CORS settings 2023-09-19 11:40:15 +09:30
ShahanaFarooqui 632e7abd05 plugins/clnrest: Add `rest-cors-origins` option for config 2023-09-19 11:40:15 +09:30
ShahanaFarooqui 224a5dcbcf plugins/clnrest: Add CORS library 2023-09-19 11:40:15 +09:30
ShahanaFarooqui 450bf2be2b plugins/clnrest: Updated websocket client examples
- Updated javascript and python client examples with rune auth
- Added new html (browser based) client example with rune auth
2023-09-19 11:40:15 +09:30
ShahanaFarooqui 6aa697ea3d plugins/clnrest: Rune authentication for websocket server 2023-09-19 11:40:15 +09:30
ShahanaFarooqui 9147996372 plugins/clnrest: Generate all three certs if missing
Generate client, server and CA certs for https and trusted CA update
2023-09-19 11:40:15 +09:30
Mariusz Kogen 0952a09c2d Remove GMP from arm64v8 build 2023-09-19 10:26:36 +09:30
Mariusz Kogen a0c86b77c7 Remove deprecated GMP dependency 2023-09-19 10:26:36 +09:30
Adi Shankara 9357a32890 update the app dev interface img 2023-09-19 10:25:45 +09:30
Adi Shankara 43c39aa2c9 fix the rest api reference link 2023-09-19 10:25:45 +09:30
Adi Shankara 0cf2c29b5c fix paths for doc files and make them public 2023-09-19 10:25:45 +09:30
Rusty Russell 8be888e63f pytest: fix renepay test_shadow flake.
Sometimes we don't shadow because it would break our budget:

```
    def test_shadow(node_factory):
        '''Make sure we shadow correctly.'''
        l1, l2, l3 = node_factory.line_graph(3,
                                             wait_for_announce=True,
                                             opts=[{},
                                                   {'fee-base': 2000, 'fee-per-satoshi': 20, 'cltv-delta': 20},
                                                   {'fee-base': 3000, 'fee-per-satoshi': 30, 'cltv-delta': 30}])
    
        # Shadow doesn't always happen (50% chance)!
        for i in range(20):
            inv = l2.rpc.invoice(123000, f'test_renepay{i}', 'description')['bolt11']
            details = l1.rpc.call('renepay', {'invstring': inv})
            assert details['status'] == 'complete'
            assert details['amount_msat'] == Millisatoshi(123000)
            assert details['destination'] == l2.info['id']
    
>           line = l1.daemon.wait_for_log("No MPP, so added .*msat shadow fee")

tests/test_renepay.py:51:
```

```
lightningd-1 2023-09-12T05:08:39.699Z UNUSUAL plugin-cln-renepay: No shadow fee for flow 0/1: fee would add 5005msat to 123000msat, exceeding budget 128000msat.
```

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2023-09-19 10:20:24 +09:30
Matt Morehouse 8596208f52 fuzz: initial wire message seeds
Seeds for every peer wire message, generated from fuzzing with
-max_len=65533 and minimizing the resulting corpora.
2023-09-18 13:58:45 +09:30
Matt Morehouse 42fb17fe58 fuzz: target for your_peer_storage
Fuzz the decoding and encoding of your_peer_storage.
2023-09-18 13:58:45 +09:30