Tried and discarded lazy_static! of value commitment generator points
This commit is contained in:
parent
638ff8d7f8
commit
8d357faf73
|
|
@ -321,13 +321,11 @@ impl ValueCommitment {
|
||||||
/// https://zips.z.cash/protocol/protocol.pdf#concretehomomorphiccommit
|
/// https://zips.z.cash/protocol/protocol.pdf#concretehomomorphiccommit
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn new(rcv: pallas::Scalar, value: Amount) -> Self {
|
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 V = pallas_group_hash(b"z.cash:Orchard-cv", b"v");
|
||||||
let R = pallas_group_hash(b"z.cash:Orchard-cv", b"r");
|
let R = pallas_group_hash(b"z.cash:Orchard-cv", b"r");
|
||||||
|
|
||||||
|
let v = pallas::Scalar::from(value);
|
||||||
|
|
||||||
Self::from(V * v + R * rcv)
|
Self::from(V * v + R * rcv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ use halo2::{
|
||||||
/// P → B^[l^Orchard_Merkle]
|
/// P → B^[l^Orchard_Merkle]
|
||||||
///
|
///
|
||||||
/// [concreteextractorpallas]: https://zips.z.cash/protocol/nu5.pdf#concreteextractorpallas
|
/// [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 {
|
pub fn extract_p(point: pallas::Point) -> pallas::Base {
|
||||||
match pallas::Affine::from(point).get_xy().into() {
|
match pallas::Affine::from(point).get_xy().into() {
|
||||||
// If Some, it's not the identity.
|
// If Some, it's not the identity.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue