mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 01:05:47 +00:00
crypto/bls: make blst dependency optional (#3387)
## Issue Addressed #3386 ## Proposed Changes * make `blst` crate `optional` * include `blst` dependency into `supranational` feature * hide `blst`-related code with `supranational` feature Co-authored-by: Kirill <kirill@aurora.dev>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#[cfg(feature = "supranational")]
|
||||
pub mod blst;
|
||||
pub mod fake_crypto;
|
||||
#[cfg(feature = "milagro")]
|
||||
|
||||
@@ -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;
|
||||
@@ -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 },
|
||||
@@ -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)
|
||||
@@ -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!(
|
||||
|
||||
Reference in New Issue
Block a user