mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-08 00:33:06 +00:00
config option to turn off randomizing unused wires (makes debugging easier as it becomes deterministic)
if you turn it off apparently you have something like a 10^-13 chance of the proof failing, and since it's deterministic (unless zero knowledge), it will always fail. remark: now it's off by default. Don't forget to turn it back in production
This commit is contained in:
parent
356aefb686
commit
99aac4dd08
@ -1095,7 +1095,12 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
|
|||||||
{
|
{
|
||||||
self.connect(hash_part, Target::wire(pi_gate, wire))
|
self.connect(hash_part, Target::wire(pi_gate, wire))
|
||||||
}
|
}
|
||||||
self.randomize_unused_pi_wires(pi_gate);
|
|
||||||
|
// See <https://github.com/0xPolygonZero/plonky2/issues/456>
|
||||||
|
// however randomization makes debugging harder as runs are not deterministic
|
||||||
|
if self.config.randomize_unused_wires {
|
||||||
|
self.randomize_unused_pi_wires(pi_gate);
|
||||||
|
}
|
||||||
|
|
||||||
// Place LUT-related gates.
|
// Place LUT-related gates.
|
||||||
self.add_all_lookups();
|
self.add_all_lookups();
|
||||||
|
|||||||
@ -80,6 +80,9 @@ pub struct CircuitConfig {
|
|||||||
/// A boolean to activate the zero-knowledge property. When this is set to `false`, proofs *may*
|
/// A boolean to activate the zero-knowledge property. When this is set to `false`, proofs *may*
|
||||||
/// leak additional information.
|
/// leak additional information.
|
||||||
pub zero_knowledge: bool,
|
pub zero_knowledge: bool,
|
||||||
|
/// See <https://github.com/0xPolygonZero/plonky2/issues/456>
|
||||||
|
/// Can be turned off for deterministic results
|
||||||
|
pub randomize_unused_wires: bool,
|
||||||
/// A cap on the quotient polynomial's degree factor. The actual degree factor is derived
|
/// A cap on the quotient polynomial's degree factor. The actual degree factor is derived
|
||||||
/// systematically, but will never exceed this value.
|
/// systematically, but will never exceed this value.
|
||||||
pub max_quotient_degree_factor: usize,
|
pub max_quotient_degree_factor: usize,
|
||||||
@ -107,6 +110,7 @@ impl CircuitConfig {
|
|||||||
security_bits: 100,
|
security_bits: 100,
|
||||||
num_challenges: 2,
|
num_challenges: 2,
|
||||||
zero_knowledge: false,
|
zero_knowledge: false,
|
||||||
|
randomize_unused_wires: false,
|
||||||
max_quotient_degree_factor: 8,
|
max_quotient_degree_factor: 8,
|
||||||
fri_config: FriConfig {
|
fri_config: FriConfig {
|
||||||
rate_bits: 3,
|
rate_bits: 3,
|
||||||
|
|||||||
@ -661,6 +661,7 @@ pub trait Read {
|
|||||||
let max_quotient_degree_factor = self.read_usize()?;
|
let max_quotient_degree_factor = self.read_usize()?;
|
||||||
let use_base_arithmetic_gate = self.read_bool()?;
|
let use_base_arithmetic_gate = self.read_bool()?;
|
||||||
let zero_knowledge = self.read_bool()?;
|
let zero_knowledge = self.read_bool()?;
|
||||||
|
let randomize_unused_wires = self.read_bool()?;
|
||||||
let fri_config = self.read_fri_config()?;
|
let fri_config = self.read_fri_config()?;
|
||||||
|
|
||||||
Ok(CircuitConfig {
|
Ok(CircuitConfig {
|
||||||
@ -672,6 +673,7 @@ pub trait Read {
|
|||||||
max_quotient_degree_factor,
|
max_quotient_degree_factor,
|
||||||
use_base_arithmetic_gate,
|
use_base_arithmetic_gate,
|
||||||
zero_knowledge,
|
zero_knowledge,
|
||||||
|
randomize_unused_wires,
|
||||||
fri_config,
|
fri_config,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -1696,6 +1698,7 @@ pub trait Write {
|
|||||||
max_quotient_degree_factor,
|
max_quotient_degree_factor,
|
||||||
use_base_arithmetic_gate,
|
use_base_arithmetic_gate,
|
||||||
zero_knowledge,
|
zero_knowledge,
|
||||||
|
randomize_unused_wires,
|
||||||
fri_config,
|
fri_config,
|
||||||
} = config;
|
} = config;
|
||||||
|
|
||||||
@ -1707,6 +1710,7 @@ pub trait Write {
|
|||||||
self.write_usize(*max_quotient_degree_factor)?;
|
self.write_usize(*max_quotient_degree_factor)?;
|
||||||
self.write_bool(*use_base_arithmetic_gate)?;
|
self.write_bool(*use_base_arithmetic_gate)?;
|
||||||
self.write_bool(*zero_knowledge)?;
|
self.write_bool(*zero_knowledge)?;
|
||||||
|
self.write_bool(*randomize_unused_wires)?;
|
||||||
self.write_fri_config(fri_config)?;
|
self.write_fri_config(fri_config)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user