Commit Graph

37 Commits

Author SHA1 Message Date
Kris Nuttycombe 2945905d52 Implement manual serialization for incremental Merkle tree components.
This also adds parsing of the legacy CommitmentTree format,
to permit easy migration of persisted data.
2021-08-05 09:32:44 -06:00
Kris Nuttycombe 62bd06f14e Apply suggestions from code review
Co-authored-by: str4d <jack@electriccoin.co>
2021-06-01 07:03:31 -06:00
Kris Nuttycombe 936b552de2 Add NoteValue newtype, Nullifier::as_ref and proptest generation. 2021-06-01 07:03:31 -06:00
Daira Hopwood da431a0eb2
rustfmt fix 2021-05-03 14:08:06 +01:00
narodnik 618a6165c7 Replace redundant code with call to Field::random() which does the same as the code. 2021-05-03 13:34:13 +02:00
Kris Nuttycombe e77839232d Generalize note encryption and decryption.
This commit introduces a `Domain` trait which defines the types
and operations that are shared between Sapling and Orchard note
encryption and decryption processes.
2021-04-08 08:19:10 -06:00
Kris Nuttycombe 5baccdf052 Move note_encryption into the sapling module. 2021-04-08 08:19:10 -06:00
Kris Nuttycombe 33effb7d67 Move sapling keys into sapling module. 2021-03-27 16:18:21 +13:00
Kris Nuttycombe 4086df772c Move sapling-specific primitives into the sapling module. 2021-03-27 16:18:21 +13:00
Kris Nuttycombe bc087a5ff7 Move pedersen hashes to sapling module. 2021-03-27 16:18:21 +13:00
Kris Nuttycombe 88d58aac0a Move relevant utils into sapling module. 2021-03-27 16:18:21 +13:00
Kris Nuttycombe 16948d9d78 Move zcash_primitives::prover to sapling module 2021-03-27 16:18:21 +13:00
Kris Nuttycombe bf97b21632 Move redjubjub to sapling module. 2021-03-27 16:18:21 +13:00
Kris Nuttycombe de1345a1c2 Move group_hash to sapling module. 2021-03-27 16:18:21 +13:00
Kris Nuttycombe cf0c3ea90f Relax RngCore type constraints.
The intent of this change is to permit tests to use deterministic
random sources, rather than cryptographically strong ones.
2020-12-14 13:44:05 -07:00
Jack Grigg 96bd59b942 Migrate to ff 0.8 and bellman 0.8
bellman 0.8 includes fixes for several performance regressions.

MSRV is now 1.44.0, matching the ff crate.
2020-09-09 00:27:51 +01:00
Jack Grigg ed3489a111 zcash_primitives: Explicitly type zero-initialised arrays 2020-08-21 18:22:29 +01:00
Jack Grigg fdf06032e3 s/{pairing::bls12_381, zcash_primitives::jubjub}/{bls12_381, jubjub}
FINALLY.
2020-08-19 23:08:19 +01:00
Jack Grigg c597db59a6 ff: Rename PrimeField::into_repr -> PrimeField::to_repr 2020-05-02 18:55:13 +12:00
Jack Grigg 49f119fb03 ff: Remove PrimeFieldRepr trait
The ff::PrimeField::Repr associated type now has the minimal necessary
bounds, which can be satisfied by a newtype around a byte array.
2020-04-23 18:15:14 +12:00
Jack Grigg 232f0a50b8 ff: Rework BitIterator to work with both u8 and u64 limb sizes
This enables BitIterator to be used with both the byte encoding and limb
representation of scalars.
2020-04-23 16:23:24 +12:00
NikVolf 7844394364 Remove unneeded extern crate 2019-10-08 16:12:14 +03:00
Jack Grigg fe93f2ff6b
Rename into_ -> to_ where &self is used. 2019-08-24 00:39:54 +01:00
Jack Grigg 3a8efd9e67
Address various clippy warnings/errors in zcash_primitives 2019-08-24 00:39:49 +01:00
Eirik Ogilvie-Wigley b0d8747697 cargo fix --edition for zcash_primitives 2019-08-20 17:15:07 -06:00
Eirik Ogilvie-Wigley 81c58172c3 cargo fmt zcash_primitives 2019-08-15 10:39:55 -06:00
Jack Grigg 5fb9b86ba0
Move Jubjub, Pedersen hash and primitives into zcash_primitives 2019-08-14 10:47:22 +01:00
Jack Grigg 2ae5804a67
Move Sprout and Sapling circuits into zcash_proofs 2019-08-14 10:45:55 +01:00
Jack Grigg 7ea6d10480
Move redjubjub into zcash_primitives 2019-08-14 10:43:25 +01:00
Jack Grigg 17f6bbcc67
Pass tx builder RNG to spend_sig() 2019-07-27 00:35:04 +01:00
Jack Grigg 6f9083b5ab
Migrate to rand 0.7 2019-07-19 00:47:40 +02:00
Jack Grigg 8f7adec0d9
Migrate zcash_primitives to rand_core 0.4 2019-07-19 00:46:37 +02:00
Jack Grigg 79006ecbdf
Unify Sapling tree depth constants
When sapling-crypto is refactored, the zcash_primitives::sapling
constant would become the canonical one.
2019-07-10 13:53:22 -04:00
Jack Grigg e67560b154
Document merkle_tree module 2019-07-10 13:53:22 -04:00
Jack Grigg b9cea33804
Move merkle_tree::Node into sapling module
This makes the merkle_tree module properly generic over the tree hash.
It still hard-codes a depth 32 tree, because Rust doesn't yet support
generic sizes, and we are unlikely to need to alter the tree depth in
future circuit changes.
2019-07-10 13:53:22 -04:00
Jack Grigg 785f22ca5a
Move Sapling commitment tree hash into zcash_primitives 2019-07-10 13:44:19 -04:00
Jack Grigg 6b43b2d0d6
Refactor Sapling spendAuthSig creation into zcash_primitives::sapling 2019-02-26 13:44:28 -07:00