diff --git a/node/Cargo.toml b/node/Cargo.toml index f90666f2..b22a7fb6 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -28,7 +28,7 @@ bit-vec = "0.6" blst = "0.3.10" ark-bn254 = "0.4.0" ark-ec = "0.4.2" -ark-serialize = "0.4.2" +ark-serialize = { version = "0.4.2", features = ["std"] } num-traits = "0.2.17" clap = { version = "4.3.3", features = ["derive"] } ed25519-dalek = { version = "2.0.0", features = ["serde", "rand_core"] } diff --git a/node/libs/crypto/src/bn254/hash.rs b/node/libs/crypto/src/bn254/hash.rs index ad30f95d..dd7a7b62 100644 --- a/node/libs/crypto/src/bn254/hash.rs +++ b/node/libs/crypto/src/bn254/hash.rs @@ -3,7 +3,6 @@ use ark_bn254::{G1Affine, G1Projective}; use ark_ec::AffineRepr as _; use sha2::Digest as _; -use tracing::instrument; /// Hashes an arbitrary message and maps it to an elliptic curve point in G1. pub(crate) fn hash_to_g1(msg: &[u8]) -> G1Projective { diff --git a/node/libs/crypto/src/bn254/mod.rs b/node/libs/crypto/src/bn254/mod.rs index 99dbfa77..b70bcd72 100644 --- a/node/libs/crypto/src/bn254/mod.rs +++ b/node/libs/crypto/src/bn254/mod.rs @@ -1,7 +1,7 @@ //! BLS signature scheme for the BN254 curve. use crate::ByteFmt; -use anyhow::anyhow; +use anyhow::Context as _; use ark_bn254::{Bn254, Fr, G1Projective as G1, G2Projective as G2}; use ark_ec::{ pairing::{Pairing as _, PairingOutput}, @@ -43,7 +43,7 @@ impl ByteFmt for SecretKey { fn decode(bytes: &[u8]) -> anyhow::Result { Fr::deserialize_compressed(bytes) .map(Self) - .map_err(|e| anyhow!("failed to decode secret key: {e:?}")) + .context("failed to decode secret key") } fn encode(&self) -> Vec { @@ -61,7 +61,7 @@ impl ByteFmt for PublicKey { fn decode(bytes: &[u8]) -> anyhow::Result { G2::deserialize_compressed(bytes) .map(Self) - .map_err(|e| anyhow!("failed to decode public key: {e:?}")) + .context("failed to decode public key") } fn encode(&self) -> Vec { @@ -110,7 +110,7 @@ impl ByteFmt for Signature { fn decode(bytes: &[u8]) -> anyhow::Result { G1::deserialize_compressed(bytes) .map(Self) - .map_err(|e| anyhow!("failed to decode signature: {e:?}")) + .context("failed to decode signature") } fn encode(&self) -> Vec { let mut buf = Vec::new(); @@ -184,7 +184,7 @@ impl ByteFmt for AggregateSignature { fn decode(bytes: &[u8]) -> anyhow::Result { G1::deserialize_compressed(bytes) .map(Self) - .map_err(|e| anyhow!("failed to decode aggregate signature: {e:?}")) + .context("failed to decode aggregate signature") } fn encode(&self) -> Vec { diff --git a/node/libs/crypto/src/bn254/tests.rs b/node/libs/crypto/src/bn254/tests.rs index d07afbfa..933b914b 100644 --- a/node/libs/crypto/src/bn254/tests.rs +++ b/node/libs/crypto/src/bn254/tests.rs @@ -1,7 +1,9 @@ -use crate::bn254::{AggregateSignature, PublicKey, SecretKey, Signature}; -use rand::{rngs::StdRng, Rng, SeedableRng}; use std::iter::repeat_with; +use rand::{rngs::StdRng, Rng, SeedableRng}; + +use crate::bn254::{AggregateSignature, PublicKey, SecretKey, Signature}; + #[test] fn signature_smoke() { let mut rng = StdRng::seed_from_u64(29483920);