Skip to content

Include node in workspace #53

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
merged 6 commits into from
Mar 6, 2025

Conversation

tcharding
Copy link
Member

@tcharding tcharding commented Feb 5, 2025

Currently we do not include the node crate in the workspace because run_task did not support testing it.

However run_task has been patched. Additionally we discovered that we were not testing the docs with --all-features (or any code for that matter other than linting). Fixed in:

rust-bitcoin/rust-bitcoin-maintainer-tools#20

Which this patch uses.

Include node in the workspace. Configure it to work with the newly patched run_task. Add a extra_tests.sh script that runs the node tests.

In order to get MSRV building we make all deps use default-features = false then explicitly enable just what we need.

Also change the feature guarding in the build script so that --all-features works. This is already supported in the main crate code since the highest version feature overrides the lower ones.

@tcharding
Copy link
Member Author

This is mainly to see what happens. I'll come back to debug this.

@tcharding
Copy link
Member Author

BOOM! Mad, no further improvements needed.

apoelstra
apoelstra previously approved these changes Feb 5, 2025
Copy link
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

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

ACK 84ac230; successfully ran local tests

@apoelstra
Copy link
Member

Lemme dig into this -- did not expect that local CI run to pass.

@apoelstra
Copy link
Member

apoelstra commented Feb 5, 2025

Ah, it looks like you removed node from the exclude list but did not put it into members.

@apoelstra apoelstra dismissed their stale review February 5, 2025 16:01

change does not do what I expected to local CI

@tcharding
Copy link
Member Author

did not expect that local CI run to pass.

Neither did I.

it looks like you removed node from the exclude list but did not put it into members.

lol, its hard to get good help.

@tcharding tcharding force-pushed the 02-05-no-exclude-node branch from 84ac230 to 81101c7 Compare February 5, 2025 20:17
@tcharding
Copy link
Member Author

FTR what is the point of having both an explicit 'include' and an 'exclude' list - surely one is default since something must be either in the group or out of the group.

@tcharding
Copy link
Member Author

Ah good, my local test command is now failing.

BOOM! Mad, no further improvements needed.

Face palm.

@tcharding tcharding marked this pull request as draft February 5, 2025 20:20
@apoelstra
Copy link
Member

FTR what is the point of having both an explicit 'include' and an 'exclude' list - surely one is default since something must be either in the group or out of the group.

I think that if you have a crate in neither list, and you try to build that crate directly, it'll complain that it sees a Cargo.toml in a higher directory and isn't sure what to do.

I don't know if this is a bug or intended behavior or what.

Anyway, looks like we're getting the CI failures that we expect now.

@tcharding tcharding force-pushed the 02-05-no-exclude-node branch 2 times, most recently from f2af300 to 313ef9d Compare February 6, 2025 02:59
@tcharding tcharding force-pushed the 02-05-no-exclude-node branch 3 times, most recently from 8a0e63d to d276794 Compare February 6, 2025 03:29
@tcharding tcharding marked this pull request as ready for review February 6, 2025 03:31
@tcharding tcharding force-pushed the 02-05-no-exclude-node branch from d276794 to 68c6087 Compare February 6, 2025 03:38
@tcharding
Copy link
Member Author

I'll come back and debug tomorrow. just lint and just fmt both run cleanly on my machine.

tcharding added a commit that referenced this pull request Feb 6, 2025
9ead0fa Make anyhow an optional build-dependency (Tobin C. Harding)
4016843 Put dep on single line (Tobin C. Harding)

Pull request description:

  Quick cleanup to the `node` manifest. Done while working on #53

ACKs for top commit:
  apoelstra:
    ACK 9ead0fa; successfully ran local tests

Tree-SHA512: d5556518779eae439858c656583a426b36d2d96753c21157955564d67482bfd251696498417b8a8e21d95f87e07dd71b9b3770f5dc4fb27679097c57f929c2b1
@tcharding tcharding force-pushed the 02-05-no-exclude-node branch 3 times, most recently from 5e69dc4 to 13d2815 Compare February 6, 2025 22:24
@tcharding
Copy link
Member Author

tcharding commented Feb 6, 2025

Now includes a custom lint script. And WIN, the script found a bug in the feature gating of node.

@tcharding tcharding force-pushed the 02-05-no-exclude-node branch 2 times, most recently from bdefcaa to 17b94df Compare February 6, 2025 22:44
@tcharding tcharding force-pushed the 02-05-no-exclude-node branch from 389c995 to 84c45ba Compare February 18, 2025 08:12
@apoelstra
Copy link
Member

Lol, nice, adding those redudant imports so the compiler output isn't such a mess without features.

@apoelstra
Copy link
Member

In 84c45ba:

This does not build if you enable 0_17_1 download doc and nothing else.

It may help to draw out an ascii-art truth table in the file.

@tcharding
Copy link
Member Author

This does not build if you enable 0_17_1 download doc and nothing else.

There is no reason to enable doc unless one is building the docs. But I can have another go, no sweat. Sorry this is dragging out so much.

@tcharding
Copy link
Member Author

tcharding commented Feb 18, 2025

I think its correct as it is man. We are abusing the download and doc features by using not on them so as to support --all-features. Said another way, we have to have at least one not statement on main otherwise it triggers for --all-features and for this we use doc and download.

If I'm correct then it implies changing your CI, is that acceptable?

@apoelstra
Copy link
Member

I was ok with saying "you need at least one of the version features" but not with this byzantine set of rules for which feature combinations are permissible. I can update my local CI but I haven't even gotten that far because manually understanding the feature gates takes so much work and I haven't completed it without encountering something surprising.

At the very least, if we don't want certain combinations to work then we should have an explicit compile_error about them.

@tcharding
Copy link
Member Author

Let me try solve this at a higher level. We have a bunch of smellyness in the features. doc is unusual and the feature ones are unusual in multiple ways (require at least one and enable all versions lower).

@tcharding tcharding force-pushed the 02-05-no-exclude-node branch from 84c45ba to 8fd2752 Compare February 19, 2025 21:59
@tcharding
Copy link
Member Author

Hoorah!! We got there. I removed the doc feature all together. The fail was not noticing this when I introduced rustdoc-args = ["--cfg", "docsrs"] in the manifest ages ago.

@tcharding
Copy link
Member Author

Hopefull the docs build done by docs.rs does not run the tests during its build process. Because this crate's docs currently exist online I rekon this is true.

@apoelstra
Copy link
Member

I've almost got this. My local CI has a cargo test --doc line which has taken a bunch of iteration, since it doesn't work with --all-features (that enables download which doesn't work inside Nix) nor does it work with no features (that triggers the compile-fail error) and obtaining a specific feature list is a bit of a trick.

There are similar lines all over the place which cover things like doctests which crate2nix/cargo don't test unless you go out of your way to explicitly specify, and they all break in some way with this crate.

@tcharding tcharding force-pushed the 02-05-no-exclude-node branch from 8fd2752 to 84a2017 Compare February 24, 2025 22:12
@tcharding
Copy link
Member Author

tcharding commented Feb 24, 2025

Holy smokes this one should not have been so hard. Here is another attempt. Please see #45 (comment) and also the additional patches before the last in this PR.

  • Now cargo test should work and tests pass if you have bitcoind in your path and its version 17 (works for 18 and likely a few others too FWIW). Implies cargo test --doc works too.

  • Features stack correctly in downstream crates (ie the footgun fixed in node: Remove default feature #45 is still gone)

I owe you a beer for this one.

In rust-bitcoin#45 we removed the default feature because we were setting it to
`28_0` and this was a footgun because downstream crates needed to
explicitly use no default features. This change made it impossible to
build the crate without selecting a version feature which implicitly
means `--no-default-features` does not work.

Instead we can set the default to `0_17_1` and then the crate builds
with no default features and also downstream users who select a higher
version get correct behaviour because higher versions override lower
ones.
In the comments I got mixed up between this crate and the `node` crate.
Annoyingly, and confusingly, the unusual features in these two crates do
not behave the same. In integration tests we feature gate tests on a
specific version - this means the version features are mutually
exclusive.
Currently we do not include the `node` crate in the workspace because
`run_task` did not support testing it.

However `run_task` has now been patched.

Include `node` in the workspace. Configure it to work with the newly
patched `run_task`. Add a `extra_tests.sh` script that runs the `node`
tests.

In order to get MSRV building we make all deps use `default-features =
false` then explicitly enable just what we need.

Also change the feature guarding in the build script so that
`--all-features` works. This is already supported in the main crate code
since the highest version feature overrides the lower ones.
@tcharding tcharding force-pushed the 02-05-no-exclude-node branch from 84a2017 to 03b9350 Compare February 24, 2025 22:20
@apoelstra
Copy link
Member

Now cargo test should work and tests pass if you have bitcoind in your path and its version 17

LOL ok, yeah, I'll go digging around to find a copy of boost 1.75 and miniupnpc 2.2.7 and gcc 11 and whatever libc I need to work with it.

(These changes don't actually make the situation any worse -- if it's true that I need to somehow obtain and run extremely old versions of Core to make the tests pass then that's going to be a problem for me no matter what.)

@tcharding
Copy link
Member Author

tcharding commented Feb 25, 2025

How about we not run node builds/tests in your CI and rely on GitHub for testing it? (That is not a smart arse comment, I searious.)

@apoelstra
Copy link
Member

As long as node is in the workspace.members part of the manifest then I have to deal with the existence of the download feature.

If I can't build specific versions of Core then sure, I can just disable those.

@tcharding
Copy link
Member Author

I don't know what to do about this now man.

@apoelstra
Copy link
Member

I'm working on it.

@tcharding
Copy link
Member Author

No stress, no rush. FTR I'm not itching to release now, that itch went away.

@tcharding
Copy link
Member Author

Hey man, I'm going to go ahead and merge this. I need some time away from rust-bitcoin and this repo is the other thing I can work on without waiting on or arguing with other people. I'm totally drained right now. I just want to crawl off into a corner and write some code. Please don't take me pushing forward as any comment on you or your CI, both of which I'm happy to work with. Its the greater rust-bitcoin 'community' that has me zonked.

@tcharding tcharding merged commit 594a305 into rust-bitcoin:master Mar 6, 2025
27 checks passed
@apoelstra
Copy link
Member

No problem. I can test my local CI against master while I'm getting it working.

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.

2 participants