Tried and discarded lazy_static! of value commitment generator points

This commit is contained in:
Deirdre Connolly 2021-04-04 23:23:21 -04:00 committed by Deirdre Connolly
parent 638ff8d7f8
commit 8d357faf73
2 changed files with 2 additions and 5 deletions

View File

@ -321,13 +321,11 @@ impl ValueCommitment {
/// https://zips.z.cash/protocol/protocol.pdf#concretehomomorphiccommit
#[allow(non_snake_case)]
pub fn new(rcv: pallas::Scalar, value: Amount) -> Self {
let v = pallas::Scalar::from(value);
// TODO: These generator points can be generated once somewhere else to
// avoid having to recompute them on every new commitment.
let V = pallas_group_hash(b"z.cash:Orchard-cv", b"v");
let R = pallas_group_hash(b"z.cash:Orchard-cv", b"r");
let v = pallas::Scalar::from(value);
Self::from(V * v + R * rcv)
}
}

View File

@ -12,7 +12,6 @@ use halo2::{
/// P → B^[l^Orchard_Merkle]
///
/// [concreteextractorpallas]: https://zips.z.cash/protocol/nu5.pdf#concreteextractorpallas
// TODO: should this return the basefield element type, or the bytes?
pub fn extract_p(point: pallas::Point) -> pallas::Base {
match pallas::Affine::from(point).get_xy().into() {
// If Some, it's not the identity.