From 83eddd88577792f0ae1834c18f6bd23b882452b8 Mon Sep 17 00:00:00 2001 From: therealyingtong Date: Sat, 19 Jun 2021 14:59:09 +0800 Subject: [PATCH] ecc::chip.rs: Add Point::from_coordinates_unchecked() API Co-authored-by: Jack Grigg --- src/circuit/gadget/ecc/chip.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/circuit/gadget/ecc/chip.rs b/src/circuit/gadget/ecc/chip.rs index e398547c..84a75ae1 100644 --- a/src/circuit/gadget/ecc/chip.rs +++ b/src/circuit/gadget/ecc/chip.rs @@ -27,6 +27,17 @@ pub struct EccPoint { } 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 + /// (specifically inside Sinsemilla). + pub(in crate::circuit::gadget) fn from_coordinates_unchecked( + x: CellValue, + y: CellValue, + ) -> Self { + EccPoint { x, y } + } + /// Returns the value of this curve point, if known. pub fn point(&self) -> Option { match (self.x.value(), self.y.value()) {