From dfb10ab10fd793cdee0342c91931439f613b7289 Mon Sep 17 00:00:00 2001 From: Deirdre Connolly Date: Tue, 14 Jul 2020 05:04:45 -0400 Subject: [PATCH] Add NoteCommitment.extract_u() --- zebra-chain/src/notes/sapling.rs | 9 +++++++++ zebra-chain/src/transaction/tests/arbitrary.rs | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/zebra-chain/src/notes/sapling.rs b/zebra-chain/src/notes/sapling.rs index e78bab71..788033f4 100644 --- a/zebra-chain/src/notes/sapling.rs +++ b/zebra-chain/src/notes/sapling.rs @@ -109,6 +109,15 @@ impl ZcashDeserialize for NoteCommitment { } } +impl NoteCommitment { + /// Hash Extractor for Jubjub (?) + /// + /// https://zips.z.cash/protocol/protocol.pdf#concreteextractorjubjub + pub fn extract_u(self) -> jubjub::Fq { + self.0.get_u() + } +} + /// The decrypted form of encrypted Sapling notes on the blockchain. pub struct NotePlaintext { diversifier: Diversifier, diff --git a/zebra-chain/src/transaction/tests/arbitrary.rs b/zebra-chain/src/transaction/tests/arbitrary.rs index e4aeef75..7aba6e3b 100644 --- a/zebra-chain/src/transaction/tests/arbitrary.rs +++ b/zebra-chain/src/transaction/tests/arbitrary.rs @@ -106,7 +106,7 @@ impl Arbitrary for Output { .prop_map( |(cv, cm, ephemeral_key_bytes, enc_ciphertext, out_ciphertext, zkproof)| Self { cv, - cm_u: cm.0.get_u(), + cm_u: cm.extract_u(), ephemeral_key: jubjub::AffinePoint::from_bytes(ephemeral_key_bytes).unwrap(), enc_ciphertext, out_ciphertext,