Merge pull request #313 from zcash/full-width-var-base-mul

Use new halo2 `FixedPoint` API.
This commit is contained in:
str4d 2022-05-06 20:19:03 +01:00 committed by GitHub
commit c71de550ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 7 deletions

View File

@ -50,6 +50,7 @@ plotters = { version = "0.3.0", optional = true }
[dev-dependencies] [dev-dependencies]
criterion = "0.3" criterion = "0.3"
halo2_gadgets = { version = "=0.1.0-beta.3", features = ["test-dependencies"] } halo2_gadgets = { version = "=0.1.0-beta.3", features = ["test-dependencies"] }
hex = "0.4"
proptest = "1.0.0" proptest = "1.0.0"
zcash_note_encryption = { version = "0.1", features = ["pre-zip-212"] } zcash_note_encryption = { version = "0.1", features = ["pre-zip-212"] }
@ -82,7 +83,7 @@ debug = true
debug = true debug = true
[patch.crates-io] [patch.crates-io]
halo2_gadgets = { git = "https://github.com/zcash/halo2.git", rev = "72ff677776504c288f4927a6ce8d3c273ebd588d" } halo2_gadgets = { git = "https://github.com/zcash/halo2.git", rev = "30f92f3f4b785ea2a32392bf65c1b08f0411567c" }
halo2_proofs = { git = "https://github.com/zcash/halo2.git", rev = "72ff677776504c288f4927a6ce8d3c273ebd588d" } halo2_proofs = { git = "https://github.com/zcash/halo2.git", rev = "30f92f3f4b785ea2a32392bf65c1b08f0411567c" }
incrementalmerkletree = { git = "https://github.com/zcash/incrementalmerkletree.git", rev = "f23e3d89507849a24543121839eea6f40b141aff" } incrementalmerkletree = { git = "https://github.com/zcash/incrementalmerkletree.git", rev = "f23e3d89507849a24543121839eea6f40b141aff" }
reddsa = { git = "https://github.com/ZcashFoundation/reddsa.git", rev = "0e912de3000fe165daf58ad98d1a22f1a66e7f18" } reddsa = { git = "https://github.com/ZcashFoundation/reddsa.git", rev = "0e912de3000fe165daf58ad98d1a22f1a66e7f18" }

View File

@ -45,7 +45,7 @@ use crate::{
use halo2_gadgets::{ use halo2_gadgets::{
ecc::{ ecc::{
chip::{EccChip, EccConfig}, chip::{EccChip, EccConfig},
FixedPoint, NonIdentityPoint, Point, FixedPoint, NonIdentityPoint, Point, ScalarVar,
}, },
poseidon::{Pow5Chip as PoseidonChip, Pow5Config as PoseidonConfig}, poseidon::{Pow5Chip as PoseidonChip, Pow5Config as PoseidonConfig},
primitives::poseidon, primitives::poseidon,
@ -504,11 +504,13 @@ impl plonk::Circuit<pallas::Base> for Circuit {
rivk, rivk,
)? )?
}; };
let ivk =
ScalarVar::from_base(ecc_chip.clone(), layouter.namespace(|| "ivk"), ivk.inner())?;
// [ivk] g_d_old // [ivk] g_d_old
// The scalar value is passed through and discarded. // The scalar value is passed through and discarded.
let (derived_pk_d_old, _ivk) = let (derived_pk_d_old, _ivk) =
g_d_old.mul(layouter.namespace(|| "[ivk] g_d_old"), ivk.inner())?; g_d_old.mul(layouter.namespace(|| "[ivk] g_d_old"), ivk)?;
// Constrain derived pk_d_old to equal witnessed pk_d_old // Constrain derived pk_d_old to equal witnessed pk_d_old
// //

View File

@ -98,7 +98,7 @@ impl FixedPoints<pallas::Affine> for OrchardFixedBases {
} }
impl FixedPoint<pallas::Affine> for OrchardFixedBasesFull { impl FixedPoint<pallas::Affine> for OrchardFixedBasesFull {
type ScalarKind = FullScalar; type FixedScalarKind = FullScalar;
fn generator(&self) -> pallas::Affine { fn generator(&self) -> pallas::Affine {
match self { match self {
@ -129,7 +129,7 @@ impl FixedPoint<pallas::Affine> for OrchardFixedBasesFull {
} }
impl FixedPoint<pallas::Affine> for NullifierK { impl FixedPoint<pallas::Affine> for NullifierK {
type ScalarKind = BaseFieldElem; type FixedScalarKind = BaseFieldElem;
fn generator(&self) -> pallas::Affine { fn generator(&self) -> pallas::Affine {
nullifier_k::generator() nullifier_k::generator()
@ -145,7 +145,7 @@ impl FixedPoint<pallas::Affine> for NullifierK {
} }
impl FixedPoint<pallas::Affine> for ValueCommitV { impl FixedPoint<pallas::Affine> for ValueCommitV {
type ScalarKind = ShortScalar; type FixedScalarKind = ShortScalar;
fn generator(&self) -> pallas::Affine { fn generator(&self) -> pallas::Affine {
value_commit_v::generator() value_commit_v::generator()