Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,7 @@ jobs:
- run: pnpm install --frozen-lockfile
- run: pnpm check:crypto-config
- run: pnpm test:circuit-tooling
- run: python3 scripts/circuits/qualification_guard_test.py

build_circuits:
needs: [detect_changes]
Expand Down Expand Up @@ -1297,6 +1298,18 @@ jobs:
if: matrix.leg == 'sync-dkg-proofs'
run: E3_CUSTOM_BB=$(command -v bb) pnpm test:sync-decryption:contract

- name: Rebuild the secure Minimum C7 recursive key
if: matrix.leg == 'sync-dkg-proofs'
working-directory: circuits/bin/synchronized_secure/threshold/decrypted_shares_aggregation
run: |
manifest="$GITHUB_WORKSPACE/circuits/qualification/sync-secure-8192/minimum/manifest.json"
key=$(jq -ce '.circuits[] | select(.role == "decrypted_shares_aggregation" and .target == "noir-recursive")' "$manifest")
nargo compile
out=$(mktemp -d)
bb write_vk -t noir-recursive -b target/decrypted_shares_aggregation.json -o "$out"
echo "$(jq -er .vkSha256 <<< "$key") $out/vk" | sha256sum --check
test "0x$(xxd -p -c 32 "$out/vk_hash")" = "$(jq -er .vkHash <<< "$key")"

- name: Install Anvil for recovered synchronized publication
if: matrix.leg == 'sync-dkg-recovery'
uses: foundry-rs/foundry-toolchain@908c540300062bd5a7e473851cdb4282204cee09 # v1
Expand Down
31 changes: 31 additions & 0 deletions circuits/benchmarks/synchronized-decryption.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Synchronized decryption qualification — 2026-11-19

One level-zero ciphertext, Minimum `N=3, T=1, H=2`, designated zero-based IDs `[0,2]`. The two
owners use the pinned `fhe.rs` v0.6.0 native shares, directed keys and local noise draws. C7 checks
the same 50 plaintext coefficients as native reconstruction. The final EVM proof verifies both
complete C6 rows and C7. Independent rebuilding verified both public VK pins and the outer proof;
the generated verifier compiled with solc 0.8.28 accepted it and rejected changed plaintext.

| Profile | C6 gates (one owner) | C7 gates | Outer gates | Peak sampled RSS during proof suite |
| -------------------------- | -------------------: | --------: | ----------: | ----------------------------------: |
| `sync-insecure-64/minimum` | 92,038 | 17,265 | 2,242,265 | 4.51 GiB |
| `sync-secure-8192/minimum` | 8,609,254 | 1,516,802 | 2,242,265 | 26.68 GiB |

Apple M4 Pro / 48 GiB, Nargo `1.0.0-rc.3`, bb `6.0.0`, local CRS. In the secure run, C6
`bb prove --write_vk` took **21.06 s / 20.74 s** for the two owners; C7 took **4.23 s**. Outer
witness preparation and EVM proving together took **4.81 s** (insecure: **5.12 s**). A separate
insecure run measured **0.35 / 0.37 s** for C6 and **0.12 s** for C7. These are observations, not
latency guarantees: leaf timings include the VK work of that command but exclude Noir
compilation/solving and the subsequent `bb verify`. The entire secure Rust suite, including
independent negative checks and recompilation, took **792.49 s**. The separate candidate build and
proof check peaked at **26.04 GiB**. The guard sampled the process tree every 0.5 s; neither run hit
its 32 GiB stop threshold. Sampled peaks are not hard memory bounds.

The secure case rejected a changed full-product coefficient, shifted noise above `2B`, and an
altered native share in ACVM. It verifies decryption from native setup openings, **not** a secure
DKG proof, secure registry publication, production request admission or noise freshness. The
insecure case additionally has the signed registry/authority wrapper integration. The two outer VKs
coincide because the Minimum recursive verifier has the same shape; the C6 and C7 VKs differ and
must be pinned independently. See the [versioned manifests](../qualification/README.md) and
[reproduction commands](../../scripts/circuits/README.md#synchronized-decryption-candidates). Secure
Micro/Small [PRF-only measurements](synchronized-prf.md) do not qualify decryption.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "decrypted_shares_aggregation"
type = "bin"
authors = ["Gnosis Guild / Interfold"]

[dependencies]
lib = { path = "../../../../lib" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: LGPL-3.0-only
use lib::configs::protocol::MAX_MSG_NON_ZERO_COEFFS;
use lib::configs::synchronized::sync_secure_8192::{
AGGREGATE_BIT, C6_PUBLIC_FIELDS, C7_BIT_K, C7_BIT_Q_TOTAL, C7_BIT_T, C7_PLAINTEXT_MODULUS, H, L,
N, N_PARTIES, QIS, SHARE_BIT, T,
};
use lib::core::synchronized::plaintext_aggregation::execute_for;

fn main(
rows: pub [[Field; C6_PUBLIC_FIELDS]; T + 1],
message: pub [u64; MAX_MSG_NON_ZERO_COEFFS],
c0: [[u64; N]; L],
shares: [[[u64; N]; L]; T + 1],
) {
execute_for::<N, L, T, H, C6_PUBLIC_FIELDS, SHARE_BIT, AGGREGATE_BIT, C7_BIT_K, C7_BIT_T, C7_BIT_Q_TOTAL>(
rows,
message,
c0,
shares,
QIS,
N_PARTIES,
C7_PLAINTEXT_MODULUS,
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "share_decryption"
type = "bin"
authors = ["Gnosis Guild / Interfold"]

[dependencies]
lib = { path = "../../../../lib" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
// SPDX-License-Identifier: LGPL-3.0-only
use lib::configs::synchronized::sync_secure_8192::{
AGGREGATE_BIT, C6_NOISE_BOUND, H, KEY_BITS, L, N, N_PARTIES, PROFILE_ID, QIS, SHARE_BIT, T,
};
use lib::core::synchronized::{
commitments::{commit, key_bundle},
prf,
threshold_decryption::{centered_for, designated},
};
use lib::core::threshold::decrypted_shares_aggregation::lagrange_coefficients;
use lib::math::commitments::{
compute_aggregated_shares_commitment_checked, compute_commitment,
compute_multiple_polynomial_commitment_checked, compute_threshold_decryption_share_commitment,
DS_CIPHERTEXT,
};
use lib::math::helpers::assert_in_range;
use lib::math::polynomial::{negacyclic_kernel, Polynomial};

// Product is the exact centered c1*SK in Z[X]/(X^N+1), as descending field coefficients.
// Commit it BEFORE deriving the evaluation point. SK and c1 are already uniquely opened.
// The polynomial identity authenticates only this product; the complete PRF and noise
// relation below is still checked coefficient by coefficient.
fn main(
setup: pub [Field; 2],
owner: pub u32,
roster: pub [u32; H],
domain: pub [u128; 2],
expected_sk: pub Field,
expected_bundle: pub Field,
expected_ct: pub Field,
outgoing: [[u8; 32]; N_PARTIES],
incoming: [[u8; 32]; H],
sk: [[u64; N]; L],
ct: [[[u64; N]; L]; 2],
shifted_noise: [Field; N],
d: [[u64; N]; L],
product: [[Field; N]; L],
) -> pub (Field, Field) {
let _ = domain;
let secret = centered_for(sk, QIS);
assert(
compute_aggregated_shares_commitment_checked::<N, L, AGGREGATE_BIT>(secret) == expected_sk,
);
assert(
key_bundle::<N_PARTIES, H, KEY_BITS>(
PROFILE_ID,
setup,
owner,
roster,
expected_sk,
outgoing,
incoming,
)
== expected_bundle,
);
let (ids, slot) = designated::<H, T + 1>(owner, roster);
let mut plus = [[0; 32]; T];
let mut minus = [[0; 32]; T];
for i in 0..T {
let row = if i < slot { i } else { i + 1 };
plus[i] = outgoing[roster[row]];
minus[i] = incoming[row];
}
let c1 = centered_for(ct[1], QIS);
let c0_hash = compute_multiple_polynomial_commitment_checked::<N, L, AGGREGATE_BIT>(
centered_for(ct[0], QIS),
DS_CIPHERTEXT,
);
let c1_hash =
compute_multiple_polynomial_commitment_checked::<N, L, AGGREGATE_BIT>(c1, DS_CIPHERTEXT);
assert(compute_commitment([c0_hash, c1_hash].as_vector(), DS_CIPHERTEXT) == expected_ct);
let mask = prf::mask(ids, ct, QIS.map(|q| q as u64), plus, minus);
let weights = lagrange_coefficients::<T + 1, L, SHARE_BIT, SHARE_BIT + 6>(
QIS,
ids.map(|id| id as Field),
N_PARTIES,
);
let mut transcript = [0; 5 + L * N];
// "sync-c6-prod-v1"; no key material is exposed by this private challenge.
transcript[0] = 0x73796e632d63362d70726f642d7631;
transcript[1] = PROFILE_ID[0];
transcript[2] = PROFILE_ID[1];
transcript[3] = expected_sk;
transcript[4] = c1_hash;
for l in 0..L {
for j in 0..N {
transcript[5 + l * N + j] = product[l][j];
}
}
let gamma = commit(transcript.as_vector());
// B < 2^144; a shifted draw represents precisely one signed integer in [-B,B].
C6_NOISE_BOUND.assert_max_bit_size::<144>();
for j in 0..N {
assert_in_range::<145>(shifted_noise[j], 2 * C6_NOISE_BOUND + 1);
}
let mut share = [Polynomial::new([0; N]); L];
for l in 0..L {
let q = QIS[l];
q.assert_max_bit_size::<60>();
assert(
Polynomial::new(product[l]).eval(gamma)
== c1[l].dot(negacyclic_kernel(secret[l], gamma)),
"Wrong negacyclic product",
);
for j in 0..N {
assert(d[l][j] < q as u64);
let delta = weights[l][slot] * product[l][N - 1 - j] + shifted_noise[j] - C6_NOISE_BOUND
+ mask[l][j] as Field
- d[l][j] as Field;
// |lambda*product| < N*q^3, so its quotient is < 2^134. B/q < 2^86.
// The bounded signed quotient times q is far below the scalar modulus.
((delta / q) + 0x10000000000000000000000000000000000).assert_max_bit_size::<137>();
share[l].coefficients[j] = d[l][j] as Field;
}
}
(compute_threshold_decryption_share_commitment::<N, L, SHARE_BIT>(share), c0_hash)
}
1 change: 1 addition & 0 deletions circuits/lib/src/configs/synchronized/mod.nr
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: LGPL-3.0-only

pub mod sync_insecure_64;
pub mod sync_secure_8192;
24 changes: 24 additions & 0 deletions circuits/lib/src/configs/synchronized/sync_secure_8192.nr
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// 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.

// Generated by `pnpm build:circuits sync-sources`. Do not edit.
pub global N: u32 = 8192;
pub global N_PARTIES: u32 = 3;
pub global H: u32 = 2;
pub global T: u32 = 1;
pub global L: u32 = 3;
pub global QIS: [Field; L] = [576460752317792257, 576460752317399041, 576460752316776449];
pub global PROFILE_ID: [Field; 2] =
[58685080565826502537552293233766315872, 181886630095669266744353950942559527706];
pub global KEY_BITS: u32 = 256;
pub global SHARE_BIT: u32 = 60;
pub global AGGREGATE_BIT: u32 = 59;
pub global C6_NOISE_BOUND: Field = 13292279957849975063929256991047181926400000;
pub global C6_PUBLIC_FIELDS: u32 = 12;
pub global C7_PLAINTEXT_MODULUS: Field = 17000000;
pub global C7_BIT_K: u32 = 66;
pub global C7_BIT_T: u32 = 25;
pub global C7_BIT_Q_TOTAL: u32 = 178;
48 changes: 37 additions & 11 deletions circuits/lib/src/core/synchronized/plaintext_aggregation.nr
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@

use crate::configs::protocol::MAX_MSG_NON_ZERO_COEFFS as K;
use crate::configs::synchronized::sync_insecure_64::{
C6_PUBLIC_FIELDS, C7_BIT_K, C7_BIT_Q_TOTAL, C7_BIT_T, C7_PLAINTEXT_MODULUS, H, L_THRESHOLD as L,
N, N_PARTIES, QIS_THRESHOLD, SHARE_BIT, T,
AGGREGATE_BIT, C6_PUBLIC_FIELDS, C7_BIT_K, C7_BIT_Q_TOTAL, C7_BIT_T, C7_PLAINTEXT_MODULUS, H,
L_THRESHOLD as L, N, N_PARTIES, QIS_THRESHOLD, SHARE_BIT, T,
};
use crate::core::threshold::decrypted_shares_aggregation::{garner_reconstruct, rounded_decode};
use crate::math::commitments::compute_threshold_decryption_share_commitment;
use crate::math::commitments::{
compute_multiple_polynomial_commitment_checked, compute_threshold_decryption_share_commitment,
DS_CIPHERTEXT,
};
use crate::math::modulo::U128::reduce_mod_bounded;
use crate::math::polynomial::Polynomial;
use super::threshold_decryption::component_commitment;
use super::threshold_decryption::centered_for;

/// `rows` are the *public* statements of the C6 leaves in designated order. The recursive
/// consumer must compare these exact rows (including each SK/bundle anchor) to verified proofs.
Expand All @@ -22,6 +25,26 @@ pub fn execute(
message: [u64; K],
c0: [[u64; N]; L],
shares: [[[u64; N]; L]; T + 1],
) {
execute_for::<N, L, T, H, C6_PUBLIC_FIELDS, SHARE_BIT, AGGREGATE_BIT, C7_BIT_K, C7_BIT_T, C7_BIT_Q_TOTAL>(
rows,
message,
c0,
shares,
QIS_THRESHOLD,
N_PARTIES,
C7_PLAINTEXT_MODULUS,
);
}

pub fn execute_for<let N: u32, let L: u32, let T: u32, let H: u32, let C6_PUBLIC_FIELDS: u32, let SHARE_BIT: u32, let AGGREGATE_BIT: u32, let C7_BIT_K: u32, let C7_BIT_T: u32, let C7_BIT_Q_TOTAL: u32>(
rows: [[Field; C6_PUBLIC_FIELDS]; T + 1],
message: [u64; K],
c0: [[u64; N]; L],
shares: [[[u64; N]; L]; T + 1],
qis: [Field; L],
n_parties: u32,
plaintext_modulus: Field,
) {
std::static_assert(T + 1 <= H, "designated set exceeds H");
std::static_assert(K <= N, "message exceeds ring degree");
Expand All @@ -34,7 +57,7 @@ pub fn execute(
for i in 0..H {
let id = first[3 + i];
id.assert_max_bit_size::<32>();
assert((id as u32) < N_PARTIES);
assert((id as u32) < n_parties);
if i > 0 {
assert((first[2 + i] as u32) < (id as u32));
}
Expand All @@ -43,7 +66,10 @@ pub fn execute(
first[i].assert_max_bit_size::<128>();
first[3 + H + i].assert_max_bit_size::<128>();
}
let c0_commitment = component_commitment(c0);
let c0_commitment = compute_multiple_polynomial_commitment_checked::<N, L, AGGREGATE_BIT>(
centered_for(c0, qis),
DS_CIPHERTEXT,
);
for s in 0..T + 1 {
let row = rows[s];
assert(row[2] == first[3 + s], "Unexpected designated owner");
Expand All @@ -60,7 +86,7 @@ pub fn execute(
for l in 0..L {
for j in 0..N {
let r = shares[s][l][j];
assert(r < QIS_THRESHOLD[l] as u64);
assert(r < qis[l] as u64);
polynomials[l].coefficients[j] = r as Field;
}
}
Expand All @@ -71,7 +97,7 @@ pub fn execute(
);
}
let mut q_total: Field = 1;
for q in QIS_THRESHOLD {
for q in qis {
q_total *= q;
}
for j in 0..K {
Expand All @@ -81,12 +107,12 @@ pub fn execute(
for s in 0..T + 1 {
sum += shares[s][l][j] as Field;
}
residues[l] = reduce_mod_bounded::<SHARE_BIT, C7_BIT_K>(sum, QIS_THRESHOLD[l]);
residues[l] = reduce_mod_bounded::<SHARE_BIT, C7_BIT_K>(sum, qis[l]);
}
let u = garner_reconstruct::<L, SHARE_BIT, C7_BIT_K>(residues, QIS_THRESHOLD);
let u = garner_reconstruct::<L, SHARE_BIT, C7_BIT_K>(residues, qis);
let decoded = rounded_decode::<C7_BIT_T, C7_BIT_Q_TOTAL>(
u,
C7_PLAINTEXT_MODULUS,
plaintext_modulus,
q_total,
(q_total - 1) / 2,
);
Expand Down
Loading
Loading