Skip to content

Commit 1be5954

Browse files
committed
document gate constraints on zero-witness
1 parent 0fff078 commit 1be5954

File tree

1 file changed

+14
-0
lines changed
  • src/backends/plonky2/primitives/ec/gates

1 file changed

+14
-0
lines changed

src/backends/plonky2/primitives/ec/gates/curve.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,20 @@ use crate::backends::plonky2::primitives::ec::{
99
/// homogeneous coordinates *minus* an offset in the `z` and `t`
1010
/// coordinates, viz. the extension field generator times `Point::B1`,
1111
/// cf. CircuitBuilderElliptic::add_point.
12+
///
13+
/// In plonky2 one Gate can do multiple operations and the gate will register one
14+
/// generator per operation. When a gate operation is used, the `CircuitBuilder` tracks the
15+
/// allocation of operations to gaates via the `current_slots` field. Once the circuit is fully
16+
/// defined, during the build the circuit the generators
17+
/// associated to unused operations (free slots) are removed:
18+
/// https://github.com/0xPolygonZero/plonky2/blob/82791c4809d6275682c34b926390ecdbdc2a5297/plonky2/src/plonk/circuit_builder.rs#L1210
19+
/// Since the generator for the unused operations are removed, no witness value will be calculated
20+
/// for them, and the free slots gate witness wires will be filled with the default value which is zero:
21+
/// https://github.com/0xPolygonZero/plonky2/blob/82791c4809d6275682c34b926390ecdbdc2a5297/plonky2/src/iop/witness.rs#L377
22+
/// This means that a gate with multiple operations need to pass the constraints for a single
23+
/// operation when all its witness wire values are zero (so that when the gate is partially used,
24+
/// the unused slots still pass the constraints). This is the reason why this gate doesn't add the
25+
/// final offset: if it did, the constraints wouldn't pass on the zero witness values.
1226
#[derive(Debug, Clone)]
1327
pub struct ECAddHomogOffset;
1428

0 commit comments

Comments
 (0)