Skip to content

Commit

Permalink
Add From extended point to PublicInputValue
Browse files Browse the repository at this point in the history
`PublicInputValue` implements `From<JubJubAffine>`.

Since `JubJubExtended` implements `Into<JubJubAffine>`, the
implementation of `From<JubJubExtended>` for `PublicInputValue` is
trivial.

This will save the consumers of the API some additional and unnecessary
conversions.

Resolves #573
  • Loading branch information
vlopes11 committed Sep 16, 2021
1 parent d3412ce commit 8806b26
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 7 additions & 1 deletion src/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))]
Expand All @@ -41,6 +41,12 @@ impl From<JubJubAffine> for PublicInputValue {
}
}

impl From<JubJubExtended> 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.
Expand Down

0 comments on commit 8806b26

Please sign in to comment.