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

Expose secp256k1 features #344

Merged

Conversation

thomaseizinger
Copy link
Contributor

@thomaseizinger thomaseizinger commented Nov 21, 2019

This PR adds two patches that expose feature flags from the underlying secp256k1 library.

The primary benefit here is that we can activate the rand feature from a crate that only depends on rust-bitcoin but would like to make use of the feature-gated rand functionality in secp256k1. The current workaround here is to add an additional dependency on secp256k1 that includes the feature flag. This works because cargo accumulates feature flags across the dependency tree.

Unfortunately, this requires to activately keep those versions in sync. By giving access to the rand feature flag of secp256k1 through a rand feature flag in rust-bitcoin, this situation can be avoided.

Additionally, I noticed that the serde feature in secp256k1 is not included in the use-serde feature of rust-bitcoin. The 2nd patch fixes this.

By exposing this, we can use the 'rand' dependency of secp256k1
in a project that only depends on rust-bitcoin without having to
add a separate dependency in order to activate the feature flag.
@codecov-io
Copy link

codecov-io commented Nov 21, 2019

Codecov Report

Merging #344 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #344   +/-   ##
=======================================
  Coverage   81.66%   81.66%           
=======================================
  Files          38       38           
  Lines        7032     7032           
=======================================
  Hits         5743     5743           
  Misses       1289     1289

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 700ed54...7be4ac0. Read the comment docs.

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.

utACK

Copy link
Member

@elichai elichai left a comment

Choose a reason for hiding this comment

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

utACK 7be4ac0

@stevenroose
Copy link
Collaborator

Eh I somehow recall that serde thing being there. Perhaps I didn't figure out I couldn't serialize because of this feature.
utACK 7be4ac0

I guess until Cargo let's us somehow enable sub-features from the toml file.

@stevenroose stevenroose merged commit 6ce582b into rust-bitcoin:master Dec 4, 2019
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.

None yet

5 participants