Skip to content

bitcoin 0.32 upgrade followups #3249

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

Merged

Conversation

TheBlueMatt
Copy link
Collaborator

@TheBlueMatt TheBlueMatt commented Aug 16, 2024

Mostly feature list cleanups now that we can, but also tiny tweaks to BufReader.

Fixes #3097

@TheBlueMatt TheBlueMatt added this to the 0.0.124 milestone Aug 16, 2024
@TheBlueMatt TheBlueMatt force-pushed the 2024-08-feature-cleanup-1 branch from 4b8dd7d to ff558f6 Compare August 16, 2024 22:04
Copy link

codecov bot commented Aug 16, 2024

Codecov Report

Attention: Patch coverage is 26.66667% with 11 lines in your changes missing coverage. Please review.

Project coverage is 89.72%. Comparing base (dd37077) to head (8049f99).
Report is 13 commits behind head on main.

Files Patch % Lines
lightning/src/util/ser.rs 15.38% 8 Missing and 3 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3249   +/-   ##
=======================================
  Coverage   89.72%   89.72%           
=======================================
  Files         124      124           
  Lines      102386   102352   -34     
  Branches   102386   102352   -34     
=======================================
- Hits        91867    91840   -27     
+ Misses       7819     7816    -3     
+ Partials     2700     2696    -4     

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

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.

Mostly looks good to me, just a few questions.

I'm honestly not entirely sure about the patch changes yet. Will have to see how working with hard-coded patch will be in practice.

CI-shellcheck is unhappy, btw.

@@ -66,6 +66,7 @@ impl<W: Write> Writer for W {
}
}

// Drop this entirely if rust-bitcoin releases a version bump with https://github.com/rust-bitcoin/rust-bitcoin/pull/3173
Copy link
Contributor

Choose a reason for hiding this comment

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

Prefix with TODO or FIXME for discoverability? Maybe also open an issue for it to make really sure we don't forget as shipping this might have quite an impact on efficiency?

@TheBlueMatt TheBlueMatt force-pushed the 2024-08-feature-cleanup-1 branch from ff558f6 to 066be33 Compare August 17, 2024 15:20
@TheBlueMatt
Copy link
Collaborator Author

I'm honestly not entirely sure about the patch changes yet. Will have to see how working with hard-coded patch will be in practice.

When working directly on LDK it seems to be fine (just have to get used to cargo -p) but it may be a bit more annoying for you cause you'll need to manually patch all the LDK crates if you're working on a project that depends on LDK and you want to point to a local lightning. I can walk it back and do it all via path if you feel strongly, but rust-bitcoin is doing it this way it it seemed a bit nicer than the current half-fixes we have in-tree.

@TheBlueMatt TheBlueMatt force-pushed the 2024-08-feature-cleanup-1 branch 2 times, most recently from 9f001e5 to 2e4480f Compare August 17, 2024 21:12
@TheBlueMatt TheBlueMatt changed the title [1/2] bitcoin 0.32 upgrade followups bitcoin 0.32 upgrade followups Aug 17, 2024
@TheBlueMatt
Copy link
Collaborator Author

Added two more commits but I think sadly we can't materially change the feature set on the lightning crate just cause we have no-std-specific dependencies, which Cargo.toml can't represent. I think with this PR as-is we can cut an 0.0.124 beta.

@TheBlueMatt TheBlueMatt force-pushed the 2024-08-feature-cleanup-1 branch from 31c4206 to 3cc9c8e Compare August 17, 2024 21:53
@TheBlueMatt TheBlueMatt force-pushed the 2024-08-feature-cleanup-1 branch from 3cc9c8e to af6c226 Compare August 17, 2024 22:24
@tnull
Copy link
Contributor

tnull commented Aug 18, 2024

but it may be a bit more annoying for you cause you'll need to manually patch all the LDK crates if you're working on a project that depends on LDK and you want to point to a local lightning. I can walk it back and do it all via path if you feel strongly, but rust-bitcoin is doing it this way it it seemed a bit nicer than the current half-fixes we have in-tree.

Mh, yeah, that's what I thought. It would def. make my life easier if we'd find a solution that would allow me to patch the whole workspace with a single command as I frequently do so for lightning-liquidity and LDK Node, but reverting to the way it has been (i.e., having to patch all of them individually) isn't the end of the world.

@tnull
Copy link
Contributor

tnull commented Aug 18, 2024

CI is unhappy as you seem to have introduced a bunch of (mostly unused import) warnings.

Feel free to squash the fixup.

@TheBlueMatt TheBlueMatt force-pushed the 2024-08-feature-cleanup-1 branch 2 times, most recently from 3adf57d to fe79cf0 Compare August 18, 2024 13:42
@TheBlueMatt
Copy link
Collaborator Author

Mh, yeah, that's what I thought. It would def. make my life easier if we'd find a solution that would allow me to patch the whole workspace with a single command

Okay, moved them all to paths in every Cargo.toml. I'll make my life easier for bindings, too, just a lot more verbose.

@TheBlueMatt TheBlueMatt force-pushed the 2024-08-feature-cleanup-1 branch 2 times, most recently from fa79998 to a07ec51 Compare August 18, 2024 15:35
ci/ci-tests.sh Outdated
cargo test -p $DIR --verbose --color always --no-default-features --features no-std
# check if there is a conflict between no-std and the default std feature
cargo test -p $DIR --verbose --color always --features no-std
done

for DIR in lightning lightning-invoice lightning-rapid-gossip-sync; do
for DIR in lightning lightning-rapid-gossip-sync; do
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need a separate loop for the bindings tests?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Grouping by RUSTFLAGS avoids rebuilding the dependencies again and again.

@Kixunil
Copy link
Contributor

Kixunil commented Aug 19, 2024

FYI regarding [patch] we use it because we have a "dependency hole". secp256k1 is not in our git tree so if we didn't use [patch] we would have no way to tell it to use the new version of hashes which it optionally depends on. [patch] solves this well. If you don't have such problem then it's not clear to me which approach is better.

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, I think.

Feel free to squash the fixups. I don't feel too strongly about patch vs. paths, so feel free to go either way.

@TheBlueMatt TheBlueMatt force-pushed the 2024-08-feature-cleanup-1 branch from a07ec51 to 983feaf Compare August 19, 2024 13:59
@TheBlueMatt
Copy link
Collaborator Author

Squashed without further changes, gonna keep paths everywhere.

tnull
tnull previously approved these changes Aug 19, 2024
When we reach EOF we may return a full buffer when we should return
an empty one.
`rust-bitcoin` doesn't ever actually *use* its `BufRead`
requirement when deserializing objects, and forcing it is somewhat
inefficient, so we optimize the only (actual) case here by passing
reads straight through to the backing stream.
In order to ensure our crates depend on the workspace copies of
each other in test builds we need to override the crates.io
dependency with a local `path`.

We can do this in one of two ways - either specify the `path` in
the dependency listing in each crate's `Cargo.toml` or use the
workspace `Cargo.toml` to `patch` all dependencies. The first is
tedious while the second lets us have it all in one place. However,
the second option does break `cargo *` in individual crate
directories (forcing the use of `cargo -p crate *` instead) and
makes it rather difficult to depend on local versions of workspace
crates.

Thus, here we drop the `patch.crates-io` from our top-level
`Cargo.toml` entirely.

Still, we do update the `ci/ci-tests.sh` script here to use
`cargo -p crate` instead of switching to each crate's directory as
it allows `cargo` to use a shared `target` and may speed up tests.
Now that we don't have to have everything in our entire ecosystem
use the same `std`/`no-std` feature combinations we should start by
untangling our own features a bit.

This takes the first step by removing the `no-std` feature entirely
from the `lightning-background-processor` crate and removing most
feature implications on dependencies from the remaining `std`
feature.

It also addresses a CI oversight where we were not testing
`lightning-background-processor` without the `std` feature in CI at
all.
Now that we don't have to have everything in our entire ecosystem
use the same `std`/`no-std` feature combinations we should start by
untangling our own features a bit.

This takes another step by removing the `no-std` feature entirely
from the `lightning-invoice` crate and removing all feature
implications on dependencies from the remaining `std` feature.
Now that we don't have to have everything in our entire ecosystem
use the same `std`/`no-std` feature combinations we should start by
untangling our own features a bit.

This takes another step by removing the `no-std` feature entirely
from the `lightning-rapid-gossip-sync` crate and removing all
feature implications on dependencies from the remaining `std`
feature.
This exists just for tests, so there's no reason for it to be
publicly visible.
Now that we don't have to have everything in our entire ecosystem
use the same `std`/`no-std` feature combinations we should start by
untangling our own features a bit.

This takes one last step, removing the implications of the `std`
feature from the `lightning` crate.
@TheBlueMatt
Copy link
Collaborator Author

Rebased (and fixed the commit message to note that we are doing the path option not the patch one).

Copy link
Contributor

@arik-so arik-so left a comment

Choose a reason for hiding this comment

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

lgtm!

Copy link
Contributor

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

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

LGTM, a little bit not sure about the rust-bitcoin (rust-bitcoin/rust-bitcoin#3173) but I think I just need to read the rust-bitcoin PR in deep

@TheBlueMatt TheBlueMatt merged commit 3715410 into lightningdevkit:main Aug 19, 2024
18 of 21 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.

OffersMessageHandler impl for ChannelManager accesses time
5 participants