Skip to content

Commit 475f736

Browse files
authored
Merge pull request #3055 from TheBlueMatt/2024-05-123-backports-2
Final backports for 0.0.123
2 parents 95acb42 + a366d53 commit 475f736

File tree

14 files changed

+218
-32
lines changed

14 files changed

+218
-32
lines changed

CHANGELOG.md

+159
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,160 @@
1+
# 0.0.123 - May 08, 2024 - "BOLT12 Dust Sweeping"
2+
3+
## API Updates
4+
5+
* To reduce risk of force-closures and improve HTLC reliability the default
6+
dust exposure limit has been increased to
7+
`MaxDustHTLCExposure::FeeRateMultiplier(10_000)`. Users with existing
8+
channels might want to consider using
9+
`ChannelManager::update_channel_config` to apply the new default (#3045).
10+
* `ChainMonitor::archive_fully_resolved_channel_monitors` is now provided to
11+
remove from memory `ChannelMonitor`s that have been fully resolved on-chain
12+
and are now not needed. It uses the new `Persist::archive_persisted_channel`
13+
to inform the storage layer that such a monitor should be archived (#2964).
14+
* An `OutputSweeper` is now provided which will automatically sweep
15+
`SpendableOutputDescriptor`s, retrying until the sweep confirms (#2825).
16+
* After initiating an outbound channel, a peer disconnection no longer results
17+
in immediate channel closure. Rather, if the peer is reconnected before the
18+
channel times out LDK will automatically retry opening it (#2725).
19+
* `PaymentPurpose` now has separate variants for BOLT12 payments, which
20+
include fields from the `invoice_request` as well as the `OfferId` (#2970).
21+
* `ChannelDetails` now includes a list of in-flight HTLCs (#2442).
22+
* `Event::PaymentForwarded` now includes `skimmed_fee_msat` (#2858).
23+
* The `hashbrown` dependency has been upgraded and the use of `ahash` as the
24+
no-std hash table hash function has been removed. As a consequence, LDK's
25+
`Hash{Map,Set}`s no longer feature several constructors when LDK is built
26+
with no-std; see the `util::hash_tables` module instead. On platforms that
27+
`getrandom` supports, setting the `possiblyrandom/getrandom` feature flag
28+
will ensure hash tables are resistant to HashDoS attacks, though the
29+
`possiblyrandom` crate should detect most common platforms (#2810, #2891).
30+
* `ChannelMonitor`-originated requests to the `ChannelSigner` can now fail and
31+
be retried using `ChannelMonitor::signer_unblocked` (#2816).
32+
* `SpendableOutputDescriptor::to_psbt_input` now includes the `witness_script`
33+
where available as well as new proprietary data which can be used to
34+
re-derive some spending keys from the base key (#2761, #3004).
35+
* `OutPoint::to_channel_id` has been removed in favor of
36+
`ChannelId::v1_from_funding_outpoint` in preparation for v2 channels with a
37+
different `ChannelId` derivation scheme (#2797).
38+
* `PeerManager::get_peer_node_ids` has been replaced with `list_peers` and
39+
`peer_by_node_id`, which provide more details (#2905).
40+
* `Bolt11Invoice::get_payee_pub_key` is now provided (#2909).
41+
* `Default[Message]Router` now take an `entropy_source` argument (#2847).
42+
* `ClosureReason::HTLCsTimedOut` has been separated out from
43+
`ClosureReason::HolderForceClosed` as it is the most common case (#2887).
44+
* `ClosureReason::CooperativeClosure` is now split into
45+
`{Counterparty,Locally}Initiated` variants (#2863).
46+
* `Event::ChannelPending::channel_type` is now provided (#2872).
47+
* `PaymentForwarded::{prev,next}_user_channel_id` are now provided (#2924).
48+
* Channel init messages have been refactored towards V2 channels (#2871).
49+
* `BumpTransactionEvent` now contains the channel and counterparty (#2873).
50+
* `util::scid_utils` is now public, with some trivial utilities to examine
51+
short channel ids (#2694).
52+
* `DirectedChannelInfo::{source,target}` are now public (#2870).
53+
* Bounds in `lightning-background-processor` were simplified by using
54+
`AChannelManager` (#2963).
55+
* The `Persist` impl for `KVStore` no longer requires `Sized`, allowing for
56+
the use of `dyn KVStore` as `Persist` (#2883, #2976).
57+
* `From<PaymentPreimage>` is now implemented for `PaymentHash` (#2918).
58+
* `NodeId::from_slice` is now provided (#2942).
59+
* `ChannelManager` deserialization may now fail with `DangerousValue` when
60+
LDK's persistence API was violated (#2974).
61+
62+
## Bug Fixes
63+
* Excess fees on counterparty commitment transactions are now included in the
64+
dust exposure calculation. This lines behavior up with some cases where
65+
transaction fees can be burnt, making them effectively dust exposure (#3045).
66+
* `Future`s used as an `std::...::Future` could grow in size unbounded if it
67+
was never woken. For those not using async persistence and using the async
68+
`lightning-background-processor`, this could cause a memory leak in the
69+
`ChainMonitor` (#2894).
70+
* Inbound channel requests that fail in
71+
`ChannelManager::accept_inbound_channel` would previously have stalled from
72+
the peer's perspective as no `error` message was sent (#2953).
73+
* Blinded path construction has been tuned to select paths more likely to
74+
succeed, improving BOLT12 payment reliability (#2911, #2912).
75+
* After a reorg, `lightning-transaction-sync` could have failed to follow a
76+
transaction that LDK needed information about (#2946).
77+
* `RecipientOnionFields`' `custom_tlvs` are now propagated to recipients when
78+
paying with blinded paths (#2975).
79+
* `Event::ChannelClosed` is now properly generated and peers are properly
80+
notified for all channels that as a part of a batch channel open fail to be
81+
funded (#3029).
82+
* In cases where user event processing is substantially delayed such that we
83+
complete multiple round-trips with our peers before a `PaymentSent` event is
84+
handled and then restart without persisting the `ChannelManager` after having
85+
persisted a `ChannelMonitor[Update]`, on startup we may have `Err`d trying to
86+
deserialize the `ChannelManager` (#3021).
87+
* If a peer has relatively high latency, `PeerManager` may have failed to
88+
establish a connection (#2993).
89+
* `ChannelUpdate` messages broadcasted for our own channel closures are now
90+
slightly more robust (#2731).
91+
* Deserializing malformed BOLT11 invoices may have resulted in an integer
92+
overflow panic in debug builds (#3032).
93+
* In exceedingly rare cases (no cases of this are known), LDK may have created
94+
an invalid serialization for a `ChannelManager` (#2998).
95+
* Message processing latency handling BOLT12 payments has been reduced (#2881).
96+
* Latency in processing `Event::SpendableOutputs` may be reduced (#3033).
97+
98+
## Node Compatibility
99+
* LDK's blinded paths were inconsistent with other implementations in several
100+
ways, which have been addressed (#2856, #2936, #2945).
101+
* LDK's messaging blinded paths now support the latest features which some
102+
nodes may begin relying on soon (#2961).
103+
* LDK's BOLT12 structs have been updated to support some last-minute changes to
104+
the spec (#3017, #3018).
105+
* CLN v24.02 requires the `gossip_queries` feature for all peers, however LDK
106+
by default does not set it for those not using a `P2PGossipSync` (e.g. those
107+
using RGS). This change was reverted in CLN v24.02.2 however for now LDK
108+
always sets the `gossip_queries` feature. This change is expected to be
109+
reverted in a future LDK release (#2959).
110+
111+
## Security
112+
0.0.123 fixes a denial-of-service vulnerability which we believe to be reachable
113+
from untrusted input when parsing invalid BOLT11 invoices containing non-ASCII
114+
characters.
115+
* BOLT11 invoices with non-ASCII characters in the human-readable-part may
116+
cause an out-of-bounds read attempt leading to a panic (#3054). Note that all
117+
BOLT11 invoices containing non-ASCII characters are invalid.
118+
119+
In total, this release features 150 files changed, 19307 insertions, 6306
120+
deletions in 360 commits since 0.0.121 from 17 authors, in alphabetical order:
121+
122+
* Arik Sosman
123+
* Duncan Dean
124+
* Elias Rohrer
125+
* Evan Feenstra
126+
* Jeffrey Czyz
127+
* Keyue Bao
128+
* Matt Corallo
129+
* Orbital
130+
* Sergi Delgado Segura
131+
* Valentine Wallace
132+
* Willem Van Lint
133+
* Wilmer Paulino
134+
* benthecarman
135+
* jbesraa
136+
* olegkubrakov
137+
* optout
138+
* shaavan
139+
140+
141+
# 0.0.122 - Apr 09, 2024 - "That Which Is Untested Is Broken"
142+
143+
## Bug Fixes
144+
* `Route` objects did not successfully round-trip through de/serialization
145+
since LDK 0.0.117, which has now been fixed (#2897).
146+
* Correct deserialization of unknown future enum variants. This ensures
147+
downgrades from future versions of LDK do not result in read failures or
148+
corrupt reads in cases where enums are written (#2969).
149+
* When hitting lnd bug 6039, our workaround previously resulted in
150+
`ChannelManager` persistences on every round-trip with our peer. These
151+
useless persistences are now skipped (#2937).
152+
153+
In total, this release features 4 files changed, 99 insertions, 55
154+
deletions in 6 commits from 1 author, in alphabetical order:
155+
* Matt Corallo
156+
157+
1158
# 0.0.121 - Jan 22, 2024 - "Unwraps are Bad"
2159

3160
## Bug Fixes
@@ -17,6 +174,7 @@ deletions in 4 commits from 2 authors, in alphabetical order:
17174
* Jeffrey Czyz
18175
* Matt Corallo
19176

177+
20178
# 0.0.120 - Jan 17, 2024 - "Unblinded Fuzzers"
21179

22180
## API Updates
@@ -65,6 +223,7 @@ deletions in 79 commits from 9 authors, in alphabetical order:
65223
* optout
66224
* shuoer86
67225

226+
68227
# 0.0.119 - Dec 15, 2023 - "Spring Cleaning for Christmas"
69228

70229
## API Updates

fuzz/src/full_stack.rs

+19
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,8 @@ mod tests {
971971

972972
// create the funding transaction (client should send funding_created now)
973973
ext_from_hex("0a", &mut test);
974+
// Two feerate requests to check the dust exposure on the initial commitment tx
975+
ext_from_hex("00fd00fd", &mut test);
974976

975977
// inbound read from peer id 1 of len 18
976978
ext_from_hex("030112", &mut test);
@@ -1019,6 +1021,9 @@ mod tests {
10191021
// end of update_add_htlc from 0 to 1 via client and mac
10201022
ext_from_hex("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ab00000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test);
10211023

1024+
// Two feerate requests to check dust exposure
1025+
ext_from_hex("00fd00fd", &mut test);
1026+
10221027
// inbound read from peer id 0 of len 18
10231028
ext_from_hex("030012", &mut test);
10241029
// message header indicating message length 100
@@ -1040,6 +1045,8 @@ mod tests {
10401045

10411046
// process the now-pending HTLC forward
10421047
ext_from_hex("07", &mut test);
1048+
// Two feerate requests to check dust exposure
1049+
ext_from_hex("00fd00fd", &mut test);
10431050
// client now sends id 1 update_add_htlc and commitment_signed (CHECK 7: UpdateHTLCs event for node 03020000 with 1 HTLCs for channel 3f000000)
10441051

10451052
// we respond with commitment_signed then revoke_and_ack (a weird, but valid, order)
@@ -1115,6 +1122,9 @@ mod tests {
11151122
// end of update_add_htlc from 0 to 1 via client and mac
11161123
ext_from_hex("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ab00000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test);
11171124

1125+
// Two feerate requests to check dust exposure
1126+
ext_from_hex("00fd00fd", &mut test);
1127+
11181128
// now respond to the update_fulfill_htlc+commitment_signed messages the client sent to peer 0
11191129
// inbound read from peer id 0 of len 18
11201130
ext_from_hex("030012", &mut test);
@@ -1146,6 +1156,10 @@ mod tests {
11461156

11471157
// process the now-pending HTLC forward
11481158
ext_from_hex("07", &mut test);
1159+
1160+
// Two feerate requests to check dust exposure
1161+
ext_from_hex("00fd00fd", &mut test);
1162+
11491163
// client now sends id 1 update_add_htlc and commitment_signed (CHECK 7 duplicate)
11501164
// we respond with revoke_and_ack, then commitment_signed, then update_fail_htlc
11511165

@@ -1243,6 +1257,9 @@ mod tests {
12431257
// end of update_add_htlc from 0 to 1 via client and mac
12441258
ext_from_hex("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 5300000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test);
12451259

1260+
// Two feerate requests to check dust exposure
1261+
ext_from_hex("00fd00fd", &mut test);
1262+
12461263
// inbound read from peer id 0 of len 18
12471264
ext_from_hex("030012", &mut test);
12481265
// message header indicating message length 164
@@ -1264,6 +1281,8 @@ mod tests {
12641281

12651282
// process the now-pending HTLC forward
12661283
ext_from_hex("07", &mut test);
1284+
// Two feerate requests to check dust exposure
1285+
ext_from_hex("00fd00fd", &mut test);
12671286
// client now sends id 1 update_add_htlc and commitment_signed (CHECK 7 duplicate)
12681287

12691288
// connect a block with one transaction of len 125

lightning-background-processor/Cargo.toml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lightning-background-processor"
3-
version = "0.0.123-rc1"
3+
version = "0.0.123"
44
authors = ["Valentine Wallace <[email protected]>"]
55
license = "MIT OR Apache-2.0"
66
repository = "https://github.com/lightningdevkit/rust-lightning"
@@ -22,11 +22,11 @@ default = ["std"]
2222

2323
[dependencies]
2424
bitcoin = { version = "0.30.2", default-features = false }
25-
lightning = { version = "0.0.123-rc1", path = "../lightning", default-features = false }
26-
lightning-rapid-gossip-sync = { version = "0.0.123-rc1", path = "../lightning-rapid-gossip-sync", default-features = false }
25+
lightning = { version = "0.0.123", path = "../lightning", default-features = false }
26+
lightning-rapid-gossip-sync = { version = "0.0.123", path = "../lightning-rapid-gossip-sync", default-features = false }
2727

2828
[dev-dependencies]
2929
tokio = { version = "1.35", features = [ "macros", "rt", "rt-multi-thread", "sync", "time" ] }
30-
lightning = { version = "0.0.123-rc1", path = "../lightning", features = ["_test_utils"] }
31-
lightning-invoice = { version = "0.31.0-rc1", path = "../lightning-invoice" }
32-
lightning-persister = { version = "0.0.123-rc1", path = "../lightning-persister" }
30+
lightning = { version = "0.0.123", path = "../lightning", features = ["_test_utils"] }
31+
lightning-invoice = { version = "0.31.0", path = "../lightning-invoice" }
32+
lightning-persister = { version = "0.0.123", path = "../lightning-persister" }

lightning-block-sync/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lightning-block-sync"
3-
version = "0.0.123-rc1"
3+
version = "0.0.123"
44
authors = ["Jeffrey Czyz", "Matt Corallo"]
55
license = "MIT OR Apache-2.0"
66
repository = "https://github.com/lightningdevkit/rust-lightning"
@@ -20,11 +20,11 @@ rpc-client = [ "serde_json", "chunked_transfer" ]
2020
[dependencies]
2121
bitcoin = "0.30.2"
2222
hex = { package = "hex-conservative", version = "0.1.1", default-features = false }
23-
lightning = { version = "0.0.123-rc1", path = "../lightning" }
23+
lightning = { version = "0.0.123", path = "../lightning" }
2424
tokio = { version = "1.35", features = [ "io-util", "net", "time", "rt" ], optional = true }
2525
serde_json = { version = "1.0", optional = true }
2626
chunked_transfer = { version = "1.4", optional = true }
2727

2828
[dev-dependencies]
29-
lightning = { version = "0.0.123-rc1", path = "../lightning", features = ["_test_utils"] }
29+
lightning = { version = "0.0.123", path = "../lightning", features = ["_test_utils"] }
3030
tokio = { version = "1.35", features = [ "macros", "rt" ] }

lightning-custom-message/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lightning-custom-message"
3-
version = "0.0.123-rc1"
3+
version = "0.0.123"
44
authors = ["Jeffrey Czyz"]
55
license = "MIT OR Apache-2.0"
66
repository = "https://github.com/lightningdevkit/rust-lightning"
@@ -15,4 +15,4 @@ rustdoc-args = ["--cfg", "docsrs"]
1515

1616
[dependencies]
1717
bitcoin = "0.30.2"
18-
lightning = { version = "0.0.123-rc1", path = "../lightning" }
18+
lightning = { version = "0.0.123", path = "../lightning" }

lightning-invoice/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "lightning-invoice"
33
description = "Data structures to parse and serialize BOLT11 lightning invoices"
4-
version = "0.31.0-rc1"
4+
version = "0.31.0"
55
authors = ["Sebastian Geisler <[email protected]>"]
66
documentation = "https://docs.rs/lightning-invoice/"
77
license = "MIT OR Apache-2.0"
@@ -21,13 +21,13 @@ std = ["bitcoin/std", "lightning/std", "bech32/std"]
2121

2222
[dependencies]
2323
bech32 = { version = "0.9.0", default-features = false }
24-
lightning = { version = "0.0.123-rc1", path = "../lightning", default-features = false }
24+
lightning = { version = "0.0.123", path = "../lightning", default-features = false }
2525
secp256k1 = { version = "0.27.0", default-features = false, features = ["recovery", "alloc"] }
2626
serde = { version = "1.0.118", optional = true }
2727
bitcoin = { version = "0.30.2", default-features = false }
2828

2929
[dev-dependencies]
30-
lightning = { version = "0.0.123-rc1", path = "../lightning", default-features = false, features = ["_test_utils"] }
30+
lightning = { version = "0.0.123", path = "../lightning", default-features = false, features = ["_test_utils"] }
3131
hex = { package = "hex-conservative", version = "0.1.1", default-features = false }
3232
serde_json = { version = "1"}
3333
hashbrown = { version = "0.13", default-features = false }

lightning-invoice/src/de.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ mod hrp_sm {
4343
}
4444

4545
impl States {
46-
fn next_state(&self, read_symbol: char) -> Result<States, super::Bolt11ParseError> {
46+
fn next_state(&self, read_byte: u8) -> Result<States, super::Bolt11ParseError> {
47+
let read_symbol = match char::from_u32(read_byte.into()) {
48+
Some(symb) if symb.is_ascii() => symb,
49+
_ => return Err(super::Bolt11ParseError::MalformedHRP),
50+
};
4751
match *self {
4852
States::Start => {
4953
if read_symbol == 'l' {
@@ -119,7 +123,7 @@ mod hrp_sm {
119123
*range = Some(new_range);
120124
}
121125

122-
fn step(&mut self, c: char) -> Result<(), super::Bolt11ParseError> {
126+
fn step(&mut self, c: u8) -> Result<(), super::Bolt11ParseError> {
123127
let next_state = self.state.next_state(c)?;
124128
match next_state {
125129
States::ParseCurrencyPrefix => {
@@ -158,7 +162,7 @@ mod hrp_sm {
158162

159163
pub fn parse_hrp(input: &str) -> Result<(&str, &str, &str), super::Bolt11ParseError> {
160164
let mut sm = StateMachine::new();
161-
for c in input.chars() {
165+
for c in input.bytes() {
162166
sm.step(c)?;
163167
}
164168

lightning-net-tokio/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lightning-net-tokio"
3-
version = "0.0.123-rc1"
3+
version = "0.0.123"
44
authors = ["Matt Corallo"]
55
license = "MIT OR Apache-2.0"
66
repository = "https://github.com/lightningdevkit/rust-lightning/"
@@ -16,9 +16,9 @@ rustdoc-args = ["--cfg", "docsrs"]
1616

1717
[dependencies]
1818
bitcoin = "0.30.2"
19-
lightning = { version = "0.0.123-rc1", path = "../lightning" }
19+
lightning = { version = "0.0.123", path = "../lightning" }
2020
tokio = { version = "1.35", features = [ "rt", "sync", "net", "time" ] }
2121

2222
[dev-dependencies]
2323
tokio = { version = "1.35", features = [ "macros", "rt", "rt-multi-thread", "sync", "net", "time" ] }
24-
lightning = { version = "0.0.123-rc1", path = "../lightning", features = ["_test_utils"] }
24+
lightning = { version = "0.0.123", path = "../lightning", features = ["_test_utils"] }

0 commit comments

Comments
 (0)