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

node: Remove default feature #45

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

tcharding
Copy link
Member

@tcharding tcharding commented Jan 22, 2025

The default feature in node overides an explicit version feature. This is a footgun.

Remove the default feature from node.

Note

The features in the node crate are not 'normal'. Even so I personally maintain that --all-features and --no-default-features should build and be footgun free. With this PR merged there is a remaining footgun but it relates to running unit tests locally instead of in using the crate as a dependency - that's not a win but its an improvement.

Fix: #40

@tcharding tcharding marked this pull request as draft January 22, 2025 02:12
@tcharding tcharding marked this pull request as ready for review January 23, 2025 00:12
Every single use statement in `client_versions` has an `allow`
attribute; this is too noisy.
If no features are enabled then a few things happen:

- `bitcoind` from `$PATH` is used.
- We assume Core version 28

This means that in order to make `--no-default-features` build (which is
a reasonable expectation) there are implicit requirements on the
environment - this is bad but I see no other solution ATM.

Improve the code comments, make the attributes uniform, and add missing
version to the no-feature-enabled logic.

Document the `bitcoind` version requirements in the README.
The `default` feature is problematic because it overrides
`--features=xyz` if `--no-default-features` is used.

Remove it.
@tcharding
Copy link
Member Author

tcharding commented Jan 23, 2025

I'm interested to see if this one gets through your CI please @apoelstra.

@apoelstra
Copy link
Member

Sure, will run this through local CI and ack it. But I'm not convinced that --no-default-features should work. It seems like it would be fine if it were a compiler error telling the user to pick a Core version.

We maybe also ought to warn if multiple features are enabled.

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 8d08689; successfully ran local tests

@tcharding
Copy link
Member Author

tcharding commented Jan 23, 2025

But I'm not convinced that --no-default-features should work.

hmm. You could be right, its --all-features that has to work isn't it. I'll put some more thought into it.

(By "has to" I mean, its annoying if it doesn't - I remember we had that somewhere when I first started in this org and it bit me a bunch.)

@apoelstra
Copy link
Member

Yeah, true, we had that with the no-std vs std features in rust-bitcoin. I agree it was super annoying.

But this is a somewhat-obscure leaf crate, which will make it less annoying, and I also think that users would like to be forced to choose a Core version rather than unknowingly going with "the default" and finding that this version changes out from under them.

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.

node: The default feature is a footgun
2 participants