Skip to content

Commit

Permalink
Add multiplexer chip (#23)
Browse files Browse the repository at this point in the history
It is now possible to perform a mux between two points or between two non-identity points.
`mux(choice, left, right)` will return `left` when `choice=0` and `right` when `choice=1`.
`choice` must be constrained to `{0, 1}` outside the gate.

It is no longer needed to expose `from_coordinates_unchecked`.
  • Loading branch information
ConstanceBeguier committed Nov 23, 2023
1 parent 7611a88 commit e7f5e63
Show file tree
Hide file tree
Showing 3 changed files with 452 additions and 1 deletion.
2 changes: 1 addition & 1 deletion halo2_gadgets/src/ecc/chip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl EccPoint {
/// Constructs a point from its coordinates, without checking they are on the curve.
///
/// This is an internal API that we only use where we know we have a valid curve point.
pub fn from_coordinates_unchecked(
pub(crate) fn from_coordinates_unchecked(
x: AssignedCell<Assigned<pallas::Base>, pallas::Base>,
y: AssignedCell<Assigned<pallas::Base>, pallas::Base>,
) -> Self {
Expand Down
1 change: 1 addition & 0 deletions halo2_gadgets/src/utilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use std::ops::Range;
pub mod cond_swap;
pub mod decompose_running_sum;
pub mod lookup_range_check;
pub mod mux;

/// A type that has a value at either keygen or proving time.
pub trait FieldValue<F: Field> {
Expand Down
Loading

0 comments on commit e7f5e63

Please sign in to comment.