-
Notifications
You must be signed in to change notification settings - Fork 831
Add rand-std feature #1387
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
Add rand-std feature #1387
Conversation
bitcoin/src/util/psbt/mod.rs
Outdated
@@ -1686,7 +1685,6 @@ mod tests { | |||
assert_eq!(psbt1, psbt2); | |||
} | |||
|
|||
#[cfg(feature = "rand")] | |||
fn gen_keys() -> (PrivateKey, PublicKey, Secp256k1<All>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WTF, this shouldn't work. I suspect we have something seriously wrong, maybe we're enabling rand-std
via other means.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the same but "rand-std" is enabled in the dev dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, maybe that's wrong because we can't properly check that the features work correctly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed! Thanks for prodding me to fix it correctly.
c51e02a
to
71787e8
Compare
Changes in force push:
|
71787e8
to
1a0437d
Compare
Added missing feature guard to rustdoc example code. |
1a0437d
to
8a15d22
Compare
Fix even more mistakes with the original push :( |
f132e12
to
6248a70
Compare
From a quick look it looks like the problem is in |
Bother huh, I patched it just now. |
6248a70
to
affd2ab
Compare
Put this on ice until the rand-std stuff in secp goes in and is released. |
note to self: if #1416 merges update the doc to use |
affd2ab
to
9fcc303
Compare
acbf4ba
to
2e156c1
Compare
#1493 is in. |
Currently we enable "secp256k1/rand-std" in the "rand" feature, this is incorrect because it means "rand" implies "std" which it does not. Add a "rand-std" feature that turns on "seck256k1/rand-std" and make the "rand" feature turn on "seck256k1/rand".
In order to get better test coverage we should not enable the secp26k1 feature "rand-std" in dev-dependencies but instead feature gate tests that depend on this feature.
2e156c1
8000
to
941083e
Compare
Can you explain more about the benefits of this? To me, It feels like this only adds additional code while writing tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 941083e
Unconditionally enabling it could cause us to miss features-related bugs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 941083e
This PR uncovered incorrect feature gating in
secp256k1
, fixed in rust-bitcoin/rust-secp256k1#519Currently we enable "secp256k1/rand-std" in the "rand" feature, this is incorrect because it means "rand" implies "std" which it does not.
Add a "rand-std" feature that turns on "seck256k1/rand-std" and make the "rand" feature turn on "seck256k1/rand".
Fix: #1384