diff --git a/goas/cl/cl/Cargo.toml b/goas/cl/cl/Cargo.toml index c37eed3..dbc1f0e 100644 --- a/goas/cl/cl/Cargo.toml +++ b/goas/cl/cl/Cargo.toml @@ -10,7 +10,10 @@ serde = {version="1.0", features = ["derive"]} group = "0.13.0" rand = "0.8.5" rand_core = "0.6.0" -lazy_static = "1.4.0" hex = "0.4.3" curve25519-dalek = {version = "4.1", features = ["serde", "digest", "rand_core"]} sha2 = "0.10" +once_cell = "1.8.0" + +[patch.crates-io] +curve25519-dalek = { git = "https://github.com/risc0/curve25519-dalek", tag = "curve25519-4.1.2-risczero.0" } \ No newline at end of file diff --git a/goas/cl/cl/src/balance.rs b/goas/cl/cl/src/balance.rs index d88f921..41358c1 100644 --- a/goas/cl/cl/src/balance.rs +++ b/goas/cl/cl/src/balance.rs @@ -1,14 +1,29 @@ -use curve25519_dalek::{ristretto::RistrettoPoint, traits::VartimeMultiscalarMul, Scalar}; -use lazy_static::lazy_static; +use curve25519_dalek::{ + ristretto::{CompressedRistretto, RistrettoPoint}, + traits::VartimeMultiscalarMul, + Scalar, +}; +use once_cell::sync::Lazy; use rand_core::CryptoRngCore; use serde::{Deserialize, Serialize}; use crate::NoteWitness; - -lazy_static! { - // Precompute of `` - static ref PEDERSON_COMMITMENT_BLINDING_POINT: RistrettoPoint = crate::crypto::hash_to_curve(b"NOMOS_CL_PEDERSON_COMMITMENT_BLINDING"); -} +// Precompute of 'crate::crypto::hash_to_curve(b"NOMOS_CL_PEDERSON_COMMITMENT_BLINDING")' +pub static PEDERSON_COMMITMENT_BLINDING_POINT: Lazy = Lazy::new(|| { + let res = CompressedRistretto::from_slice(&[ + 194, 113, 61, 46, 252, 245, 84, 140, 48, 142, 70, 139, 136, 59, 43, 66, 72, 107, 86, 62, + 159, 223, 229, 53, 73, 152, 89, 13, 152, 73, 150, 117, + ]) + .unwrap() + .decompress() + .unwrap(); + // Precompute of 'crate::crypto::hash_to_curve(b"NOMOS_CL_PEDERSON_COMMITMENT_BLINDING")' + debug_assert_eq!( + res, + crate::crypto::hash_to_curve(b"NOMOS_CL_PEDERSON_COMMITMENT_BLINDING") + ); + res +}); #[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize)] pub struct Balance(pub RistrettoPoint);