Skip to content
Merged
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
1 change: 0 additions & 1 deletion w3f-plonk-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,3 @@ parallel = [
]
print-trace = ["ark-std/print-trace"]
asm = ["w3f-pcs/asm"]
test-vectors = []
40 changes: 36 additions & 4 deletions w3f-plonk-common/src/domain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ pub struct Domain<F: FftField> {
pub l_first: FieldColumn<F>,
pub l_last: FieldColumn<F>,
zk_rows_prod: DensePolynomial<F>,
blinding: bool,
}

impl<F: FftField> Domain<F> {
Expand Down Expand Up @@ -97,9 +98,20 @@ impl<F: FftField> Domain<F> {
l_first,
l_last,
zk_rows_prod,
blinding: zk_rows != 0,
}
}

/// Disables column blinding, preserving the domain layout (`zk_rows`, `capacity`):
/// the zk rows are padded with zeros instead of random values.
/// Proofs generated over such a domain are deterministic, thus NOT zero-knowledge,
/// but remain valid for verifiers configured with the blinding-enabled domain.
/// Intended for reproducible test vectors generation.
pub fn without_blinding(mut self) -> Self {
self.blinding = false;
self
}

#[cfg(test)]
pub const ZK_ROWS_TEST: usize = 3;

Expand Down Expand Up @@ -136,13 +148,12 @@ impl<F: FftField> Domain<F> {
fn _column(&self, mut values: Vec<F>, public: bool) -> FieldColumn<F> {
let payload_len = values.len();
assert!(payload_len <= self.capacity);
let no_blinding = !self.is_hiding() || public || cfg!(feature = "test-vectors");
if no_blinding {
values.resize(self.domain_size(), F::zero());
} else {
if self.blinding && !public {
values.resize(self.capacity, F::zero());
let rng = &mut getrandom_or_panic();
values.resize_with(self.domain_size(), || F::rand(rng));
} else {
values.resize(self.domain_size(), F::zero());
}
self.domains.column_from_evals(values, payload_len)
}
Expand Down Expand Up @@ -323,4 +334,25 @@ mod tests {
_test_evaluated_domain(false);
_test_evaluated_domain(true);
}

// Disabling blinding must yield reproducible columns (deterministic proofs, for test
// vectors generation) without altering the domain layout, so that the resulting proofs
// still match the parameters (e.g. max ring size) of the blinding-enabled configuration.
#[test]
fn column_blinding() {
let n = 16;
let values = vec![Fq::one(); 4];

let domain = Domain::test_domain(n, true);
let col_1 = domain.column(values.clone());
let col_2 = domain.column(values.clone());
assert_ne!(col_1.poly, col_2.poly);

let capacity = domain.capacity;
let domain = domain.without_blinding();
assert_eq!(domain.capacity, capacity);
let col_1 = domain.column(values.clone());
let col_2 = domain.column(values);
assert_eq!(col_1.poly, col_2.poly);
}
}
1 change: 0 additions & 1 deletion w3f-ring-proof/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,3 @@ parallel = [
]
print-trace = ["ark-std/print-trace"]
asm = [ "w3f-pcs/asm" ]
test-vectors = [ "w3f-plonk-common/test-vectors" ]
1 change: 0 additions & 1 deletion w3f-ring-vrf-snark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,5 @@ print-trace = [
"w3f-plonk-common/print-trace"
]
asm = [ "w3f-pcs/asm" ]
test-vectors = [ "w3f-plonk-common/test-vectors" ]
# benchmarking by running many proofs and verifications to get more accurate timing comparison
intensive-benchmarking = ["std"]
Loading