From aff56e67639094a3c15fe5e1e5515cceba8fe68a Mon Sep 17 00:00:00 2001 From: therealyingtong Date: Fri, 11 Jun 2021 11:24:12 +0800 Subject: [PATCH] ecc::chip.rs: Make EccPoint.x, EccPoint.y private fields Also add public getters x() and y(). Co-authored-by: Jack Grigg Co-authored-by: Daira Hopwood --- src/circuit/gadget/ecc.rs | 2 +- src/circuit/gadget/ecc/chip.rs | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/circuit/gadget/ecc.rs b/src/circuit/gadget/ecc.rs index 23efe03f..d20ac5c2 100644 --- a/src/circuit/gadget/ecc.rs +++ b/src/circuit/gadget/ecc.rs @@ -459,7 +459,7 @@ mod tests { // Test complete addition { super::chip::add::tests::test_add( - chip.clone(), + chip, layouter.namespace(|| "complete addition"), &zero, p_val, diff --git a/src/circuit/gadget/ecc/chip.rs b/src/circuit/gadget/ecc/chip.rs index c7d702ea..5d95a272 100644 --- a/src/circuit/gadget/ecc/chip.rs +++ b/src/circuit/gadget/ecc/chip.rs @@ -22,9 +22,9 @@ pub(super) mod witness_point; #[derive(Clone, Debug)] pub struct EccPoint { /// x-coordinate - pub x: CellValue, + x: CellValue, /// y-coordinate - pub y: CellValue, + y: CellValue, } impl EccPoint { @@ -41,6 +41,16 @@ impl EccPoint { _ => None, } } + /// The cell containing the affine short-Weierstrass x-coordinate, + /// or 0 for the zero point. + pub fn x(&self) -> CellValue { + self.x + } + /// The cell containing the affine short-Weierstrass y-coordinate, + /// or 0 for the zero point. + pub fn y(&self) -> CellValue { + self.y + } } /// Configuration for the ECC chip