Rename into_ -> to_ where &self is used.
This commit is contained in:
parent
91541675e2
commit
fe93f2ff6b
|
@ -66,7 +66,7 @@ impl<E: Engine> AllocatedNum<E> {
|
|||
/// order, requiring that the representation
|
||||
/// strictly exists "in the field" (i.e., a
|
||||
/// congruency is not allowed.)
|
||||
pub fn into_bits_le_strict<CS>(&self, mut cs: CS) -> Result<Vec<Boolean>, SynthesisError>
|
||||
pub fn to_bits_le_strict<CS>(&self, mut cs: CS) -> Result<Vec<Boolean>, SynthesisError>
|
||||
where
|
||||
CS: ConstraintSystem<E>,
|
||||
{
|
||||
|
@ -189,7 +189,7 @@ impl<E: Engine> AllocatedNum<E> {
|
|||
/// Convert the allocated number into its little-endian representation.
|
||||
/// Note that this does not strongly enforce that the commitment is
|
||||
/// "in the field."
|
||||
pub fn into_bits_le<CS>(&self, mut cs: CS) -> Result<Vec<Boolean>, SynthesisError>
|
||||
pub fn to_bits_le<CS>(&self, mut cs: CS) -> Result<Vec<Boolean>, SynthesisError>
|
||||
where
|
||||
CS: ConstraintSystem<E>,
|
||||
{
|
||||
|
@ -522,7 +522,7 @@ mod test {
|
|||
let mut cs = TestConstraintSystem::<Bls12>::new();
|
||||
|
||||
let n = AllocatedNum::alloc(&mut cs, || Ok(negone)).unwrap();
|
||||
n.into_bits_le_strict(&mut cs).unwrap();
|
||||
n.to_bits_le_strict(&mut cs).unwrap();
|
||||
|
||||
assert!(cs.is_satisfied());
|
||||
|
||||
|
@ -550,9 +550,9 @@ mod test {
|
|||
let n = AllocatedNum::alloc(&mut cs, || Ok(r)).unwrap();
|
||||
|
||||
let bits = if i % 2 == 0 {
|
||||
n.into_bits_le(&mut cs).unwrap()
|
||||
n.to_bits_le(&mut cs).unwrap()
|
||||
} else {
|
||||
n.into_bits_le_strict(&mut cs).unwrap()
|
||||
n.to_bits_le_strict(&mut cs).unwrap()
|
||||
};
|
||||
|
||||
assert!(cs.is_satisfied());
|
||||
|
|
|
@ -25,7 +25,7 @@ fn test_key_agreement() {
|
|||
let addr = loop {
|
||||
let mut d = [0; 11];
|
||||
rng.fill_bytes(&mut d);
|
||||
match vk.into_payment_address(Diversifier(d), ¶ms) {
|
||||
match vk.to_payment_address(Diversifier(d), ¶ms) {
|
||||
Some(a) => break a,
|
||||
None => {}
|
||||
}
|
||||
|
|
|
@ -678,7 +678,7 @@ fn key_components() {
|
|||
}
|
||||
|
||||
let pgk = ProofGenerationKey { ak, nsk };
|
||||
let fvk = pgk.into_viewing_key(&JUBJUB);
|
||||
let fvk = pgk.to_viewing_key(&JUBJUB);
|
||||
{
|
||||
let mut vec = Vec::new();
|
||||
fvk.nk.write(&mut vec).unwrap();
|
||||
|
@ -704,7 +704,7 @@ fn key_components() {
|
|||
let diversifier = Diversifier(tv.default_d);
|
||||
assert!(librustzcash_check_diversifier(&tv.default_d));
|
||||
|
||||
let addr = fvk.into_payment_address(diversifier, &JUBJUB).unwrap();
|
||||
let addr = fvk.to_payment_address(diversifier, &JUBJUB).unwrap();
|
||||
{
|
||||
let mut vec = Vec::new();
|
||||
addr.pk_d.write(&mut vec).unwrap();
|
||||
|
|
|
@ -168,7 +168,7 @@ impl<E: JubjubEngine> Point<E, Unknown> {
|
|||
|
||||
impl<E: JubjubEngine, Subgroup> Point<E, Subgroup> {
|
||||
pub fn write<W: Write>(&self, writer: W) -> io::Result<()> {
|
||||
let (x, y) = self.into_xy();
|
||||
let (x, y) = self.to_xy();
|
||||
|
||||
assert_eq!(E::Fr::NUM_BITS, 255);
|
||||
|
||||
|
@ -183,7 +183,7 @@ impl<E: JubjubEngine, Subgroup> Point<E, Subgroup> {
|
|||
|
||||
/// Convert from a Montgomery point
|
||||
pub fn from_montgomery(m: &montgomery::Point<E, Subgroup>, params: &E::Params) -> Self {
|
||||
match m.into_xy() {
|
||||
match m.to_xy() {
|
||||
None => {
|
||||
// Map the point at infinity to the neutral element.
|
||||
Point::zero()
|
||||
|
@ -306,7 +306,7 @@ impl<E: JubjubEngine, Subgroup> Point<E, Subgroup> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn into_xy(&self) -> (E::Fr, E::Fr) {
|
||||
pub fn to_xy(&self) -> (E::Fr, E::Fr) {
|
||||
let zinv = self.z.inverse().unwrap();
|
||||
|
||||
let mut x = self.x;
|
||||
|
|
|
@ -384,7 +384,7 @@ impl JubjubBls12 {
|
|||
|
||||
// coeffs = g, g*2, g*3, g*4
|
||||
for _ in 0..4 {
|
||||
coeffs.push(g.into_xy().expect("cannot produce O"));
|
||||
coeffs.push(g.to_xy().expect("cannot produce O"));
|
||||
g = g.add(&gen, &tmp_params);
|
||||
}
|
||||
windows.push(coeffs);
|
||||
|
@ -411,7 +411,7 @@ impl JubjubBls12 {
|
|||
let mut coeffs = vec![(Fr::zero(), Fr::one())];
|
||||
let mut g = gen.clone();
|
||||
for _ in 0..7 {
|
||||
coeffs.push(g.into_xy());
|
||||
coeffs.push(g.to_xy());
|
||||
g = g.add(&gen, &tmp_params);
|
||||
}
|
||||
windows.push(coeffs);
|
||||
|
|
|
@ -98,7 +98,7 @@ impl<E: JubjubEngine> Point<E, Unknown> {
|
|||
impl<E: JubjubEngine, Subgroup> Point<E, Subgroup> {
|
||||
/// Convert from an Edwards point
|
||||
pub fn from_edwards(e: &edwards::Point<E, Subgroup>, params: &E::Params) -> Self {
|
||||
let (x, y) = e.into_xy();
|
||||
let (x, y) = e.to_xy();
|
||||
|
||||
if y == E::Fr::one() {
|
||||
// The only solution for y = 1 is x = 0. (0, 1) is
|
||||
|
@ -177,7 +177,7 @@ impl<E: JubjubEngine, Subgroup> Point<E, Subgroup> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn into_xy(&self) -> Option<(E::Fr, E::Fr)> {
|
||||
pub fn to_xy(&self) -> Option<(E::Fr, E::Fr)> {
|
||||
if self.infinity {
|
||||
None
|
||||
} else {
|
||||
|
|
|
@ -119,13 +119,13 @@ fn test_mul_associativity<E: JubjubEngine>(params: &E::Params) {
|
|||
assert!(res2 == res3);
|
||||
assert!(res3 == res4);
|
||||
|
||||
let (x, y) = res1.into_xy();
|
||||
let (x, y) = res1.to_xy();
|
||||
assert!(is_on_twisted_edwards_curve(x, y, params));
|
||||
|
||||
let (x, y) = res2.into_xy();
|
||||
let (x, y) = res2.to_xy();
|
||||
assert!(is_on_twisted_edwards_curve(x, y, params));
|
||||
|
||||
let (x, y) = res3.into_xy();
|
||||
let (x, y) = res3.to_xy();
|
||||
assert!(is_on_twisted_edwards_curve(x, y, params));
|
||||
}
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ fn test_get_for<E: JubjubEngine>(params: &E::Params) {
|
|||
let sign = rng.next_u32() % 2 == 1;
|
||||
|
||||
if let Some(mut p) = edwards::Point::<E, _>::get_for_y(y, sign, params) {
|
||||
assert!(p.into_xy().0.into_repr().is_odd() == sign);
|
||||
assert!(p.to_xy().0.into_repr().is_odd() == sign);
|
||||
p = p.negate();
|
||||
assert!(edwards::Point::<E, _>::get_for_y(y, !sign, params).unwrap() == p);
|
||||
}
|
||||
|
@ -274,12 +274,12 @@ fn test_rand<E: JubjubEngine>(params: &E::Params) {
|
|||
let e = edwards::Point::<E, _>::rand(rng, params);
|
||||
|
||||
{
|
||||
let (x, y) = p.into_xy().unwrap();
|
||||
let (x, y) = p.to_xy().unwrap();
|
||||
assert!(is_on_mont_curve(x, y, params));
|
||||
}
|
||||
|
||||
{
|
||||
let (x, y) = e.into_xy();
|
||||
let (x, y) = e.to_xy();
|
||||
assert!(is_on_twisted_edwards_curve(x, y, params));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ pub struct ProofGenerationKey<E: JubjubEngine> {
|
|||
}
|
||||
|
||||
impl<E: JubjubEngine> ProofGenerationKey<E> {
|
||||
pub fn into_viewing_key(&self, params: &E::Params) -> ViewingKey<E> {
|
||||
pub fn to_viewing_key(&self, params: &E::Params) -> ViewingKey<E> {
|
||||
ViewingKey {
|
||||
ak: self.ak.clone(),
|
||||
nk: params
|
||||
|
@ -89,7 +89,7 @@ impl<E: JubjubEngine> ViewingKey<E> {
|
|||
E::Fs::from_repr(e).expect("should be a valid scalar")
|
||||
}
|
||||
|
||||
pub fn into_payment_address(
|
||||
pub fn to_payment_address(
|
||||
&self,
|
||||
diversifier: Diversifier,
|
||||
params: &E::Params,
|
||||
|
@ -242,6 +242,6 @@ impl<E: JubjubEngine> Note<E> {
|
|||
pub fn cm(&self, params: &E::Params) -> E::Fr {
|
||||
// The commitment is in the prime order subgroup, so mapping the
|
||||
// commitment to the x-coordinate is an injective encoding.
|
||||
self.cm_full_point(params).into_xy().0
|
||||
self.cm_full_point(params).to_xy().0
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ pub fn merkle_hash(depth: usize, lhs: &FrRepr, rhs: &FrRepr) -> FrRepr {
|
|||
.chain(rhs.iter().copied().take(Fr::NUM_BITS as usize)),
|
||||
&JUBJUB,
|
||||
)
|
||||
.into_xy()
|
||||
.to_xy()
|
||||
.0
|
||||
.into_repr()
|
||||
}
|
||||
|
|
|
@ -394,7 +394,7 @@ impl<R: RngCore + CryptoRng> Builder<R> {
|
|||
|
||||
let mut nullifier = [0u8; 32];
|
||||
nullifier.copy_from_slice(&spend.note.nf(
|
||||
&proof_generation_key.into_viewing_key(&JUBJUB),
|
||||
&proof_generation_key.to_viewing_key(&JUBJUB),
|
||||
spend.witness.position,
|
||||
&JUBJUB,
|
||||
));
|
||||
|
|
|
@ -434,7 +434,7 @@ impl ExtendedFullViewingKey {
|
|||
Ok(ret) => ret,
|
||||
Err(()) => return Err(()),
|
||||
};
|
||||
match self.fvk.vk.into_payment_address(d_j, &JUBJUB) {
|
||||
match self.fvk.vk.to_payment_address(d_j, &JUBJUB) {
|
||||
Some(addr) => Ok((j, addr)),
|
||||
None => Err(()),
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ fn main() {
|
|||
nsk: nsk.clone(),
|
||||
};
|
||||
|
||||
let viewing_key = proof_generation_key.into_viewing_key(jubjub_params);
|
||||
let viewing_key = proof_generation_key.to_viewing_key(jubjub_params);
|
||||
|
||||
let payment_address;
|
||||
|
||||
|
@ -61,7 +61,7 @@ fn main() {
|
|||
Diversifier(d)
|
||||
};
|
||||
|
||||
if let Some(p) = viewing_key.into_payment_address(diversifier, jubjub_params) {
|
||||
if let Some(p) = viewing_key.to_payment_address(diversifier, jubjub_params) {
|
||||
payment_address = p;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -121,9 +121,9 @@ impl<E: JubjubEngine> EdwardsPoint<E> {
|
|||
{
|
||||
let mut tmp = vec![];
|
||||
|
||||
let x = self.x.into_bits_le_strict(cs.namespace(|| "unpack x"))?;
|
||||
let x = self.x.to_bits_le_strict(cs.namespace(|| "unpack x"))?;
|
||||
|
||||
let y = self.y.into_bits_le_strict(cs.namespace(|| "unpack y"))?;
|
||||
let y = self.y.to_bits_le_strict(cs.namespace(|| "unpack y"))?;
|
||||
|
||||
tmp.extend(y);
|
||||
tmp.push(x[0].clone());
|
||||
|
@ -141,7 +141,7 @@ impl<E: JubjubEngine> EdwardsPoint<E> {
|
|||
where
|
||||
CS: ConstraintSystem<E>,
|
||||
{
|
||||
let p = p.map(|p| p.into_xy());
|
||||
let p = p.map(|p| p.to_xy());
|
||||
|
||||
// Allocate x
|
||||
let x = AllocatedNum::alloc(cs.namespace(|| "x"), || Ok(p.get()?.0))?;
|
||||
|
@ -688,8 +688,8 @@ mod test {
|
|||
let mut cs = TestConstraintSystem::<Bls12>::new();
|
||||
|
||||
let p = montgomery::Point::<Bls12, _>::rand(rng, params);
|
||||
let (u, v) = edwards::Point::from_montgomery(&p, params).into_xy();
|
||||
let (x, y) = p.into_xy().unwrap();
|
||||
let (u, v) = edwards::Point::from_montgomery(&p, params).to_xy();
|
||||
let (x, y) = p.to_xy().unwrap();
|
||||
|
||||
let numx = AllocatedNum::alloc(cs.namespace(|| "mont x"), || Ok(x)).unwrap();
|
||||
let numy = AllocatedNum::alloc(cs.namespace(|| "mont y"), || Ok(y)).unwrap();
|
||||
|
@ -728,7 +728,7 @@ mod test {
|
|||
let mut cs = TestConstraintSystem::<Bls12>::new();
|
||||
let q = EdwardsPoint::witness(&mut cs, Some(p.clone()), ¶ms).unwrap();
|
||||
|
||||
let p = p.into_xy();
|
||||
let p = p.to_xy();
|
||||
|
||||
assert!(cs.is_satisfied());
|
||||
assert_eq!(q.x.get_value().unwrap(), p.0);
|
||||
|
@ -737,7 +737,7 @@ mod test {
|
|||
|
||||
for _ in 0..100 {
|
||||
let p = edwards::Point::<Bls12, _>::rand(rng, ¶ms);
|
||||
let (x, y) = p.into_xy();
|
||||
let (x, y) = p.to_xy();
|
||||
|
||||
let mut cs = TestConstraintSystem::<Bls12>::new();
|
||||
let numx = AllocatedNum::alloc(cs.namespace(|| "x"), || Ok(x)).unwrap();
|
||||
|
@ -779,7 +779,7 @@ mod test {
|
|||
let p = params.generator(FixedGenerators::NoteCommitmentRandomness);
|
||||
let s = Fs::random(rng);
|
||||
let q = p.mul(s, params);
|
||||
let (x1, y1) = q.into_xy();
|
||||
let (x1, y1) = q.to_xy();
|
||||
|
||||
let mut s_bits = BitIterator::new(s.into_repr()).collect::<Vec<_>>();
|
||||
s_bits.reverse();
|
||||
|
@ -823,8 +823,8 @@ mod test {
|
|||
let s = Fs::random(rng);
|
||||
let q = p.mul(s, params);
|
||||
|
||||
let (x0, y0) = p.into_xy();
|
||||
let (x1, y1) = q.into_xy();
|
||||
let (x0, y0) = p.to_xy();
|
||||
let (x1, y1) = q.to_xy();
|
||||
|
||||
let num_x0 = AllocatedNum::alloc(cs.namespace(|| "x0"), || Ok(x0)).unwrap();
|
||||
let num_y0 = AllocatedNum::alloc(cs.namespace(|| "y0"), || Ok(y0)).unwrap();
|
||||
|
@ -873,7 +873,7 @@ mod test {
|
|||
|
||||
let p = edwards::Point::<Bls12, _>::rand(rng, params);
|
||||
|
||||
let (x0, y0) = p.into_xy();
|
||||
let (x0, y0) = p.to_xy();
|
||||
|
||||
let num_x0 = AllocatedNum::alloc(cs.namespace(|| "x0"), || Ok(x0)).unwrap();
|
||||
let num_y0 = AllocatedNum::alloc(cs.namespace(|| "y0"), || Ok(y0)).unwrap();
|
||||
|
@ -941,9 +941,9 @@ mod test {
|
|||
|
||||
let p3 = p1.add(&p2, params);
|
||||
|
||||
let (x0, y0) = p1.into_xy();
|
||||
let (x1, y1) = p2.into_xy();
|
||||
let (x2, y2) = p3.into_xy();
|
||||
let (x0, y0) = p1.to_xy();
|
||||
let (x1, y1) = p2.to_xy();
|
||||
let (x2, y2) = p3.to_xy();
|
||||
|
||||
let mut cs = TestConstraintSystem::<Bls12>::new();
|
||||
|
||||
|
@ -1002,8 +1002,8 @@ mod test {
|
|||
let p1 = edwards::Point::<Bls12, _>::rand(rng, params);
|
||||
let p2 = p1.double(params);
|
||||
|
||||
let (x0, y0) = p1.into_xy();
|
||||
let (x1, y1) = p2.into_xy();
|
||||
let (x0, y0) = p1.to_xy();
|
||||
let (x1, y1) = p2.to_xy();
|
||||
|
||||
let mut cs = TestConstraintSystem::<Bls12>::new();
|
||||
|
||||
|
@ -1053,9 +1053,9 @@ mod test {
|
|||
|
||||
let p3 = p1.add(&p2, params);
|
||||
|
||||
let (x0, y0) = p1.into_xy().unwrap();
|
||||
let (x1, y1) = p2.into_xy().unwrap();
|
||||
let (x2, y2) = p3.into_xy().unwrap();
|
||||
let (x0, y0) = p1.to_xy().unwrap();
|
||||
let (x1, y1) = p2.to_xy().unwrap();
|
||||
let (x2, y2) = p3.to_xy().unwrap();
|
||||
|
||||
let mut cs = TestConstraintSystem::<Bls12>::new();
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ mod test {
|
|||
input.clone().into_iter(),
|
||||
params,
|
||||
)
|
||||
.into_xy();
|
||||
.to_xy();
|
||||
|
||||
assert_eq!(res.get_x().get_value().unwrap(), expected.0);
|
||||
assert_eq!(res.get_y().get_value().unwrap(), expected.1);
|
||||
|
@ -200,7 +200,7 @@ mod test {
|
|||
input.into_iter(),
|
||||
params,
|
||||
)
|
||||
.into_xy();
|
||||
.to_xy();
|
||||
|
||||
assert!(res.get_x().get_value().unwrap() != unexpected.0);
|
||||
assert!(res.get_y().get_value().unwrap() != unexpected.1);
|
||||
|
|
|
@ -336,8 +336,8 @@ impl<'a, E: JubjubEngine> Circuit<E> for Spend<'a, E> {
|
|||
// they will be unable to find an authentication path in the
|
||||
// tree with high probability.
|
||||
let mut preimage = vec![];
|
||||
preimage.extend(xl.into_bits_le(cs.namespace(|| "xl into bits"))?);
|
||||
preimage.extend(xr.into_bits_le(cs.namespace(|| "xr into bits"))?);
|
||||
preimage.extend(xl.to_bits_le(cs.namespace(|| "xl into bits"))?);
|
||||
preimage.extend(xr.to_bits_le(cs.namespace(|| "xr into bits"))?);
|
||||
|
||||
// Compute the new subtree value
|
||||
cur = pedersen_hash::pedersen_hash(
|
||||
|
@ -464,7 +464,7 @@ impl<'a, E: JubjubEngine> Circuit<E> for Output<'a, E> {
|
|||
// they would like.
|
||||
{
|
||||
// Just grab pk_d from the witness
|
||||
let pk_d = self.payment_address.as_ref().map(|e| e.pk_d.into_xy());
|
||||
let pk_d = self.payment_address.as_ref().map(|e| e.pk_d.to_xy());
|
||||
|
||||
// Witness the y-coordinate, encoded as little
|
||||
// endian bits (to match the representation)
|
||||
|
@ -567,7 +567,7 @@ fn test_input_circuit_with_bls12_381() {
|
|||
nsk: nsk.clone(),
|
||||
};
|
||||
|
||||
let viewing_key = proof_generation_key.into_viewing_key(params);
|
||||
let viewing_key = proof_generation_key.to_viewing_key(params);
|
||||
|
||||
let payment_address;
|
||||
|
||||
|
@ -578,7 +578,7 @@ fn test_input_circuit_with_bls12_381() {
|
|||
Diversifier(d)
|
||||
};
|
||||
|
||||
if let Some(p) = viewing_key.into_payment_address(diversifier, params) {
|
||||
if let Some(p) = viewing_key.to_payment_address(diversifier, params) {
|
||||
payment_address = p;
|
||||
break;
|
||||
}
|
||||
|
@ -590,8 +590,8 @@ fn test_input_circuit_with_bls12_381() {
|
|||
let ar = fs::Fs::random(rng);
|
||||
|
||||
{
|
||||
let rk = viewing_key.rk(ar, params).into_xy();
|
||||
let expected_value_cm = value_commitment.cm(params).into_xy();
|
||||
let rk = viewing_key.rk(ar, params).to_xy();
|
||||
let expected_value_cm = value_commitment.cm(params).to_xy();
|
||||
let note = Note {
|
||||
value: value_commitment.value,
|
||||
g_d: g_d.clone(),
|
||||
|
@ -626,7 +626,7 @@ fn test_input_circuit_with_bls12_381() {
|
|||
.chain(rhs.into_iter().take(Fr::NUM_BITS as usize)),
|
||||
params,
|
||||
)
|
||||
.into_xy()
|
||||
.to_xy()
|
||||
.0;
|
||||
|
||||
if b {
|
||||
|
@ -714,7 +714,7 @@ fn test_output_circuit_with_bls12_381() {
|
|||
nsk: nsk.clone(),
|
||||
};
|
||||
|
||||
let viewing_key = proof_generation_key.into_viewing_key(params);
|
||||
let viewing_key = proof_generation_key.to_viewing_key(params);
|
||||
|
||||
let payment_address;
|
||||
|
||||
|
@ -725,7 +725,7 @@ fn test_output_circuit_with_bls12_381() {
|
|||
Diversifier(d)
|
||||
};
|
||||
|
||||
if let Some(p) = viewing_key.into_payment_address(diversifier, params) {
|
||||
if let Some(p) = viewing_key.to_payment_address(diversifier, params) {
|
||||
payment_address = p;
|
||||
break;
|
||||
}
|
||||
|
@ -759,13 +759,13 @@ fn test_output_circuit_with_bls12_381() {
|
|||
.expect("should be valid")
|
||||
.cm(params);
|
||||
|
||||
let expected_value_cm = value_commitment.cm(params).into_xy();
|
||||
let expected_value_cm = value_commitment.cm(params).to_xy();
|
||||
|
||||
let expected_epk = payment_address
|
||||
.g_d(params)
|
||||
.expect("should be valid")
|
||||
.mul(esk, params);
|
||||
let expected_epk_xy = expected_epk.into_xy();
|
||||
let expected_epk_xy = expected_epk.to_xy();
|
||||
|
||||
assert_eq!(cs.num_inputs(), 6);
|
||||
assert_eq!(cs.get_input(0, "ONE"), Fr::one());
|
||||
|
|
|
@ -79,10 +79,10 @@ impl SaplingProvingContext {
|
|||
};
|
||||
|
||||
// Construct the viewing key
|
||||
let viewing_key = proof_generation_key.into_viewing_key(params);
|
||||
let viewing_key = proof_generation_key.to_viewing_key(params);
|
||||
|
||||
// Construct the payment address with the viewing key / diversifier
|
||||
let payment_address = match viewing_key.into_payment_address(diversifier, params) {
|
||||
let payment_address = match viewing_key.to_payment_address(diversifier, params) {
|
||||
Some(p) => p,
|
||||
None => return Err(()),
|
||||
};
|
||||
|
@ -130,12 +130,12 @@ impl SaplingProvingContext {
|
|||
// Construct public input for circuit
|
||||
let mut public_input = [Fr::zero(); 7];
|
||||
{
|
||||
let (x, y) = rk.0.into_xy();
|
||||
let (x, y) = rk.0.to_xy();
|
||||
public_input[0] = x;
|
||||
public_input[1] = y;
|
||||
}
|
||||
{
|
||||
let (x, y) = value_commitment.cm(params).into_xy();
|
||||
let (x, y) = value_commitment.cm(params).to_xy();
|
||||
public_input[2] = x;
|
||||
public_input[3] = y;
|
||||
}
|
||||
|
|
|
@ -82,12 +82,12 @@ impl SaplingVerificationContext {
|
|||
// Construct public input for circuit
|
||||
let mut public_input = [Fr::zero(); 7];
|
||||
{
|
||||
let (x, y) = rk.0.into_xy();
|
||||
let (x, y) = rk.0.to_xy();
|
||||
public_input[0] = x;
|
||||
public_input[1] = y;
|
||||
}
|
||||
{
|
||||
let (x, y) = cv.into_xy();
|
||||
let (x, y) = cv.to_xy();
|
||||
public_input[2] = x;
|
||||
public_input[3] = y;
|
||||
}
|
||||
|
@ -146,12 +146,12 @@ impl SaplingVerificationContext {
|
|||
// Construct public input for circuit
|
||||
let mut public_input = [Fr::zero(); 5];
|
||||
{
|
||||
let (x, y) = cv.into_xy();
|
||||
let (x, y) = cv.to_xy();
|
||||
public_input[0] = x;
|
||||
public_input[1] = y;
|
||||
}
|
||||
{
|
||||
let (x, y) = epk.into_xy();
|
||||
let (x, y) = epk.to_xy();
|
||||
public_input[2] = x;
|
||||
public_input[3] = y;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue