From 11dd1081cb74fa76cee439b35bd2df89acd99d3a Mon Sep 17 00:00:00 2001 From: Zara Date: Thu, 21 May 2026 18:52:02 -0700 Subject: [PATCH 1/3] circuit optimization with U64 --- circuits/lib/src/configs/default/mod.nr | 4 +- .../lib/src/core/dkg/share_computation.nr | 12 +- circuits/lib/src/core/dkg/share_decryption.nr | 8 +- circuits/lib/src/core/dkg/share_encryption.nr | 11 +- .../threshold/decrypted_shares_aggregation.nr | 11 +- .../lib/src/core/threshold/pk_aggregation.nr | 5 +- .../src/core/threshold/share_decryption.nr | 11 +- circuits/lib/src/lib.nr | 2 +- circuits/lib/src/math/modulo/U64.nr | 354 ++++++++++++++++++ circuits/lib/src/math/modulo/mod.nr | 2 + .../lib/src/math/modulo/unconstrained_U128.nr | 14 + .../lib/src/math/modulo/unconstrained_U64.nr | 122 ++++++ pnpm-lock.yaml | 201 ++++++---- 13 files changed, 653 insertions(+), 104 deletions(-) create mode 100644 circuits/lib/src/math/modulo/U64.nr create mode 100644 circuits/lib/src/math/modulo/unconstrained_U64.nr diff --git a/circuits/lib/src/configs/default/mod.nr b/circuits/lib/src/configs/default/mod.nr index f29df7cd84..ac3bdbed42 100644 --- a/circuits/lib/src/configs/default/mod.nr +++ b/circuits/lib/src/configs/default/mod.nr @@ -7,8 +7,8 @@ // Auto-generated by build-circuits.ts for preset: insecure-512 pub use super::committee::micro::{H, N_PARTIES, T}; -pub use super::insecure::dkg; -pub use super::insecure::threshold; +pub use super::secure::dkg; +pub use super::secure::threshold; /// Max number of non-zero coefficients in the message polynomial. /// This is a conservative estimate that should be okay for most use cases. diff --git a/circuits/lib/src/core/dkg/share_computation.nr b/circuits/lib/src/core/dkg/share_computation.nr index c91a2a603c..1bac4e2527 100644 --- a/circuits/lib/src/core/dkg/share_computation.nr +++ b/circuits/lib/src/core/dkg/share_computation.nr @@ -8,7 +8,7 @@ use crate::math::commitments::{ compute_share_computation_e_sm_commitment, compute_share_computation_sk_commitment, compute_share_encryption_commitment_from_message, }; -use crate::math::modulo::U128::ModU128; +use crate::math::modulo::U64::ModU64; use crate::math::polynomial::Polynomial; /// Cryptographic parameters for Threshold secret share verification circuit. @@ -194,7 +194,8 @@ impl (half as u128) { + // c = e_sm_secret coeff in [0, q) < 2^62; half < 2^61: u64 saves 22 gates. + let centered = if (c as u64) > (half as u64) { c - q } else { c @@ -294,10 +295,9 @@ pub fn verify_parity_check( for i in 0..N { // Reverse: position i gets the coefficient from N-1-i. let c = poly.coefficients[N - 1 - i]; - let reduced = ModU128::new(q).reduce_mod(c); + // c < H*q_l (sum of H shares); quotient < H (small) -- safe for ModU64. + let reduced = ModU64::new(q as u64).reduce_mod(c); // Center: shift to [-(q-1)/2, (q-1)/2]. - let centered = if (reduced as u128) > (half as u128) { + // reduced < q < 2^62 and half < 2^61: u64 cast is sufficient, saves 22 gates. + let centered = if (reduced as u64) > (half as u64) { reduced - q } else { reduced diff --git a/circuits/lib/src/core/dkg/share_encryption.nr b/circuits/lib/src/core/dkg/share_encryption.nr index ecec07103c..c239d73233 100644 --- a/circuits/lib/src/core/dkg/share_encryption.nr +++ b/circuits/lib/src/core/dkg/share_encryption.nr @@ -10,7 +10,7 @@ use crate::math::commitments::{ }; use crate::math::commitments::compute_dkg_pk_commitment; use crate::math::helpers::flatten; -use crate::math::modulo::U128::ModU128; +use crate::math::modulo::U64::ModU64; use crate::math::polynomial::Polynomial; /// Parameters for DKG share encryption (C3). @@ -204,19 +204,20 @@ impl Polynomial { let t = self.configs.t; - let t_mod = ModU128::new(t); + // t < 2^62 (plaintext modulus); q_mod_t, msg_i < t: all safe for ModU64. + let t_mod = ModU64::new(t as u64); let q_mod_t: Field = self.configs.q_mod_t; let mut k1_coeffs: [Field; N] = [0; N]; - // Integer division for t_half - let t_half: u128 = (t as u128) / 2; + // Integer division for t_half; t < 2^62 so u64 is sufficient. + let t_half: u64 = (t as u64) / 2; for i in 0..N { let msg_i: Field = self.message.coefficients[i]; let q_times_m_mod_t = t_mod.mul_mod(q_mod_t, msg_i); // Check if centering is needed (value > t/2 means negative in centered form) - let needs_centering = (q_times_m_mod_t as u128) > t_half; + let needs_centering = (q_times_m_mod_t as u64) > t_half; k1_coeffs[i] = if needs_centering { // Value is in (t/2, t), negative in centered form diff --git a/circuits/lib/src/core/threshold/decrypted_shares_aggregation.nr b/circuits/lib/src/core/threshold/decrypted_shares_aggregation.nr index f26cdfebbd..66e9fe7c67 100644 --- a/circuits/lib/src/core/threshold/decrypted_shares_aggregation.nr +++ b/circuits/lib/src/core/threshold/decrypted_shares_aggregation.nr @@ -5,7 +5,7 @@ // or FITNESS FOR A PARTICULAR PURPOSE. use crate::math::commitments::compute_threshold_decryption_share_commitment; -use crate::math::modulo::U128::ModU128; +use crate::math::modulo::U64::ModU64; use crate::math::polynomial::Polynomial; use dep::bignum::BigNum; use dep::bignum::bignum::to_field; @@ -132,7 +132,8 @@ impl q_half_bn; @@ -189,7 +190,8 @@ pub fn compute_all_lagrange_coeffs( // Step 3: For each CRT basis, compute Lagrange coefficients for basis_idx in 0..L { let q_l = qis[basis_idx]; - let m = ModU128::new(q_l); + // party_ids are small (1-indexed, <= T+1); quotient < T+1 << 2^64: safe for ModU64. + let m = ModU64::new(q_l as u64); // Compute product of all party IDs: PRODUCT(j=0..T) x_j mod q_l let mut product_x = 1 as Field; @@ -243,7 +245,8 @@ pub fn compute_crt_components PkAggregation secure / insecure / committee) for DKG //! and threshold packages under `circuits/bin/`. diff --git a/circuits/lib/src/math/modulo/U64.nr b/circuits/lib/src/math/modulo/U64.nr new file mode 100644 index 0000000000..b6315f7f0b --- /dev/null +++ b/circuits/lib/src/math/modulo/U64.nr @@ -0,0 +1,354 @@ +// SPDX-License-Identifier: LGPL-3.0-only +// +// This file is provided WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY +// or FITNESS FOR A PARTICULAR PURPOSE. + +//! Constrained modular arithmetic for moduli that fit in 62 bits. +//! +//! `ModU64` stores the modulus as `u64` and uses `u64` casts for all range checks. +//! A `u64` cast costs ~11 lookup gates; a `u128` cast costs ~22. +//! Each `mul_mod` therefore saves ~22 gates over `ModU128` (two range checks per call). + +use super::unconstrained_U64::{ + __inv_mod_u64, __mul_mod_witness_u64, __neg_u64, __reduce_witness_u64, + __sub_with_underflow_u64, +}; + +/// Modular arithmetic context for prime moduli < 2^62. +/// +/// Use this instead of `ModU128` when the modulus is known to be at most 62 bits. +/// The gate savings come from narrower range checks: u64 vs u128. +pub struct ModU64 { + pub m: u64, // must be prime, < 2^62 +} + +impl ModU64 { + pub fn new(m: u64) -> Self { + ModU64 { m } + } + + pub fn get_mod_field(self) -> Field { + self.m as Field + } + + /// Reduces n modulo m. n may be a large Field (e.g. after encoding plaintext). + pub fn reduce_mod(self, n: Field) -> Field { + // Safety: __reduce_witness_u64 divides via u128; result verified below. + let quotient = unsafe { __reduce_witness_u64(n, self.m) }; + let remainder = n - (quotient as Field) * (self.m as Field); + // u64 casts: ~11 lookup gates each (vs ~22 for u128) + let rem_u64 = remainder as u64; + let quo_u64 = quotient as u64; // no-op: quotient already u64; present for clarity + assert((quo_u64 as Field) * (self.m as Field) + (rem_u64 as Field) == n); + assert(rem_u64 < self.m); + rem_u64 as Field + } + + /// Asserts that n == 0 mod m without computing the remainder. + /// + /// Cheaper than reduce_mod + assert == 0: skips the remainder range check and bounds assert. + /// Gate cost: ~11 (quotient u64 range check) + 1 (arithmetic assert) = ~12 gates + /// vs reduce_mod's ~24 gates. + /// + /// Soundness: quo*m == n holds in integers (not just Field) because both sides are + /// bounded well below the field prime, so Field equality implies integer equality. + pub fn assert_zero_mod(self, n: Field) { + // Safety: __reduce_witness_u64 computes floor(n/m); verified by arithmetic assert below. + let quotient = unsafe { __reduce_witness_u64(n, self.m) }; + let quo_u64 = quotient as u64; // ~11 lookup gates + assert((quo_u64 as Field) * (self.m as Field) == n, "Divisibility check failed"); + } + + /// (lhs + rhs) mod m. Inputs must already be reduced (< m). + pub fn add(self, lhs: Field, rhs: Field) -> Field { + // lhs + rhs < 2m < 2^63; no Field overflow before reduce_mod. + self.reduce_mod(lhs + rhs) + } + + /// (lhs - rhs) mod m. Inputs must already be reduced (< m). + pub fn sub(self, lhs: Field, rhs: Field) -> Field { + // Safety: __sub_with_underflow_u64 verified by the equation below. + let (res_u64, underflow) = unsafe { __sub_with_underflow_u64(lhs, rhs, self.m) }; + if underflow { + assert( + lhs + (self.m as Field) == rhs + (res_u64 as Field), + "Subtraction with underflow verification failed", + ); + } else { + assert(lhs == rhs + (res_u64 as Field), "Subtraction verification failed"); + } + res_u64 as Field + } + + /// (a * b) mod m. Inputs must already be reduced (< m < 2^62). + /// + /// Gate breakdown: + /// ~11 gates: quotient u64 range check (implicit in return type of unconstrained) + /// ~11 gates: rem_u64 cast + /// 1 gate: arithmetic assert + /// 1 gate: bounds assert + pub fn mul_mod(self, a: Field, b: Field) -> Field { + // Safety: __mul_mod_witness_u64 uses u128 for the 124-bit product; result verified below. + let quotient = unsafe { __mul_mod_witness_u64(a, b, self.m) }; + let remainder = a * b - (quotient as Field) * (self.m as Field); + let rem_u64 = remainder as u64; // ~11 lookup gates + let quo_u64 = quotient as u64; // no-op: quotient already u64 + assert((quo_u64 as Field) * (self.m as Field) + (rem_u64 as Field) == a * b); + assert(rem_u64 < self.m); + rem_u64 as Field + } + + /// (a / b) mod m: multiplies a by b^(-1) mod m. + pub fn div_mod(self, a: Field, b: Field) -> Field { + // Safety: __inv_mod_u64 uses Fermat's Little Theorem; verified via mul_mod below. + let b_inv = unsafe { __inv_mod_u64(b, self.m) }; + self.mul_mod(a, b_inv as Field) + } + + /// (-val) mod m. + pub fn neg(self, val: Field) -> Field { + // Safety: __neg_u64 returns m - val; verified by addition equation below. + let result = unsafe { __neg_u64(val, self.m) }; + let res_u64 = result as u64; + if val == 0 { + assert(res_u64 == 0, "Negation of zero should be zero"); + } else { + assert(val + (res_u64 as Field) == (self.m as Field), "Negation verification failed"); + } + res_u64 as Field + } + + /// val^(-1) mod m. m must be prime; val must be non-zero. + pub fn inv_mod(self, val: Field) -> Field { + // Safety: __inv_mod_u64 uses Fermat's Little Theorem; verified by mul_mod below. + let result = unsafe { __inv_mod_u64(val, self.m) }; + assert(self.mul_mod(val, result as Field) == 1, "Inverse verification failed"); + result as Field + } +} + +// ------------------------------ TESTS ------------------------------ + +#[test] +fn test_u64_reduce_mod_already_reduced() { + let m = ModU64::new(100); + assert(m.reduce_mod(42) == 42); +} + +#[test] +fn test_u64_reduce_mod_needs_reduction() { + let m = ModU64::new(100); + assert(m.reduce_mod(250) == 50); +} + +#[test] +fn test_u64_reduce_mod_exact_multiple() { + let m = ModU64::new(100); + assert(m.reduce_mod(300) == 0); +} + +#[test] +fn test_u64_add_no_overflow() { + let m = ModU64::new(100); + assert(m.add(30, 40) == 70); +} + +#[test] +fn test_u64_add_with_overflow() { + let m = ModU64::new(100); + assert(m.add(60, 50) == 10); +} + +#[test] +fn test_u64_add_exact_modulus() { + let m = ModU64::new(100); + assert(m.add(50, 50) == 0); +} + +#[test] +fn test_u64_add_with_zero() { + let m = ModU64::new(100); + assert(m.add(42, 0) == 42); +} + +#[test] +fn test_u64_sub_no_underflow() { + let m = ModU64::new(100); + assert(m.sub(50, 30) == 20); +} + +#[test] +fn test_u64_sub_with_underflow() { + let m = ModU64::new(100); + assert(m.sub(30, 50) == 80); // (30 - 50 + 100) mod 100 = 80 +} + +#[test] +fn test_u64_sub_equal_values() { + let m = ModU64::new(100); + assert(m.sub(42, 42) == 0); +} + +#[test] +fn test_u64_sub_zero() { + let m = ModU64::new(100); + assert(m.sub(42, 0) == 42); +} + +#[test] +fn test_u64_mul_mod_small_values() { + let m = ModU64::new(100); + assert(m.mul_mod(6, 7) == 42); +} + +#[test] +fn test_u64_mul_mod_with_reduction() { + let m = ModU64::new(100); + assert(m.mul_mod(12, 15) == 80); // 180 mod 100 +} + +#[test] +fn test_u64_mul_mod_result_zero() { + let m = ModU64::new(100); + assert(m.mul_mod(5, 20) == 0); // 100 mod 100 +} + +#[test] +fn test_u64_mul_mod_with_zero() { + let m = ModU64::new(100); + assert(m.mul_mod(42, 0) == 0); +} + +#[test] +fn test_u64_mul_mod_prime_modulus() { + let m = ModU64::new(97); + assert(m.mul_mod(42, 13) == 61); // 546 mod 97 +} + +#[test] +fn test_u64_neg_nonzero() { + let m = ModU64::new(100); + assert(m.neg(30) == 70); +} + +#[test] +fn test_u64_neg_zero() { + let m = ModU64::new(100); + assert(m.neg(0) == 0); +} + +#[test] +fn test_u64_neg_large_modulus() { + let m = ModU64::new(1000000); + assert(m.neg(12345) == 987655); +} + +#[test] +fn test_u64_inv_mod_simple() { + let m = ModU64::new(11); + let result = m.inv_mod(3); + assert(result == 4); // 3*4 = 12 = 1 mod 11 + assert(m.mul_mod(3, result) == 1); +} + +#[test] +fn test_u64_inv_mod_prime() { + let m = ModU64::new(13); + let result = m.inv_mod(7); + assert(m.mul_mod(7, result) == 1); +} + +#[test] +fn test_u64_inv_mod_coprime() { + let m = ModU64::new(23); + let result = m.inv_mod(9); + assert(m.mul_mod(9, result) == 1); +} + +#[test] +fn test_u64_div_mod_simple() { + let m = ModU64::new(11); + assert(m.div_mod(6, 2) == 3); +} + +#[test] +fn test_u64_div_mod_with_inverse() { + let m = ModU64::new(11); + let result = m.div_mod(7, 3); + // 3^(-1) mod 11 = 4; 7*4 = 28 = 6 mod 11 + assert(result == 6); + assert(m.mul_mod(result, 3) == 7); +} + +#[test] +fn test_u64_div_mod_larger() { + let m = ModU64::new(97); + let result = m.div_mod(35, 7); + assert(m.mul_mod(result, 7) == m.reduce_mod(35)); +} + +#[test] +fn test_u64_field_properties_prime_modulus() { + let m = ModU64::new(97); + let a = 42; + let b = 13; + + assert(m.add(a, b) == 55); + assert(m.sub(a, b) == 29); + assert(m.mul_mod(a, b) == 61); + + let inv = m.inv_mod(b); + assert(m.mul_mod(b, inv) == 1); + + let quot = m.div_mod(a, b); + assert(m.mul_mod(quot, b) == a); +} + +#[test] +fn test_u64_additive_inverse() { + let m = ModU64::new(97); + let a = 42; + let neg_a = m.neg(a); + assert(m.add(a, neg_a) == 0); +} + +#[test] +fn test_u64_additive_identity() { + let m = ModU64::new(100); + assert(m.add(42, 0) == 42); +} + +#[test] +fn test_u64_multiplicative_identity() { + let m = ModU64::new(100); + assert(m.mul_mod(42, 1) == 42); +} + +#[test] +fn test_u64_commutativity_add() { + let m = ModU64::new(100); + assert(m.add(35, 47) == m.add(47, 35)); +} + +#[test] +fn test_u64_commutativity_mul() { + let m = ModU64::new(100); + assert(m.mul_mod(7, 9) == m.mul_mod(9, 7)); +} + +#[test] +fn test_u64_inverse_of_inverse() { + let m = ModU64::new(11); + let a = 7; + assert(m.inv_mod(m.inv_mod(a)) == a); +} + +#[test] +fn test_u64_division_multiplication_inverse() { + let m = ModU64::new(97); + let a = 35; + let b = 7; + let quotient = m.div_mod(a, b); + assert(m.mul_mod(quotient, b) == m.reduce_mod(a)); +} diff --git a/circuits/lib/src/math/modulo/mod.nr b/circuits/lib/src/math/modulo/mod.nr index b0bcfcb012..138c20bbd1 100644 --- a/circuits/lib/src/math/modulo/mod.nr +++ b/circuits/lib/src/math/modulo/mod.nr @@ -6,3 +6,5 @@ pub mod unconstrained_U128; pub mod U128; +pub mod unconstrained_U64; +pub mod U64; diff --git a/circuits/lib/src/math/modulo/unconstrained_U128.nr b/circuits/lib/src/math/modulo/unconstrained_U128.nr index 52a812cb85..e71ae9db7a 100644 --- a/circuits/lib/src/math/modulo/unconstrained_U128.nr +++ b/circuits/lib/src/math/modulo/unconstrained_U128.nr @@ -135,6 +135,20 @@ pub unconstrained fn __mul_with_quotient(lhs: Field, rhs: Field, m: Field) -> (F __compute_mod_reduction(product, m) } +/// Multiplies lhs and rhs via u128 arithmetic, returning (quotient, remainder). +/// +/// Safe when lhs, rhs < 2^62: product < 2^124, fits in u128 without wrapping. +/// Prefer this over `__mul_with_quotient` when inputs are known to be < 2^62 (i.e. when +/// the modulus is < 2^62), as it avoids silent Field-prime wraparound. +/// +/// # Safety +/// This is an unconstrained function. The result must be verified in constrained code. +pub unconstrained fn __mul_with_quotient_u128(lhs: Field, rhs: Field, m: Field) -> (Field, Field) { + let product = lhs as u128 * rhs as u128; // safe: inputs < 2^62, product < 2^124 + let q = m as u128; + ((product / q) as Field, (product % q) as Field) +} + /// Computes the modular multiplicative inverse using Fermat's Little Theorem (unconstrained). /// /// For a prime modulus `m` and value `val` coprime to `m`, computes `val^(-1) mod m` diff --git a/circuits/lib/src/math/modulo/unconstrained_U64.nr b/circuits/lib/src/math/modulo/unconstrained_U64.nr new file mode 100644 index 0000000000..d27c183a0c --- /dev/null +++ b/circuits/lib/src/math/modulo/unconstrained_U64.nr @@ -0,0 +1,122 @@ +// SPDX-License-Identifier: LGPL-3.0-only +// +// This file is provided WITHOUT ANY WARRANTY; +// without even the implied warranty of MERCHANTABILITY +// or FITNESS FOR A PARTICULAR PURPOSE. + +//! Unconstrained witnesses for 62-bit modular arithmetic. +//! +//! Moduli must be < 2^62; inputs are assumed already reduced (< m). +//! Intermediate products of two 62-bit values are at most 124 bits, safe in u128. + +/// Returns floor(n / m). +/// +/// n may be a large Field (e.g. lhs*rhs before reduction); cast to u128 for safe division. +pub unconstrained fn __reduce_witness_u64(n: Field, m: u64) -> u64 { + (n as u128 / m as u128) as u64 +} + +/// Returns floor(a*b / m) for use in `mul_mod`. +/// +/// Safe because a, b < m < 2^62, so a*b < 2^124 fits in u128 without wrapping. +pub unconstrained fn __mul_mod_witness_u64(a: Field, b: Field, m: u64) -> u64 { + ((a as u128 * b as u128) / m as u128) as u64 +} + +/// Returns (result, underflow) for (lhs - rhs) mod m. +/// +/// Inputs must be in [0, m). +pub unconstrained fn __sub_with_underflow_u64(lhs: Field, rhs: Field, m: u64) -> (u64, bool) { + let l = lhs as u64; + let r = rhs as u64; + let underflow = l < r; + let result = if underflow { m - (r - l) } else { l - r }; + (result, underflow) +} + +/// Returns (-val) mod m. +pub unconstrained fn __neg_u64(val: Field, m: u64) -> u64 { + if val == 0 { 0 } else { m - val as u64 } +} + +/// Square-and-multiply modular exponentiation using u128 arithmetic. +pub unconstrained fn __pow_mod_u64(base: u64, exp: u64, m: u64) -> u64 { + let mut result: u128 = 1; + let mut b: u128 = base as u128 % m as u128; + let mut e: u128 = exp as u128; + let q = m as u128; + while e > 0 { + if (e % 2) == 1 { + result = result * b % q; + } + b = b * b % q; + e /= 2; + } + result as u64 +} + +/// Returns val^(-1) mod m via Fermat's Little Theorem (m must be prime). +pub unconstrained fn __inv_mod_u64(val: Field, m: u64) -> u64 { + __pow_mod_u64(val as u64, m - 2, m) +} + +// ------------------------------ TESTS ------------------------------ + +#[test] +fn test_reduce_witness_u64_basic() { + let result = unsafe { __reduce_witness_u64(250, 100) }; + assert(result == 2); +} + +#[test] +fn test_reduce_witness_u64_exact() { + let result = unsafe { __reduce_witness_u64(300, 100) }; + assert(result == 3); +} + +#[test] +fn test_mul_mod_witness_u64() { + // 12 * 15 = 180; floor(180 / 100) = 1 + let result = unsafe { __mul_mod_witness_u64(12, 15, 100) }; + assert(result == 1); +} + +#[test] +fn test_sub_with_underflow_u64_no_underflow() { + let (res, underflow) = unsafe { __sub_with_underflow_u64(50, 30, 100) }; + assert(res == 20); + assert(!underflow); +} + +#[test] +fn test_sub_with_underflow_u64_underflow() { + let (res, underflow) = unsafe { __sub_with_underflow_u64(30, 50, 100) }; + assert(res == 80); // 30 - 50 + 100 + assert(underflow); +} + +#[test] +fn test_neg_u64_nonzero() { + let result = unsafe { __neg_u64(30, 100) }; + assert(result == 70); +} + +#[test] +fn test_neg_u64_zero() { + let result = unsafe { __neg_u64(0, 100) }; + assert(result == 0); +} + +#[test] +fn test_inv_mod_u64_simple() { + // 3^(-1) mod 11 = 4 (since 3*4 = 12 = 1 mod 11) + let result = unsafe { __inv_mod_u64(3, 11) }; + assert(result == 4); +} + +#[test] +fn test_pow_mod_u64() { + // 2^10 mod 97 = 1024 mod 97 = 927 % 97 = 927 - 9*97 = 927 - 873 = 54 + let result = unsafe { __pow_mod_u64(2, 10, 97) }; + assert(result == 54); +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8def581314..3721f96f2c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -344,7 +344,7 @@ importers: version: 5.8.3 viem: specifier: 2.38.6 - version: 2.38.6(bufferutil@4.0.9)(typescript@5.8.3)(utf-8-validate@5.0.10)(zod@4.1.12) + version: 2.38.6(bufferutil@4.0.9)(typescript@5.8.3)(utf-8-validate@5.0.10)(zod@3.25.76) examples/CRISP/packages/crisp-sdk: dependencies: @@ -535,7 +535,7 @@ importers: version: 3.0.11(bufferutil@4.0.9)(utf-8-validate@5.0.10) hardhat-gas-reporter: specifier: ^2.2.0 - version: 2.3.0(bufferutil@4.0.9)(hardhat@3.0.11(bufferutil@4.0.9)(utf-8-validate@5.0.10))(typescript@5.8.3)(utf-8-validate@5.0.10)(zod@3.25.76) + version: 2.3.0(bufferutil@4.0.9)(hardhat@3.0.11(bufferutil@4.0.9)(utf-8-validate@5.0.10))(typescript@5.8.3)(utf-8-validate@5.0.10) lodash: specifier: ^4.17.21 version: 4.17.21 @@ -762,7 +762,7 @@ importers: version: 5.3.0 '@risc0/ethereum': specifier: file:lib/risc0-ethereum - version: file:templates/default/lib/risc0-ethereum + version: risc0-ethereum@file:templates/default/lib/risc0-ethereum '@types/chai': specifier: ^4.2.0 version: 4.3.20 @@ -3134,9 +3134,6 @@ packages: '@reown/appkit@1.7.8': resolution: {integrity: sha512-51kTleozhA618T1UvMghkhKfaPcc9JlKwLJ5uV+riHyvSoWPKPRIa5A6M1Wano5puNyW0s3fwywhyqTHSilkaA==} - '@risc0/ethereum@file:templates/default/lib/risc0-ethereum': - resolution: {directory: templates/default/lib/risc0-ethereum, type: directory} - '@rolldown/pluginutils@1.0.0-beta.27': resolution: {integrity: sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==} @@ -8820,6 +8817,9 @@ packages: resolution: {integrity: sha512-5Di9UC0+8h1L6ZD2d7awM7E/T4uA1fJRlx6zk/NvdCCVEoAnFqvHmCuNeIKoCeIixBX/q8uM+6ycDvF8woqosA==} engines: {node: '>= 0.8'} + risc0-ethereum@file:templates/default/lib/risc0-ethereum: + resolution: {directory: templates/default/lib/risc0-ethereum, type: directory} + robust-predicates@3.0.2: resolution: {integrity: sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg==} @@ -10326,11 +10326,11 @@ snapshots: '@babel/helpers': 7.28.4 '@babel/parser': 7.28.5 '@babel/template': 7.27.2 - '@babel/traverse': 7.28.5(supports-color@5.5.0) + '@babel/traverse': 7.28.5 '@babel/types': 7.28.5 '@jridgewell/remapping': 2.3.5 convert-source-map: 2.0.0 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -10371,7 +10371,7 @@ snapshots: '@babel/helper-optimise-call-expression': 7.27.1 '@babel/helper-replace-supers': 7.27.1(@babel/core@7.28.5) '@babel/helper-skip-transparent-expression-wrappers': 7.27.1 - '@babel/traverse': 7.28.5(supports-color@5.5.0) + '@babel/traverse': 7.28.5 semver: 6.3.1 transitivePeerDependencies: - supports-color @@ -10388,7 +10388,7 @@ snapshots: '@babel/core': 7.28.5 '@babel/helper-compilation-targets': 7.27.2 '@babel/helper-plugin-utils': 7.27.1 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) lodash.debounce: 4.0.8 resolve: 1.22.11 transitivePeerDependencies: @@ -10411,7 +10411,14 @@ snapshots: '@babel/helper-member-expression-to-functions@7.28.5': dependencies: - '@babel/traverse': 7.28.5(supports-color@5.5.0) + '@babel/traverse': 7.28.5 + '@babel/types': 7.28.5 + transitivePeerDependencies: + - supports-color + + '@babel/helper-module-imports@7.27.1': + dependencies: + '@babel/traverse': 7.28.5 '@babel/types': 7.28.5 transitivePeerDependencies: - supports-color @@ -10426,9 +10433,9 @@ snapshots: '@babel/helper-module-transforms@7.28.3(@babel/core@7.28.5)': dependencies: '@babel/core': 7.28.5 - '@babel/helper-module-imports': 7.27.1(supports-color@5.5.0) + '@babel/helper-module-imports': 7.27.1 '@babel/helper-validator-identifier': 7.28.5 - '@babel/traverse': 7.28.5(supports-color@5.5.0) + '@babel/traverse': 7.28.5 transitivePeerDependencies: - supports-color @@ -10443,7 +10450,7 @@ snapshots: '@babel/core': 7.28.5 '@babel/helper-annotate-as-pure': 7.27.3 '@babel/helper-wrap-function': 7.28.3 - '@babel/traverse': 7.28.5(supports-color@5.5.0) + '@babel/traverse': 7.28.5 transitivePeerDependencies: - supports-color @@ -10452,13 +10459,13 @@ snapshots: '@babel/core': 7.28.5 '@babel/helper-member-expression-to-functions': 7.28.5 '@babel/helper-optimise-call-expression': 7.27.1 - '@babel/traverse': 7.28.5(supports-color@5.5.0) + '@babel/traverse': 7.28.5 transitivePeerDependencies: - supports-color '@babel/helper-skip-transparent-expression-wrappers@7.27.1': dependencies: - '@babel/traverse': 7.28.5(supports-color@5.5.0) + '@babel/traverse': 7.28.5 '@babel/types': 7.28.5 transitivePeerDependencies: - supports-color @@ -10476,7 +10483,7 @@ snapshots: '@babel/helper-wrap-function@7.28.3': dependencies: '@babel/template': 7.27.2 - '@babel/traverse': 7.28.5(supports-color@5.5.0) + '@babel/traverse': 7.28.5 '@babel/types': 7.28.5 transitivePeerDependencies: - supports-color @@ -10494,7 +10501,7 @@ snapshots: dependencies: '@babel/core': 7.28.5 '@babel/helper-plugin-utils': 7.27.1 - '@babel/traverse': 7.28.5(supports-color@5.5.0) + '@babel/traverse': 7.28.5 transitivePeerDependencies: - supports-color @@ -10521,7 +10528,7 @@ snapshots: dependencies: '@babel/core': 7.28.5 '@babel/helper-plugin-utils': 7.27.1 - '@babel/traverse': 7.28.5(supports-color@5.5.0) + '@babel/traverse': 7.28.5 transitivePeerDependencies: - supports-color @@ -10565,14 +10572,14 @@ snapshots: '@babel/core': 7.28.5 '@babel/helper-plugin-utils': 7.27.1 '@babel/helper-remap-async-to-generator': 7.27.1(@babel/core@7.28.5) - '@babel/traverse': 7.28.5(supports-color@5.5.0) + '@babel/traverse': 7.28.5 transitivePeerDependencies: - supports-color '@babel/plugin-transform-async-to-generator@7.27.1(@babel/core@7.28.5)': dependencies: '@babel/core': 7.28.5 - '@babel/helper-module-imports': 7.27.1(supports-color@5.5.0) + '@babel/helper-module-imports': 7.27.1 '@babel/helper-plugin-utils': 7.27.1 '@babel/helper-remap-async-to-generator': 7.27.1(@babel/core@7.28.5) transitivePeerDependencies: @@ -10612,7 +10619,7 @@ snapshots: '@babel/helper-globals': 7.28.0 '@babel/helper-plugin-utils': 7.27.1 '@babel/helper-replace-supers': 7.27.1(@babel/core@7.28.5) - '@babel/traverse': 7.28.5(supports-color@5.5.0) + '@babel/traverse': 7.28.5 transitivePeerDependencies: - supports-color @@ -10626,7 +10633,7 @@ snapshots: dependencies: '@babel/core': 7.28.5 '@babel/helper-plugin-utils': 7.27.1 - '@babel/traverse': 7.28.5(supports-color@5.5.0) + '@babel/traverse': 7.28.5 transitivePeerDependencies: - supports-color @@ -10683,7 +10690,7 @@ snapshots: '@babel/core': 7.28.5 '@babel/helper-compilation-targets': 7.27.2 '@babel/helper-plugin-utils': 7.27.1 - '@babel/traverse': 7.28.5(supports-color@5.5.0) + '@babel/traverse': 7.28.5 transitivePeerDependencies: - supports-color @@ -10729,7 +10736,7 @@ snapshots: '@babel/helper-module-transforms': 7.28.3(@babel/core@7.28.5) '@babel/helper-plugin-utils': 7.27.1 '@babel/helper-validator-identifier': 7.28.5 - '@babel/traverse': 7.28.5(supports-color@5.5.0) + '@babel/traverse': 7.28.5 transitivePeerDependencies: - supports-color @@ -10769,7 +10776,7 @@ snapshots: '@babel/helper-plugin-utils': 7.27.1 '@babel/plugin-transform-destructuring': 7.28.5(@babel/core@7.28.5) '@babel/plugin-transform-parameters': 7.27.7(@babel/core@7.28.5) - '@babel/traverse': 7.28.5(supports-color@5.5.0) + '@babel/traverse': 7.28.5 transitivePeerDependencies: - supports-color @@ -10852,7 +10859,7 @@ snapshots: dependencies: '@babel/core': 7.28.5 '@babel/helper-annotate-as-pure': 7.27.3 - '@babel/helper-module-imports': 7.27.1(supports-color@5.5.0) + '@babel/helper-module-imports': 7.27.1 '@babel/helper-plugin-utils': 7.27.1 '@babel/plugin-syntax-jsx': 7.27.1(@babel/core@7.28.5) '@babel/types': 7.28.5 @@ -11067,11 +11074,23 @@ snapshots: '@babel/helper-split-export-declaration': 7.24.7 '@babel/parser': 7.28.5 '@babel/types': 7.28.5 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) globals: 11.12.0 transitivePeerDependencies: - supports-color + '@babel/traverse@7.28.5': + dependencies: + '@babel/code-frame': 7.27.1 + '@babel/generator': 7.28.5 + '@babel/helper-globals': 7.28.0 + '@babel/parser': 7.28.5 + '@babel/template': 7.27.2 + '@babel/types': 7.28.5 + debug: 4.4.3(supports-color@8.1.1) + transitivePeerDependencies: + - supports-color + '@babel/traverse@7.28.5(supports-color@5.5.0)': dependencies: '@babel/code-frame': 7.27.1 @@ -11273,7 +11292,7 @@ snapshots: '@emotion/babel-plugin@11.13.5': dependencies: - '@babel/helper-module-imports': 7.27.1(supports-color@5.5.0) + '@babel/helper-module-imports': 7.27.1 '@babel/runtime': 7.28.4 '@emotion/hash': 0.9.2 '@emotion/memoize': 0.9.0 @@ -11593,7 +11612,7 @@ snapshots: '@eslint/config-array@0.21.1': dependencies: '@eslint/object-schema': 2.1.7 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -11609,7 +11628,7 @@ snapshots: '@eslint/eslintrc@3.3.1': dependencies: ajv: 6.12.6 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) espree: 10.4.0 globals: 14.0.0 ignore: 5.3.2 @@ -12270,7 +12289,7 @@ snapshots: '@scure/base': 1.2.6 '@types/debug': 4.1.12 '@types/lodash': 4.17.20 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) lodash: 4.17.21 pony-cause: 2.1.11 semver: 7.7.3 @@ -12282,7 +12301,7 @@ snapshots: dependencies: '@ethereumjs/tx': 4.2.0 '@types/debug': 4.1.12 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) semver: 7.7.3 superstruct: 1.0.4 transitivePeerDependencies: @@ -12295,7 +12314,7 @@ snapshots: '@noble/hashes': 1.8.0 '@scure/base': 1.2.6 '@types/debug': 4.1.12 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) pony-cause: 2.1.11 semver: 7.7.3 uuid: 9.0.1 @@ -12309,7 +12328,7 @@ snapshots: '@noble/hashes': 1.8.0 '@scure/base': 1.2.6 '@types/debug': 4.1.12 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) pony-cause: 2.1.11 semver: 7.7.3 uuid: 9.0.1 @@ -12711,7 +12730,7 @@ snapshots: dependencies: '@nomicfoundation/hardhat-errors': 3.0.3 '@nomicfoundation/hardhat-utils': 3.0.5 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) ethereum-cryptography: 2.2.1 ethers: 6.15.0(bufferutil@4.0.9)(utf-8-validate@5.0.10) hardhat: 3.0.11(bufferutil@4.0.9)(utf-8-validate@5.0.10) @@ -12740,7 +12759,7 @@ snapshots: '@nomicfoundation/ignition-core': 3.0.4(bufferutil@4.0.9)(utf-8-validate@5.0.10) '@nomicfoundation/ignition-ui': 3.0.4 chalk: 5.6.2 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) hardhat: 3.0.11(bufferutil@4.0.9)(utf-8-validate@5.0.10) json5: 2.2.3 prompts: 2.4.2 @@ -12757,7 +12776,7 @@ snapshots: '@nomicfoundation/hardhat-utils': 3.0.5 '@nomicfoundation/hardhat-zod-utils': 3.0.1(zod@3.25.76) chalk: 5.6.2 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) hardhat: 3.0.11(bufferutil@4.0.9)(utf-8-validate@5.0.10) zod: 3.25.76 transitivePeerDependencies: @@ -12860,7 +12879,7 @@ snapshots: '@nomicfoundation/hardhat-utils': 3.0.5 '@nomicfoundation/hardhat-zod-utils': 3.0.1(zod@3.25.76) '@typechain/ethers-v6': 0.5.1(ethers@6.15.0(bufferutil@4.0.9)(utf-8-validate@5.0.10))(typechain@8.3.2(typescript@5.8.3))(typescript@5.8.3) - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) ethers: 6.15.0(bufferutil@4.0.9)(utf-8-validate@5.0.10) hardhat: 3.0.11(bufferutil@4.0.9)(utf-8-validate@5.0.10) typechain: 8.3.2(typescript@5.8.3) @@ -12872,7 +12891,7 @@ snapshots: '@nomicfoundation/hardhat-utils@3.0.5': dependencies: '@streamparser/json-node': 0.0.22 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) env-paths: 2.2.1 ethereum-cryptography: 2.2.1 fast-equals: 5.3.2 @@ -12890,7 +12909,7 @@ snapshots: '@nomicfoundation/hardhat-zod-utils': 3.0.1(zod@3.25.76) cbor2: 1.12.0 chalk: 5.6.2 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) hardhat: 3.0.11(bufferutil@4.0.9)(utf-8-validate@5.0.10) semver: 7.7.3 zod: 3.25.76 @@ -12912,7 +12931,7 @@ snapshots: '@nomicfoundation/hardhat-utils': 3.0.5 '@nomicfoundation/solidity-analyzer': 0.1.2 cbor2: 1.12.0 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) ethers: 6.15.0(bufferutil@4.0.9)(utf-8-validate@5.0.10) immer: 10.0.2 lodash-es: 4.17.21 @@ -13256,8 +13275,6 @@ snapshots: - utf-8-validate - zod - '@risc0/ethereum@file:templates/default/lib/risc0-ethereum': {} - '@rolldown/pluginutils@1.0.0-beta.27': {} '@rollup/plugin-inject@5.0.5(rollup@4.52.5)': @@ -14132,7 +14149,7 @@ snapshots: '@depay/web3-mock-evm': 14.19.1(bufferutil@4.0.9)(utf-8-validate@5.0.10) '@playwright/test': 1.52.0 '@synthetixio/synpress-core': 0.0.13(@playwright/test@1.52.0) - viem: 2.38.6(bufferutil@4.0.9)(typescript@5.8.3)(utf-8-validate@5.0.10)(zod@3.22.4) + viem: 2.38.6(bufferutil@4.0.9)(typescript@5.8.3)(utf-8-validate@5.0.10) transitivePeerDependencies: - '@depay/solana-web3.js' - '@depay/web3-blockchains' @@ -14604,7 +14621,7 @@ snapshots: '@typescript-eslint/types': 7.18.0 '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.8.3) '@typescript-eslint/visitor-keys': 7.18.0 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) eslint: 9.39.1(jiti@1.21.7) optionalDependencies: typescript: 5.8.3 @@ -14617,7 +14634,7 @@ snapshots: '@typescript-eslint/types': 8.47.0 '@typescript-eslint/typescript-estree': 8.47.0(typescript@5.8.3) '@typescript-eslint/visitor-keys': 8.47.0 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) eslint: 9.39.1(jiti@1.21.7) typescript: 5.8.3 transitivePeerDependencies: @@ -14627,7 +14644,7 @@ snapshots: dependencies: '@typescript-eslint/tsconfig-utils': 8.47.0(typescript@5.8.3) '@typescript-eslint/types': 8.47.0 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) typescript: 5.8.3 transitivePeerDependencies: - supports-color @@ -14650,7 +14667,7 @@ snapshots: dependencies: '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.8.3) '@typescript-eslint/utils': 7.18.0(eslint@9.39.1(jiti@1.21.7))(typescript@5.8.3) - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) eslint: 9.39.1(jiti@1.21.7) ts-api-utils: 1.4.3(typescript@5.8.3) optionalDependencies: @@ -14663,7 +14680,7 @@ snapshots: '@typescript-eslint/types': 8.47.0 '@typescript-eslint/typescript-estree': 8.47.0(typescript@5.8.3) '@typescript-eslint/utils': 8.47.0(eslint@9.39.1(jiti@1.21.7))(typescript@5.8.3) - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) eslint: 9.39.1(jiti@1.21.7) ts-api-utils: 2.1.0(typescript@5.8.3) typescript: 5.8.3 @@ -14678,7 +14695,7 @@ snapshots: dependencies: '@typescript-eslint/types': 7.18.0 '@typescript-eslint/visitor-keys': 7.18.0 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) globby: 11.1.0 is-glob: 4.0.3 minimatch: 9.0.5 @@ -14695,7 +14712,7 @@ snapshots: '@typescript-eslint/tsconfig-utils': 8.47.0(typescript@5.8.3) '@typescript-eslint/types': 8.47.0 '@typescript-eslint/visitor-keys': 8.47.0 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) fast-glob: 3.3.3 is-glob: 4.0.3 minimatch: 9.0.5 @@ -15893,7 +15910,7 @@ snapshots: dependencies: bytes: 3.1.2 content-type: 1.0.5 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) http-errors: 2.0.0 iconv-lite: 0.6.3 on-finished: 2.4.1 @@ -15907,7 +15924,7 @@ snapshots: dependencies: bytes: 3.1.2 content-type: 1.0.5 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) http-errors: 2.0.0 iconv-lite: 0.7.0 on-finished: 2.4.1 @@ -17162,7 +17179,7 @@ snapshots: ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.6 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) escape-string-regexp: 4.0.0 eslint-scope: 8.4.0 eslint-visitor-keys: 4.2.1 @@ -17445,7 +17462,7 @@ snapshots: content-type: 1.0.5 cookie: 0.7.2 cookie-signature: 1.2.2 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) encodeurl: 2.0.0 escape-html: 1.0.3 etag: 1.8.1 @@ -17477,7 +17494,7 @@ snapshots: content-type: 1.0.5 cookie: 0.7.2 cookie-signature: 1.2.2 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) depd: 2.0.0 encodeurl: 2.0.0 escape-html: 1.0.3 @@ -17591,7 +17608,7 @@ snapshots: finalhandler@2.1.0: dependencies: - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) encodeurl: 2.0.0 escape-html: 1.0.3 on-finished: 2.4.1 @@ -17647,7 +17664,7 @@ snapshots: follow-redirects@1.15.11(debug@4.4.3): optionalDependencies: - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) for-each@0.3.5: dependencies: @@ -18010,7 +18027,7 @@ snapshots: axios: 0.21.4(debug@4.4.3) chalk: 4.1.2 chokidar: 3.6.0 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) enquirer: 2.4.1 ethers: 5.8.0(bufferutil@4.0.9)(utf-8-validate@5.0.10) form-data: 4.0.4 @@ -18036,7 +18053,7 @@ snapshots: - debug - utf-8-validate - hardhat-gas-reporter@2.3.0(bufferutil@4.0.9)(hardhat@3.0.11(bufferutil@4.0.9)(utf-8-validate@5.0.10))(typescript@5.8.3)(utf-8-validate@5.0.10)(zod@3.25.76): + hardhat-gas-reporter@2.3.0(bufferutil@4.0.9)(hardhat@3.0.11(bufferutil@4.0.9)(utf-8-validate@5.0.10))(typescript@5.8.3)(utf-8-validate@5.0.10): dependencies: '@ethersproject/abi': 5.8.0 '@ethersproject/bytes': 5.8.0 @@ -18053,7 +18070,7 @@ snapshots: lodash: 4.17.21 markdown-table: 2.0.0 sha1: 1.1.1 - viem: 2.38.6(bufferutil@4.0.9)(typescript@5.8.3)(utf-8-validate@5.0.10)(zod@3.25.76) + viem: 2.38.6(bufferutil@4.0.9)(typescript@5.8.3)(utf-8-validate@5.0.10) transitivePeerDependencies: - bufferutil - debug @@ -18072,7 +18089,7 @@ snapshots: adm-zip: 0.4.16 chalk: 5.6.2 chokidar: 4.0.3 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) enquirer: 2.4.1 ethereum-cryptography: 2.2.1 micro-eth-signer: 0.14.0 @@ -18098,7 +18115,7 @@ snapshots: adm-zip: 0.4.16 chalk: 5.6.2 chokidar: 4.0.3 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) enquirer: 2.4.1 ethereum-cryptography: 2.2.1 micro-eth-signer: 0.14.0 @@ -18756,7 +18773,7 @@ snapshots: dependencies: chalk: 5.6.2 commander: 13.1.0 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) execa: 8.0.1 lilconfig: 3.1.3 listr2: 8.3.3 @@ -19587,7 +19604,7 @@ snapshots: micromark@3.2.0: dependencies: '@types/debug': 4.1.12 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) decode-named-character-reference: 1.2.0 micromark-core-commonmark: 1.1.0 micromark-factory-space: 1.1.0 @@ -19609,7 +19626,7 @@ snapshots: micromark@4.0.2: dependencies: '@types/debug': 4.1.12 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) decode-named-character-reference: 1.2.0 devlop: 1.1.0 micromark-core-commonmark: 2.0.3 @@ -20121,6 +20138,21 @@ snapshots: transitivePeerDependencies: - zod + ox@0.9.6(typescript@5.8.3): + dependencies: + '@adraffy/ens-normalize': 1.11.1 + '@noble/ciphers': 1.3.0 + '@noble/curves': 1.9.1 + '@noble/hashes': 1.8.0 + '@scure/bip32': 1.7.0 + '@scure/bip39': 1.6.0 + abitype: 1.1.1(typescript@5.8.3)(zod@3.25.76) + eventemitter3: 5.0.1 + optionalDependencies: + typescript: 5.8.3 + transitivePeerDependencies: + - zod + ox@0.9.6(typescript@5.8.3)(zod@3.22.4): dependencies: '@adraffy/ens-normalize': 1.11.1 @@ -20968,6 +21000,8 @@ snapshots: hash-base: 3.1.2 inherits: 2.0.4 + risc0-ethereum@file:templates/default/lib/risc0-ethereum: {} + robust-predicates@3.0.2: {} rollup@4.52.5: @@ -21000,7 +21034,7 @@ snapshots: router@2.2.0: dependencies: - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) depd: 2.0.0 is-promise: 4.0.0 parseurl: 1.3.3 @@ -21091,7 +21125,7 @@ snapshots: send@1.2.0: dependencies: - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) encodeurl: 2.0.0 escape-html: 1.0.3 etag: 1.8.1 @@ -21813,7 +21847,7 @@ snapshots: cac: 6.7.14 chokidar: 4.0.3 consola: 3.4.2 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) esbuild: 0.25.12 fix-dts-default-cjs-exports: 1.0.1 joycon: 3.1.1 @@ -21867,7 +21901,7 @@ snapshots: typechain@8.3.2(typescript@5.8.3): dependencies: '@types/prettier': 2.7.3 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) fs-extra: 7.0.1 glob: 7.1.7 js-sha3: 0.8.0 @@ -22162,6 +22196,23 @@ snapshots: '@types/unist': 3.0.3 vfile-message: 4.0.3 + viem@2.38.6(bufferutil@4.0.9)(typescript@5.8.3)(utf-8-validate@5.0.10): + dependencies: + '@noble/curves': 1.9.1 + '@noble/hashes': 1.8.0 + '@scure/bip32': 1.7.0 + '@scure/bip39': 1.6.0 + abitype: 1.1.0(typescript@5.8.3)(zod@3.25.76) + isows: 1.0.7(ws@8.18.3(bufferutil@4.0.9)(utf-8-validate@5.0.10)) + ox: 0.9.6(typescript@5.8.3) + ws: 8.18.3(bufferutil@4.0.9)(utf-8-validate@5.0.10) + optionalDependencies: + typescript: 5.8.3 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + - zod + viem@2.38.6(bufferutil@4.0.9)(typescript@5.8.3)(utf-8-validate@5.0.10)(zod@3.22.4): dependencies: '@noble/curves': 1.9.1 @@ -22216,7 +22267,7 @@ snapshots: vite-node@1.6.1(@types/node@22.7.5): dependencies: cac: 6.7.14 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) pathe: 1.1.2 picocolors: 1.1.1 vite: 5.4.21(@types/node@22.7.5) @@ -22238,7 +22289,7 @@ snapshots: '@volar/typescript': 2.4.23 '@vue/language-core': 2.2.0(typescript@5.8.3) compare-versions: 6.1.1 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) kolorist: 1.8.0 local-pkg: 1.1.2 magic-string: 0.30.21 @@ -22290,7 +22341,7 @@ snapshots: vite-tsconfig-paths@4.3.2(typescript@5.8.3)(vite@5.4.21(@types/node@22.7.5)): dependencies: - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) globrex: 0.1.2 tsconfck: 3.1.6(typescript@5.8.3) optionalDependencies: @@ -22332,7 +22383,7 @@ snapshots: '@vitest/utils': 1.6.1 acorn-walk: 8.3.4 chai: 4.5.0 - debug: 4.4.3(supports-color@5.5.0) + debug: 4.4.3(supports-color@8.1.1) execa: 8.0.1 local-pkg: 0.5.1 magic-string: 0.30.21 From 1feda8a9f880224db282df6057363fa0ec8fca46 Mon Sep 17 00:00:00 2001 From: Zara Date: Thu, 21 May 2026 18:55:43 -0700 Subject: [PATCH 2/3] chore: apply nargo fmt to circuit files Co-Authored-By: Claude Sonnet 4.6 --- circuits/lib/src/core/dkg/share_computation.nr | 6 +----- circuits/lib/src/core/threshold/share_decryption.nr | 7 ++++++- circuits/lib/src/math/modulo/U64.nr | 3 +-- circuits/lib/src/math/modulo/unconstrained_U64.nr | 6 +++++- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/circuits/lib/src/core/dkg/share_computation.nr b/circuits/lib/src/core/dkg/share_computation.nr index 1bac4e2527..ad904beda5 100644 --- a/circuits/lib/src/core/dkg/share_computation.nr +++ b/circuits/lib/src/core/dkg/share_computation.nr @@ -195,11 +195,7 @@ impl (half as u64) { - c - q - } else { - c - }; + let centered = if (c as u64) > (half as u64) { c - q } else { c }; coeffs[i] = centered; } normalized[j] = Polynomial::new(coeffs); diff --git a/circuits/lib/src/core/threshold/share_decryption.nr b/circuits/lib/src/core/threshold/share_decryption.nr index f2cb08111c..9772a1dc1c 100644 --- a/circuits/lib/src/core/threshold/share_decryption.nr +++ b/circuits/lib/src/core/threshold/share_decryption.nr @@ -311,7 +311,12 @@ impl /// Returns (-val) mod m. pub unconstrained fn __neg_u64(val: Field, m: u64) -> u64 { - if val == 0 { 0 } else { m - val as u64 } + if val == 0 { + 0 + } else { + m - val as u64 + } } /// Square-and-multiply modular exponentiation using u128 arithmetic. From ddabd13e7feb3a55eddddb95c8840e8427ec4d83 Mon Sep 17 00:00:00 2001 From: Zara Date: Thu, 21 May 2026 19:53:53 -0700 Subject: [PATCH 3/3] fixed the default --- circuits/lib/src/configs/default/mod.nr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/circuits/lib/src/configs/default/mod.nr b/circuits/lib/src/configs/default/mod.nr index ac3bdbed42..f29df7cd84 100644 --- a/circuits/lib/src/configs/default/mod.nr +++ b/circuits/lib/src/configs/default/mod.nr @@ -7,8 +7,8 @@ // Auto-generated by build-circuits.ts for preset: insecure-512 pub use super::committee::micro::{H, N_PARTIES, T}; -pub use super::secure::dkg; -pub use super::secure::threshold; +pub use super::insecure::dkg; +pub use super::insecure::threshold; /// Max number of non-zero coefficients in the message polynomial. /// This is a conservative estimate that should be okay for most use cases.