diff --git a/Cargo.toml b/Cargo.toml index 4e0d63d..04c567c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "ark-vrf" version = "0.1.0" -edition = "2021" +edition = "2024" authors = [ "Davide Galassi " ] license = "MIT" description = "Elliptic curve VRF with additional data" @@ -19,7 +19,7 @@ sha2 = { version = "0.10", default-features = false } rand_chacha = { version = "0.3", default-features = false } rayon = { version = "1.10", default-features = false, optional = true } hmac = {version = "0.12", default-features = false, optional = true } -ring-proof = { package = "w3f-ring-proof", version = "0.0.2", default-features = false, optional = true } +w3f-ring-proof = { version = "0.0.2", default-features = false, optional = true } # Curves ark-secp256r1 = { version = "0.5", default-features = false, optional = true } ark-ed25519 = { version = "0.5", default-features = false, optional = true } @@ -31,10 +31,10 @@ ark-bn254 = { version = "0.5", default-features = false, optional = true } [dev-dependencies] ark-std = { version = "0.5", default-features = false, features = ["getrandom"] } -ark-ed25519 = "0.5" -hex = "0.4" +ark-ed25519 = { version = "0.5" } +hex = { version = "0.4" } serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" +serde_json = { version = "1.0" } indexmap = { version = "2.2.6", features = ["serde"] } [features] @@ -42,7 +42,7 @@ default = [ "std" ] std = [ "ark-std/std", "ark-ec/std", - "ring-proof?/std", + "w3f-ring-proof?/std", ] secret-split = [ "ark-std/getrandom" ] full = [ @@ -60,19 +60,19 @@ bandersnatch = [ "ark-ed-on-bls12-381-bandersnatch", "ark-bls12-381/curve" ] baby-jubjub = [ "ark-ed-on-bn254", "ark-bn254/curve" ] secp256r1 = [ "ark-secp256r1", "rfc-6979" ] # Miscellanea -ring = [ "ring-proof" ] +ring = [ "w3f-ring-proof" ] rfc-6979 = [ "hmac" ] # Optimizations parallel = [ "ark-ec/parallel", "ark-ff/parallel", "ark-std/parallel", - "ring-proof?/parallel", + "w3f-ring-proof?/parallel", "rayon", ] -asm = [ "ark-ff/asm", "ring-proof?/asm" ] +asm = [ "ark-ff/asm", "w3f-ring-proof?/asm" ] # Deterministic, no-zk, ring-proof (unsafe) -test-vectors = [ "ring-proof?/test-vectors" ] +test-vectors = [ "w3f-ring-proof?/test-vectors" ] [package.metadata.docs.rs] features = [ "full" ] diff --git a/src/lib.rs b/src/lib.rs index 604a6f2..470bb69 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -99,8 +99,8 @@ //! - `default`: `std` //! - `full`: Enables all features listed below except `secret-split`, `parallel`, `asm`, `rfc-6979`, `test-vectors`. //! - `secret-split`: Point scalar multiplication with secret split. Secret scalar is split into the sum -//! of two scalars, which randomly mutate but retain the same sum. Incurs 2x penalty in some internal -//! sensible scalar multiplications, but provides side channel defenses. +//! of two scalars, which randomly mutate but retain the same sum. Incurs 2x penalty in some internal +//! sensible scalar multiplications, but provides side channel defenses. //! - `ring`: Ring-VRF for the curves supporting it. //! - `rfc-6979`: Support for nonce generation according to RFC-9381 section 5.4.2.1. //! - `test-vectors`: Deterministic ring-vrf proof. Useful for reproducible test vectors generation. @@ -425,7 +425,7 @@ macro_rules! suite_types { mod tests { use super::*; use suites::testing::{Input, Secret}; - use testing::{random_val, TEST_SEED}; + use testing::{TEST_SEED, random_val}; #[test] fn vrf_output_check() { diff --git a/src/pedersen.rs b/src/pedersen.rs index d2c0643..575291c 100644 --- a/src/pedersen.rs +++ b/src/pedersen.rs @@ -157,7 +157,7 @@ impl Verifier for Public { #[cfg(test)] pub(crate) mod testing { use super::*; - use crate::testing::{self as common, random_val, CheckPoint, SuiteExt, TEST_SEED}; + use crate::testing::{self as common, CheckPoint, SuiteExt, TEST_SEED, random_val}; pub fn prove_verify() { use pedersen::{Prover, Verifier}; diff --git a/src/ring.rs b/src/ring.rs index 30b3150..0bbc633 100644 --- a/src/ring.rs +++ b/src/ring.rs @@ -10,6 +10,7 @@ use ark_ec::{ use ark_std::ops::Range; use pedersen::{PedersenSuite, Proof as PedersenProof}; use utils::te_sw_map::TEMapping; +use w3f_ring_proof as ring_proof; /// Magic spell for [RingSuite::ACCUMULATOR_BASE] generation in built-in implementations. /// diff --git a/src/suites/bandersnatch.rs b/src/suites/bandersnatch.rs index acc5f6c..62f2865 100644 --- a/src/suites/bandersnatch.rs +++ b/src/suites/bandersnatch.rs @@ -141,8 +141,10 @@ pub(crate) mod tests { fn elligator2_hash_to_curve() { use crate::testing::CheckPoint; let raw = crate::testing::random_vec(42, None); - assert!(ThisSuite::data_to_point(&raw) - .map(|p| p.check(true).ok()) - .is_some()); + assert!( + ThisSuite::data_to_point(&raw) + .map(|p| p.check(true).ok()) + .is_some() + ); } } diff --git a/src/testing.rs b/src/testing.rs index 2c859cb..8499de5 100644 --- a/src/testing.rs +++ b/src/testing.rs @@ -3,7 +3,7 @@ use ark_std::{vec, vec::Vec}; use crate::*; -use ark_std::{rand::RngCore, UniformRand}; +use ark_std::{UniformRand, rand::RngCore}; pub const TEST_SEED: &[u8] = b"seed"; diff --git a/src/utils/common.rs b/src/utils/common.rs index da86b3a..a4efc5d 100644 --- a/src/utils/common.rs +++ b/src/utils/common.rs @@ -1,7 +1,7 @@ use crate::*; use ark_ec::{ - hashing::curve_maps::elligator2::{Elligator2Config, Elligator2Map}, AffineRepr, + hashing::curve_maps::elligator2::{Elligator2Config, Elligator2Map}, }; use ark_ff::PrimeField; use digest::{Digest, FixedOutputReset}; @@ -80,7 +80,7 @@ where Elligator2Map>: ark_ec::hashing::map_to_curve_hasher::MapToCurve< as AffineRepr>::Group>, { - use ark_ec::hashing::{map_to_curve_hasher::MapToCurveBasedHasher, HashToCurve}; + use ark_ec::hashing::{HashToCurve, map_to_curve_hasher::MapToCurveBasedHasher}; use ark_ff::field_hashers::DefaultFieldHasher; // Domain Separation Tag := "ECVRF_" || h2c_suite_ID_string || suite_string diff --git a/src/utils/te_sw_map.rs b/src/utils/te_sw_map.rs index 2cc8016..81c7946 100644 --- a/src/utils/te_sw_map.rs +++ b/src/utils/te_sw_map.rs @@ -1,7 +1,7 @@ use ark_ec::{ + CurveConfig, short_weierstrass::{Affine as SWAffine, SWCurveConfig}, twisted_edwards::{Affine as TEAffine, MontCurveConfig, TECurveConfig}, - CurveConfig, }; use ark_ff::{Field, One}; use ark_std::borrow::Cow;