Pin halo2 commit and update usage of pasta_curves accordingly
This commit is contained in:
parent
9b6339bb9c
commit
6d4ecff24b
|
@ -1510,7 +1510,7 @@ checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "halo2"
|
name = "halo2"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
source = "git+https://github.com/zcash/halo2.git?branch=main#b079624ea78b4a07d44cb3c725dd734093577062"
|
source = "git+https://github.com/zcash/halo2.git?rev=dda60a363001373d564156ad0334e2022d85a5b4#dda60a363001373d564156ad0334e2022d85a5b4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"blake2b_simd",
|
"blake2b_simd",
|
||||||
"crossbeam-utils 0.8.0",
|
"crossbeam-utils 0.8.0",
|
||||||
|
|
|
@ -29,7 +29,8 @@ fpe = "0.4"
|
||||||
funty = "=1.1.0"
|
funty = "=1.1.0"
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
group = "0.9"
|
group = "0.9"
|
||||||
halo2 = { git = "https://github.com/zcash/halo2.git", branch = "main" }
|
# TODO: replace w/ crate version when released: https://github.com/ZcashFoundation/zebra/issues/2083
|
||||||
|
halo2 = { git = "https://github.com/zcash/halo2.git", rev = "dda60a363001373d564156ad0334e2022d85a5b4"}
|
||||||
hex = "0.4"
|
hex = "0.4"
|
||||||
jubjub = "0.6.0"
|
jubjub = "0.6.0"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
|
|
|
@ -5,7 +5,7 @@ use std::{convert::TryFrom, fmt, io};
|
||||||
use bitvec::prelude::*;
|
use bitvec::prelude::*;
|
||||||
use group::{prime::PrimeCurveAffine, GroupEncoding};
|
use group::{prime::PrimeCurveAffine, GroupEncoding};
|
||||||
use halo2::{
|
use halo2::{
|
||||||
arithmetic::{CurveAffine, FieldExt},
|
arithmetic::{Coordinates, CurveAffine, FieldExt},
|
||||||
pasta::pallas,
|
pasta::pallas,
|
||||||
};
|
};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
|
@ -61,10 +61,12 @@ impl fmt::Debug for NoteCommitment {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let mut d = f.debug_struct("NoteCommitment");
|
let mut d = f.debug_struct("NoteCommitment");
|
||||||
|
|
||||||
match self.0.get_xy().into() {
|
let option: Option<Coordinates<pallas::Affine>> = self.0.coordinates().into();
|
||||||
Some((x, y)) => d
|
|
||||||
.field("x", &hex::encode(x.to_bytes()))
|
match option {
|
||||||
.field("y", &hex::encode(y.to_bytes()))
|
Some(coordinates) => d
|
||||||
|
.field("x", &hex::encode(coordinates.x().to_bytes()))
|
||||||
|
.field("y", &hex::encode(coordinates.y().to_bytes()))
|
||||||
.finish(),
|
.finish(),
|
||||||
None => d
|
None => d
|
||||||
.field("x", &hex::encode(pallas::Base::zero().to_bytes()))
|
.field("x", &hex::encode(pallas::Base::zero().to_bytes()))
|
||||||
|
@ -167,9 +169,11 @@ impl NoteCommitment {
|
||||||
///
|
///
|
||||||
/// https://zips.z.cash/protocol/nu5.pdf#concreteextractorpallas
|
/// https://zips.z.cash/protocol/nu5.pdf#concreteextractorpallas
|
||||||
pub fn extract_x(&self) -> pallas::Base {
|
pub fn extract_x(&self) -> pallas::Base {
|
||||||
match self.0.get_xy().into() {
|
let option: Option<Coordinates<pallas::Affine>> = self.0.coordinates().into();
|
||||||
|
|
||||||
|
match option {
|
||||||
// If Some, it's not the identity.
|
// If Some, it's not the identity.
|
||||||
Some((x, _)) => x,
|
Some(coordinates) => *coordinates.x(),
|
||||||
_ => pallas::Base::zero(),
|
_ => pallas::Base::zero(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -208,10 +212,12 @@ impl fmt::Debug for ValueCommitment {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let mut d = f.debug_struct("ValueCommitment");
|
let mut d = f.debug_struct("ValueCommitment");
|
||||||
|
|
||||||
match self.0.get_xy().into() {
|
let option: Option<Coordinates<pallas::Affine>> = self.0.coordinates().into();
|
||||||
Some((x, y)) => d
|
|
||||||
.field("x", &hex::encode(x.to_bytes()))
|
match option {
|
||||||
.field("y", &hex::encode(y.to_bytes()))
|
Some(coordinates) => d
|
||||||
|
.field("x", &hex::encode(coordinates.x().to_bytes()))
|
||||||
|
.field("y", &hex::encode(coordinates.y().to_bytes()))
|
||||||
.finish(),
|
.finish(),
|
||||||
None => d
|
None => d
|
||||||
.field("x", &hex::encode(pallas::Base::zero().to_bytes()))
|
.field("x", &hex::encode(pallas::Base::zero().to_bytes()))
|
||||||
|
|
|
@ -20,7 +20,7 @@ use bitvec::prelude::*;
|
||||||
use fpe::ff1::{BinaryNumeralString, FF1};
|
use fpe::ff1::{BinaryNumeralString, FF1};
|
||||||
use group::{Group, GroupEncoding};
|
use group::{Group, GroupEncoding};
|
||||||
use halo2::{
|
use halo2::{
|
||||||
arithmetic::{CurveAffine, FieldExt},
|
arithmetic::{Coordinates, CurveAffine, FieldExt},
|
||||||
pasta::pallas,
|
pasta::pallas,
|
||||||
};
|
};
|
||||||
use rand_core::{CryptoRng, RngCore};
|
use rand_core::{CryptoRng, RngCore};
|
||||||
|
@ -854,10 +854,12 @@ impl fmt::Debug for TransmissionKey {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let mut d = f.debug_struct("TransmissionKey");
|
let mut d = f.debug_struct("TransmissionKey");
|
||||||
|
|
||||||
match self.0.get_xy().into() {
|
let option: Option<Coordinates<pallas::Affine>> = self.0.coordinates().into();
|
||||||
Some((x, y)) => d
|
|
||||||
.field("x", &hex::encode(x.to_bytes()))
|
match option {
|
||||||
.field("y", &hex::encode(y.to_bytes()))
|
Some(coordinates) => d
|
||||||
|
.field("x", &hex::encode(coordinates.x().to_bytes()))
|
||||||
|
.field("y", &hex::encode(coordinates.y().to_bytes()))
|
||||||
.finish(),
|
.finish(),
|
||||||
None => d
|
None => d
|
||||||
.field("x", &hex::encode(pallas::Base::zero().to_bytes()))
|
.field("x", &hex::encode(pallas::Base::zero().to_bytes()))
|
||||||
|
@ -917,10 +919,12 @@ impl fmt::Debug for EphemeralPublicKey {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
let mut d = f.debug_struct("EphemeralPublicKey");
|
let mut d = f.debug_struct("EphemeralPublicKey");
|
||||||
|
|
||||||
match self.0.get_xy().into() {
|
let option: Option<Coordinates<pallas::Affine>> = self.0.coordinates().into();
|
||||||
Some((x, y)) => d
|
|
||||||
.field("x", &hex::encode(x.to_bytes()))
|
match option {
|
||||||
.field("y", &hex::encode(y.to_bytes()))
|
Some(coordinates) => d
|
||||||
|
.field("x", &hex::encode(coordinates.x().to_bytes()))
|
||||||
|
.field("y", &hex::encode(coordinates.y().to_bytes()))
|
||||||
.finish(),
|
.finish(),
|
||||||
None => d
|
None => d
|
||||||
.field("x", &hex::encode(pallas::Base::zero().to_bytes()))
|
.field("x", &hex::encode(pallas::Base::zero().to_bytes()))
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
use bitvec::prelude::*;
|
use bitvec::prelude::*;
|
||||||
|
|
||||||
use halo2::{
|
use halo2::{
|
||||||
arithmetic::{CurveAffine, CurveExt},
|
arithmetic::{Coordinates, CurveAffine, CurveExt},
|
||||||
pasta::pallas,
|
pasta::pallas,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -13,9 +13,12 @@ use halo2::{
|
||||||
///
|
///
|
||||||
/// [concreteextractorpallas]: https://zips.z.cash/protocol/nu5.pdf#concreteextractorpallas
|
/// [concreteextractorpallas]: https://zips.z.cash/protocol/nu5.pdf#concreteextractorpallas
|
||||||
pub fn extract_p(point: pallas::Point) -> pallas::Base {
|
pub fn extract_p(point: pallas::Point) -> pallas::Base {
|
||||||
match pallas::Affine::from(point).get_xy().into() {
|
let option: Option<Coordinates<pallas::Affine>> =
|
||||||
|
pallas::Affine::from(point).coordinates().into();
|
||||||
|
|
||||||
|
match option {
|
||||||
// If Some, it's not the identity.
|
// If Some, it's not the identity.
|
||||||
Some((x, _)) => x,
|
Some(coordinates) => *coordinates.x(),
|
||||||
_ => pallas::Base::zero(),
|
_ => pallas::Base::zero(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue