Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cut 0.0.122 with just #2969, #2897, and #2937 #2985

Conversation

TheBlueMatt
Copy link
Collaborator

This is just the three commits form #2969 backported to 0.0.121 with a CHANGELOG entry for 0.0.122.

As discussed in #2969 I think we should ship this as a standalone 0.0.122 and then do 0.0.123 with all the various additional things since 0.0.121.

`impl_writeable_tlv_based_enum_upgradable` professed to supporting
upgrades by returning `None` from `MaybeReadable` when unknown
variants written by newer versions of LDK were read. However, it
generally didn't support this as it didn't discard bytes for
unknown types, resulting in corrupt reading.

This is fixed here for enum variants written as a TLV stream,
however we don't have a length prefix for tuple enum variants, so
the documentation on the macro is updated to mention that
downgrades are not supported for tuple variants.
If we are reading an object that is `MaybeReadable` in a TLV stream
using `upgradable_required`, it may return early with `Ok(None)`.
In this case, it will not read any further TLVs from the TLV
stream. This is fine, except that we generally expect
`MaybeReadable` always consume the correct number of bytes for the
full object, even if it doesn't understand it.

This could pose a problem, for example, in cases where we're
reading a TLV-stream `MaybeReadable` object inside another
TLV-stream object. In that case, the `MaybeReadable` object may
return `Ok(None)` and not consume all the available bytes, causing
the outer TLV read to fail as the TLV length does not match.
Whils this is generally not supported, issues in our
`MaybeReadable` implementations may occur, and we should try to be
robust against them.
@TheBlueMatt TheBlueMatt added this to the 0.0.122 milestone Apr 8, 2024
@TheBlueMatt TheBlueMatt force-pushed the 2024-03-fix-upgradable-enum-121 branch from f04ff0c to 2983898 Compare April 8, 2024 16:18
@codecov-commenter
Copy link

codecov-commenter commented Apr 8, 2024

Codecov Report

Attention: Patch coverage is 73.46939% with 13 lines in your changes are missing coverage. Please review.

Project coverage is 89.00%. Comparing base (4bab9c8) to head (66ebe7e).

Files Patch % Lines
lightning/src/routing/router.rs 58.33% 2 Missing and 3 partials ⚠️
lightning/src/util/ser_macros.rs 0.00% 5 Missing ⚠️
lightning/src/ln/channelmanager.rs 90.62% 1 Missing and 2 partials ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##           0.0.122    #2985      +/-   ##
===========================================
+ Coverage    88.86%   89.00%   +0.13%     
===========================================
  Files          115      114       -1     
  Lines        92753    91225    -1528     
  Branches     92753    91225    -1528     
===========================================
- Hits         82429    81197    -1232     
+ Misses        7942     7904      -38     
+ Partials      2382     2124     -258     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tnull
Copy link
Contributor

tnull commented Apr 8, 2024

Maybe worth including the various CI fixes to assert it passes?

@TheBlueMatt
Copy link
Collaborator Author

Eh, only beta builds failed except for the one Windows build which is #2614 and has, sadly, been somewhat long-standing. I can kick the Windows build if it makes people feel better though.

@tnull
Copy link
Contributor

tnull commented Apr 9, 2024

Eh, only beta builds failed except for the one Windows build which is #2614 and has, sadly, been somewhat long-standing. I can kick the Windows build if it makes people feel better though.

Well, seems now even more failed, but for unrelated reasons. I guess we'll have 0.0.123 coming up anyways..

@TheBlueMatt
Copy link
Collaborator Author

Right there's also the ENOSPACE issue on 1.63 :/. In any case all the failures here are relatively harmless...

Copy link
Contributor

@tnull tnull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, only reviewed the changes on top of #2969 as it was previously approved and merged.

CHANGELOG.md Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
@TheBlueMatt TheBlueMatt force-pushed the 2024-03-fix-upgradable-enum-121 branch from 2983898 to ed7d7c1 Compare April 9, 2024 14:40
@TheBlueMatt
Copy link
Collaborator Author

Squash-pushed the sp fixup from @jkczyz

`Route`'s blinded_path serialization logic writes a blinded path
`Option` per path hop, however on read we (correctly) only read one
blinded path `Option` per path. This causes serialization of
`Route`s with blinded paths to fail to round-trip.

Here we fix this by writing blinded paths per path.
When the `max_total_routing_fee_msat` parameter was added to
`RouteParameters`, the serialization used `map` to get the max fee,
accidentally writing an `Option<Option<u64>>`, but then read it as
an `Option<u64>`. Thus, any `Route`s with a `route_params` written
will fail to be read back.

Luckily, this is an incredibly rarely-used bit of code, so only one
user managed to hit it.
When we hit lnd bug 6039, we end up sending error messages to peers
in a loop. This should be fine, but because we used the generic
`PersistenceNotifierGuard::notify_on_drop` lock above the specific
handling, we end up writing `ChannelManager` every time we manage a
round-trip to our peer.

This can add up quite quickly, and isn't actually changing, so we
really need to avoid writing the `ChannelManager` in this case.
@TheBlueMatt TheBlueMatt force-pushed the 2024-03-fix-upgradable-enum-121 branch from ed7d7c1 to 66ebe7e Compare April 9, 2024 15:06
@TheBlueMatt
Copy link
Collaborator Author

Ugh, realize that we'd already backported #2897 and #2937 in bindings and I don't want to deal with yet more bindings-specific backports, so I just slipped them in. Added changelogs for them as well.

@jkczyz
Copy link
Contributor

jkczyz commented Apr 9, 2024

Ugh, realize that we'd already backported #2897 and #2937 in bindings and I don't want to deal with yet more bindings-specific backports, so I just slipped them in. Added changelogs for them as well.

Please update PR description accordingly.

@TheBlueMatt TheBlueMatt changed the title Cut 0.0.122 with just #2969 Cut 0.0.122 with just #2969, #2897, and #2937 Apr 9, 2024
@TheBlueMatt
Copy link
Collaborator Author

Will wait for CI to make sure it at least only fails on the things it was already failing on, then will cut this!

@TheBlueMatt
Copy link
Collaborator Author

Okay, only beta and the 1.63 build failed, so gonna cut this.

@TheBlueMatt TheBlueMatt merged commit 27e5519 into lightningdevkit:0.0.122 Apr 9, 2024
11 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants