-
Notifications
You must be signed in to change notification settings - Fork 280
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
Enable build with global context less secure #387
Enable build with global context less secure #387
Conversation
We should use `Deref` from `core` since it is available there.
When building with --no-default-features the compiler emits: warning: unused import: `mem` The call site is feature gated so we either need to feature gate the import or use a fully qualified path. Since 'core' is quite short elect to use the fully qualified path.
Currently we cannot build cleanly with `--no-default-features`. The `Debug` implementation for secrets is feature gated on `std` because it uses a hasher from `std`. If `bitcoin_hashes` is enabled we can use it for hashing. If neither `std` nor `bitcoin_hashes` is enabled fall back to outputting: <secret requires std or bitcoin_hashes feature to display>
Currently this command fails: cargo build --no-default-features --features=global-context-less-secure All features should be able to be built individually, this is currently not the case with `global-context-less-secure`. Enable `std` if `global-context-less-secure` is enabled (because `Once` only comes from `std`, not available in `core`). Add `global-context-less-secure` to the features test array in `contrib/test.sh`. With this applied the build command above runs successfully.
@@ -27,7 +27,7 @@ rand-std = ["rand/std"] | |||
recovery = ["secp256k1-sys/recovery"] | |||
lowmemory = ["secp256k1-sys/lowmemory"] | |||
global-context = ["std", "rand-std", "global-context-less-secure"] | |||
global-context-less-secure = [] | |||
global-context-less-secure = ["std"] |
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'd rather we actually fix the build rather than depend on std (see conversation at #359 for one way to do this). The reason for global-context-less-secure
, in part, is that we want to support global-context
without the rand
dependency, in part for platforms where we can't use rand
. There are some platforms (like wasm, specifically), where we can technically build without no-std, but where we may not actually have an actual std environment to call, relying on LTO to remove the calls that we can't make.
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.
Cool, I'm off for the next few days. I'll convert this to draft and re-spin when I'm back. Thanks.
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.
Now I have read that link I think this whole PR should be closed.
Currently the following build command fails:
Debug
usingbitcoin_hashes::sha256
as the hasher as well as a fallback implementation. Please review carefully.global-context-less-secure
to the test features matrix