Skip to content

Commit

Permalink
ecc.rs: Clarify PartialEq impl for ecc::Point
Browse files Browse the repository at this point in the history
When comparing two points at the gadget-level, we are only
interested in whether their values are equal: we don't care if
the two points come from different chips.
  • Loading branch information
therealyingtong committed Jun 12, 2021
1 parent 7570df2 commit 4eb2eac
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/circuit/gadget/ecc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,22 @@ where
}

/// An elliptic curve point over the given curve.
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[derive(Copy, Clone, Debug)]
pub struct Point<C: CurveAffine, EccChip: EccInstructions<C> + Clone + Debug + Eq> {
chip: EccChip,
inner: EccChip::Point,
}

impl<C: CurveAffine, EccChip: EccInstructions<C> + Clone + Debug + Eq> PartialEq
for Point<C, EccChip>
{
fn eq(&self, other: &Self) -> bool {
self.inner == other.inner
}
}

impl<C: CurveAffine, EccChip: EccInstructions<C> + Clone + Debug + Eq> Eq for Point<C, EccChip> {}

impl<C: CurveAffine, EccChip: EccInstructions<C> + Clone + Debug + Eq> Point<C, EccChip> {
/// Constructs a new point with the given value.
pub fn new(
Expand Down

0 comments on commit 4eb2eac

Please sign in to comment.