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

[Merged by Bors] - crypto/bls: make blst dependency optional #3387

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crypto/bls/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ eth2_hashing = "0.3.0"
ethereum-types = "0.12.1"
arbitrary = { version = "1.0", features = ["derive"], optional = true }
zeroize = { version = "1.4.2", features = ["zeroize_derive"] }
blst = "0.3.3"
blst = { version = "0.3.3", optional = true }

[features]
default = ["supranational"]
fake_crypto = []
milagro = ["milagro_bls"]
supranational = []
supranational = ["blst"]
supranational-portable = ["supranational", "blst/portable"]
supranational-force-adx = ["supranational", "blst/force-adx"]
1 change: 1 addition & 0 deletions crypto/bls/src/impls/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[cfg(feature = "supranational")]
pub mod blst;
pub mod fake_crypto;
#[cfg(feature = "milagro")]
Expand Down
4 changes: 4 additions & 0 deletions crypto/bls/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pub use generic_signature::{INFINITY_SIGNATURE, SIGNATURE_BYTES_LEN};
pub use get_withdrawal_credentials::get_withdrawal_credentials;
pub use zeroize_hash::ZeroizeHash;

#[cfg(feature = "supranational")]
use blst::BLST_ERROR as BlstError;
#[cfg(feature = "milagro")]
use milagro_bls::AmclError;
Expand All @@ -53,6 +54,7 @@ pub enum Error {
#[cfg(feature = "milagro")]
MilagroError(AmclError),
/// An error was raised from the Supranational BLST BLS library.
#[cfg(feature = "supranational")]
BlstError(BlstError),
/// The provided bytes were an incorrect length.
InvalidByteLength { got: usize, expected: usize },
Expand All @@ -71,6 +73,7 @@ impl From<AmclError> for Error {
}
}

#[cfg(feature = "supranational")]
impl From<BlstError> for Error {
fn from(e: BlstError) -> Error {
Error::BlstError(e)
Expand Down Expand Up @@ -130,6 +133,7 @@ macro_rules! define_mod {

#[cfg(feature = "milagro")]
define_mod!(milagro_implementations, crate::impls::milagro::types);
#[cfg(feature = "supranational")]
define_mod!(blst_implementations, crate::impls::blst::types);
#[cfg(feature = "fake_crypto")]
define_mod!(
Expand Down