diff --git a/zebra-chain/src/orchard/commitment.rs b/zebra-chain/src/orchard/commitment.rs index 3adf0c313..72a07c3bc 100644 --- a/zebra-chain/src/orchard/commitment.rs +++ b/zebra-chain/src/orchard/commitment.rs @@ -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) } } diff --git a/zebra-chain/src/orchard/sinsemilla.rs b/zebra-chain/src/orchard/sinsemilla.rs index 1528a14b8..8d53efaab 100644 --- a/zebra-chain/src/orchard/sinsemilla.rs +++ b/zebra-chain/src/orchard/sinsemilla.rs @@ -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.