From 8806b26a0bc4678b50b43b9daffb49ca0be12e94 Mon Sep 17 00:00:00 2001 From: Victor Lopez Date: Thu, 16 Sep 2021 23:16:42 +0200 Subject: [PATCH] Add `From` extended point to `PublicInputValue` `PublicInputValue` implements `From`. Since `JubJubExtended` implements `Into`, the implementation of `From` for `PublicInputValue` is trivial. This will save the consumers of the API some additional and unnecessary conversions. Resolves #573 --- CHANGELOG.md | 4 ++++ src/circuit.rs | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 601ceb42..cf67f416 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +### Added + +- Add `From` extended point to `PublicInputValue` [#573](https://github.com/dusk-network/plonk/issues/574) + ### Fixed - Fix the document references and typos [#533](https://github.com/dusk-network/plonk/pull/533) diff --git a/src/circuit.rs b/src/circuit.rs index 59bd0659..ad71994a 100644 --- a/src/circuit.rs +++ b/src/circuit.rs @@ -15,7 +15,7 @@ use alloc::vec::Vec; use canonical_derive::Canon; use dusk_bls12_381::BlsScalar; use dusk_bytes::{DeserializableSlice, Serializable, Write}; -use dusk_jubjub::{JubJubAffine, JubJubScalar}; +use dusk_jubjub::{JubJubAffine, JubJubExtended, JubJubScalar}; #[derive(Default, Debug, Clone)] #[cfg_attr(feature = "canon", derive(Canon))] @@ -41,6 +41,12 @@ impl From for PublicInputValue { } } +impl From for PublicInputValue { + fn from(point: JubJubExtended) -> Self { + JubJubAffine::from(point).into() + } +} + #[derive(Debug, Clone)] /// Collection of structs/objects that the Verifier will use in order to /// de/serialize data needed for Circuit proof verification.