mirror of https://github.com/zcash/halo2.git
gadget::sinsemilla: Propagate changes to the Sinsemilla gadget.
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
258fe5796b
commit
cdcfcbc0c2
|
@ -377,10 +377,18 @@ where
|
|||
mut layouter: impl Layouter<C::Base>,
|
||||
message: Message<C, SinsemillaChip, K, MAX_WORDS>,
|
||||
r: Option<C::Scalar>,
|
||||
) -> Result<(ecc::Point<C, EccChip>, Vec<SinsemillaChip::RunningSum>), Error> {
|
||||
) -> Result<
|
||||
(
|
||||
ecc::NonIdentityPoint<C, EccChip>,
|
||||
Vec<SinsemillaChip::RunningSum>,
|
||||
),
|
||||
Error,
|
||||
> {
|
||||
assert_eq!(self.M.sinsemilla_chip, message.chip);
|
||||
let (blind, _) = self.R.mul(layouter.namespace(|| "[r] R"), r)?;
|
||||
let (p, zs) = self.M.hash_to_point(layouter.namespace(|| "M"), message)?;
|
||||
let p: ecc::NonIdentityPoint<C, EccChip> = p.try_into()?;
|
||||
let blind = blind.try_into()?;
|
||||
let commitment = p.add_incomplete(layouter.namespace(|| "M ⸭ [r] R"), &blind)?;
|
||||
Ok((commitment, zs))
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ use pasta_curves::{arithmetic::FieldExt, pallas};
|
|||
use crate::{
|
||||
circuit::gadget::{
|
||||
ecc::{
|
||||
chip::{EccChip, EccPoint},
|
||||
Point,
|
||||
chip::{EccChip, NonIdentityEccPoint},
|
||||
NonIdentityPoint,
|
||||
},
|
||||
utilities::{bitrange_subset, bool_check, copy, CellValue, Var},
|
||||
},
|
||||
|
@ -523,13 +523,13 @@ impl NoteCommitConfig {
|
|||
mut layouter: impl Layouter<pallas::Base>,
|
||||
chip: SinsemillaChip,
|
||||
ecc_chip: EccChip,
|
||||
g_d: &EccPoint,
|
||||
pk_d: &EccPoint,
|
||||
g_d: &NonIdentityEccPoint,
|
||||
pk_d: &NonIdentityEccPoint,
|
||||
value: CellValue<pallas::Base>,
|
||||
rho: CellValue<pallas::Base>,
|
||||
psi: CellValue<pallas::Base>,
|
||||
rcm: Option<pallas::Scalar>,
|
||||
) -> Result<Point<pallas::Affine, EccChip>, Error> {
|
||||
) -> Result<NonIdentityPoint<pallas::Affine, EccChip>, Error> {
|
||||
let (gd_x, gd_y) = (g_d.x().value(), g_d.y().value());
|
||||
let (pkd_x, pkd_y) = (pk_d.x().value(), pk_d.y().value());
|
||||
let value_val = value.value();
|
||||
|
@ -1432,7 +1432,7 @@ mod tests {
|
|||
circuit::gadget::{
|
||||
ecc::{
|
||||
chip::{EccChip, EccConfig},
|
||||
Point,
|
||||
NonIdentityPoint,
|
||||
},
|
||||
sinsemilla::chip::SinsemillaChip,
|
||||
utilities::{
|
||||
|
@ -1566,7 +1566,11 @@ mod tests {
|
|||
pallas::Affine::from_xy(x, y).unwrap()
|
||||
});
|
||||
|
||||
Point::new(ecc_chip.clone(), layouter.namespace(|| "witness g_d"), g_d)?
|
||||
NonIdentityPoint::new(
|
||||
ecc_chip.clone(),
|
||||
layouter.namespace(|| "witness g_d"),
|
||||
g_d,
|
||||
)?
|
||||
};
|
||||
|
||||
// Witness pk_d
|
||||
|
@ -1580,7 +1584,7 @@ mod tests {
|
|||
pallas::Affine::from_xy(x, y).unwrap()
|
||||
});
|
||||
|
||||
Point::new(
|
||||
NonIdentityPoint::new(
|
||||
ecc_chip.clone(),
|
||||
layouter.namespace(|| "witness pk_d"),
|
||||
pk_d,
|
||||
|
@ -1674,7 +1678,11 @@ mod tests {
|
|||
)
|
||||
.unwrap()
|
||||
.to_affine();
|
||||
Point::new(ecc_chip, layouter.namespace(|| "witness g_d"), Some(point))?
|
||||
NonIdentityPoint::new(
|
||||
ecc_chip,
|
||||
layouter.namespace(|| "witness g_d"),
|
||||
Some(point),
|
||||
)?
|
||||
};
|
||||
cm.constrain_equal(layouter.namespace(|| "cm == expected cm"), &expected_cm)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue