Commit Graph

205 Commits

Author SHA1 Message Date
Jack Grigg d5a375919d blake2{b,s}_simd 1 2021-12-17 23:44:06 +00:00
Jack Grigg 3d6bd8731d directories 4 2021-09-22 22:16:18 +01:00
Jack Grigg e3061e1d72 zcash_proofs: Use bellman 0.11.1 to fix non-multicore compilation bug 2021-09-13 16:20:59 +01:00
Jack Grigg 65e1d32774 ff 0.11, group 0.11, etc. 2021-09-09 18:20:37 +01:00
Jack Grigg 0f15743200 Disable default benchmark harness for all workspace crates
This is necessary in order to provide criterion-specific arguments to
`cargo bench`, such as `--profile-time`.
2021-08-05 22:39:36 +01:00
Jack Grigg e2fb5e6402 Impl ZIP 216 on SaplingVerificationContext and redjubjub::PublicKey
`PublicKey::verify` now always uses post-ZIP 216 validation rules, which
is fine in non-consensus contexts.

`SaplingVerificationContext` is used by `zcashd`'s consensus rules.
2021-06-06 23:45:15 +01:00
Jack Grigg 4aa83d3048 bellman 0.10 2021-06-04 22:20:25 +01:00
Jack Grigg 1222391dd7 Migrate to bitvec 0.22, ff 0.10, etc.
Requires patching three dependencies:

- bellman is pending a new release.
- nom is part of the funty breakage; we are blocking on a new release.
- orchard is in development.
2021-06-04 22:02:48 +01:00
Jack Grigg 5623e02a7c Migrate to ff 0.9 et al. 2021-05-19 18:29:37 +01:00
Jack Grigg 63db2729e9 Temporarily allow clippy::result_unit_err lint
Fixing these lints is deferred to zcash/librustzcash#367.
2021-03-27 19:01:03 +13:00
Jack Grigg 636845d0f9 Renames to use lower-case abbreviations (matching Rust convention)
As of our MSRV bump to 1.51.0, we get lints for this.
2021-03-27 19:01:03 +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 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
Jack Grigg 38f7a0330c Fix various clippy lints
The remainder will be fixed after the refactor PRs are merged.
2021-03-27 08:50:40 +13:00
Jack Grigg 9d9c0579f8 Use new name for broken_intra_doc_links lint
We also add the lint to crates in the workspace that didn't have it.

Closes zcash/librustzcash#279.
2021-03-27 08:27:17 +13:00
Jack Grigg afa0b29e62 Bump MSRV to 1.51.0
This is the MSRV for the orchard crate, which we will be depending on
soon.
2021-03-27 08:21:45 +13:00
Jack Grigg 813525f0b5 zcash_proofs 0.5.0 2021-03-26 18:53:42 +13:00
Jack Grigg 725699c76b zcash_primitives 0.5.0 2021-03-26 18:51:35 +13:00
Jack Grigg 464b533937 Bump MSRV to 1.47.0
We'll be needing it shortly for ff et al.
2021-03-04 17:32:57 +00:00
Jack Grigg 1f6f45bbe7 Add details of unreleased changes to changelogs 2021-02-22 16:59:07 +00:00
str4d 9f14c757e6
Merge pull request #340 from str4d/changelogs
Add changelogs to the crates
2021-02-14 02:34:20 +13:00
Jack Grigg bd3e18984c Changelogs: s/project/library 2021-02-04 15:16:32 +00:00
Jack Grigg b5c7d7f1e7 Add changelogs to the crates
The changelogs are accurate for the 0.4.0 release tag, but don't yet
include changes before or after that tag.
2021-02-04 15:13:22 +00:00
Kris Nuttycombe 3423b03c6d Fix a couple more lints. 2021-02-04 07:31:00 -07:00
Kris Nuttycombe 98530184c0 Fix clippy complaints. 2021-02-03 14:27:31 -07:00
François Garillot f5b6fa6dfb
Removes a panic in synthesis
The error case - a witness_256 failure - is folded in the SynthesisError case of its enclosing result.

The panic was found with [comby-rust](https://github.com/huitseeker/comby-rust/blob/master/nopanic.toml) (using the nopanic template).
2021-02-01 13:37:56 -05:00
Kris Nuttycombe 7d92150965 Fix test compilation with WalletWrite changes. 2021-01-11 18:13:40 -07:00
Kris Nuttycombe aad2e174c1 Consistently use nullifier and AccountId newtypes. 2021-01-08 21:49:38 -07:00
Jack Grigg 91796adcda Remove wrapping closures around mapping functions 2020-10-30 14:10:35 +00:00
Jack Grigg 025deda712 impl Default for T on types with T::new() 2020-10-30 14:10:35 +00:00
Jack Grigg 44cbc6cc6d Remove unnecessary references 2020-10-30 14:10:35 +00:00
Jack Grigg 0cb51f963c Remove unnecessary clones 2020-10-30 13:51:40 +00:00
adityapk00 b8aa2d9169 Build prover with byte arrays of params 2020-10-20 11:49:42 -07:00
narodnik 6297087a5d Mark EDWARDS_D, MONTGOMERY_A, MONTGOMERY_SCALE and PEDERSEN_CIRCUIT_GENERATORS as public only within the crate. 2020-09-21 22:59:38 +02:00
narodnik 81e3ab1c91 make fixed generator functions publicly accessible 2020-09-20 21:01:39 +02:00
Sean Bowe d4cba74402
Version bump 0.4.0 for crates
Bumps zcash_proofs, zcash_primitives, zcash_client_backend to 0.4.0
Also bumps zcash_client_sqlite to 0.2.0
2020-09-09 14:41:19 -06:00
Jack Grigg 59e26a0c0f bls12_381 0.3.1 and jubjub 0.5.1 2020-09-09 16:51:53 +01: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
str4d a602769549
Merge pull request #285 from str4d/282-criterion
zcash_proof: Migrate benchmark to criterion
2020-09-03 02:42:10 +12:00
Jack Grigg 9acf763b8f zcash_proof: Migrate benchmark to criterion
Closes zcash/librustzcash#282.
2020-08-31 17:13:39 +01:00
Jack Grigg 3f06d92eec Depend on published versions of subtree crates 2020-08-27 23:25:20 +01:00
Jack Grigg 9ce0994f0b zcash_proofs 0.3.0 2020-08-23 16:23:53 +01:00
Jack Grigg e25a7dacdf zcash_primitives 0.3.0 2020-08-23 16:23:53 +01:00
Jack Grigg 1124eb3ca9 bellman 0.7.0 2020-08-23 16:23:53 +01:00
Jack Grigg d112add8a3 jubjub 0.4.0 2020-08-23 16:23:53 +01:00
Jack Grigg 5f99c52143 bls12_381 0.2.0 2020-08-23 16:23:53 +01:00
Jack Grigg bdb42bcbc8 pairing 0.17.0 2020-08-23 15:31:09 +01:00
Jack Grigg ee3e8fbfbb group 0.7.0 2020-08-23 15:31:09 +01:00
Jack Grigg 55fa366730 ff 0.7.0 2020-08-23 15:31:09 +01:00
Jack Grigg cda56ef862 zcash_proofs: Add feature flags to docs.rs documentation 2020-08-23 12:12:11 +01:00
Daira Hopwood 74abb88dce Fix some comments.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-08-22 01:28:13 +01:00
Daira Hopwood 9e0041c497 Consistently use (u, v) for affine-ctEdwards coordinates.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-08-22 01:28:13 +01:00
Daira Hopwood cfed47c176 Rename ValueCommitment.cm() to .commitment() (because it's confusing to have cm referring to both note and value commitments).
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-08-22 01:28:13 +01:00
Daira Hopwood 20c5096793 Fix remaining cases of cm -> cmu.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-08-22 01:28:13 +01:00
Jack Grigg 24c61f9417 zcash_proofs: Remove unnecessary comment
Likely left over from the Sapling audit.
2020-08-21 18:37:51 +01:00
Jack Grigg d15acf8acc zcash_primitives: Rename Note::cm to Note::cmu 2020-08-21 18:35:04 +01:00
Jack Grigg b9a8e1e415 zcash_primitives: Remove Jubjub implementation
We now use the jubjub crate for this.
2020-08-19 23:08:19 +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 315f00d6d4 zcash_proofs: Define generator constants using new crates
Includes tests to ensure that the new generator constants match the
current zcash_primitives::JUBJUB generators.
2020-08-19 23:08:19 +01:00
Jack Grigg e210a80350 zcash_proofs: directories 3 2020-08-14 17:44:17 +01:00
Daira Hopwood 81c3b54b24
Merge pull request #258 from therealyingtong/zip212-esk-plaintext-impl
ZIP212 implementation
2020-08-12 10:19:08 +01:00
Henry de Valence 139fc09f10
bellman: add VerificationError (#254)
* bellman: add VerificationError

This adds a distinct VerificationError type to the crate and changes
`verify_proof` to return `Result<(), VerificationError>` rather than
`Result<bool, SynthesisError>`.  This is significantly safer, because it avoids
the need to mix pattern-matching logic with boolean logic (the cause of
RUSTSEC-2019-0004).

* Rename VerificationError variants per review comments.

* Add missing Clone impl to VerificationError.
2020-08-05 22:26:31 +12:00
therealyingtong 0a47a9dbea
Pass rseed to Prover 2020-08-04 16:40:53 +08:00
therealyingtong 895e251793
Fix tests 2020-07-31 22:40:48 +08:00
therealyingtong 65504d9ca7
Add enum Rseed<E::Fs> to Note struct 2020-07-31 22:28:40 +08:00
Jack Grigg c921cfcf97 zcash_proofs: Add LocalProver::bundled
Requires the bundled-prover feature, which enables the
wagyu-zcash-parameters crate and adds around 50 MiB to the overall
binary size. That crate bundles the same Sapling parameter files we
normally obtain from disk, so we constrain them to match the same
hard-coded hashes.
2020-07-10 22:15:23 +12:00
Jack Grigg bbc3ec54c7 CI: Fetch and cache Sapling parameters for tests 2020-06-27 00:46:05 +12:00
Jack Grigg 9012672164 zcash_proofs: Add API for downloading the Sapling parameters
Includes an example that exposes the API as a binary.
2020-06-27 00:45:12 +12:00
Jack Grigg e910788e8e zcash_proofs: Extract default params folder logic 2020-06-27 00:45:12 +12:00
Jack Grigg 0b2293bcc0 bellman: Replace E: ScalarEngine with Scalar: PrimeField
Instead of imposing the requirement that bellman users explicitly
specify an engine for every proving system, we allow the Rust type
system to figure it out for us. An engine is specifically useful in
places where we require defined relationships between several types;
ff::ScalarEngine only has one type, and thus any usage of it can be
trivially replaced by an explicit Scalar type. This is also more
readable :)
2020-05-31 02:00:10 +12:00
str4d 41d9f293d4
Merge pull request #229 from therealyingtong/106-hardcode-sapling-circuit-hashes
Hard-code Sapling circuit hashes in zcash_proofs crate
2020-05-14 17:06:07 +12:00
Jack Grigg f446b45af5 cargo fmt 2020-05-14 16:06:58 +12:00
ying tong 6845154d88
Update zcash_proofs/src/lib.rs
Co-authored-by: str4d <thestr4d@gmail.com>
2020-05-14 11:30:13 +08:00
therealyingtong d480a3840a Hard-code Sapling circuit hashes in zcash_proofs crate
Define the spend_hash, output_hash, sprout_hash circuit hashes as constants in the load_parameters function, so we don't have to take them as function arguments.
2020-05-13 22:36:21 +08: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 1fdca393bb ff: PrimeField::{is_even, is_odd} 2020-04-23 16:23:24 +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
Jack Grigg fd79de5408 ff: Add PrimeField: From<u64> constraint 2020-04-23 16:23:24 +12:00
Jack Grigg 2df2a2b2f2 Merge branch 'develop' 2020-03-14 10:36:58 +13:00
Sean Bowe 100878cd14
Version bump of all crates (except librustzcash) 2020-03-12 15:59:19 -06:00
Jack Grigg 76e0f658c1 Rename CommitmentTreeWitness -> MerklePath 2020-02-08 00:36:40 +00:00
Jack Grigg 2064d1c801 Refactor zcash_primitives::merkle_tree::CommitmentTreeWitness
- The internal Option wrapper was an unnecessary leftover from when this
  code was directly inside the prover, where Some(x) represents an
  assigned variable.
- CommitmentTreeWitness::from_slice_with_depth is more idiomatic Rust.
2020-02-07 00:06:57 +00:00
François Garillot 865275e2a2
Correcting some trivial Rust option/iterator warts 2020-01-29 13:53:05 -08:00
Jack Grigg 3d2acf48ce
Constant-time field square root
WARNING: THIS IS NOT FULLY CONSTANT TIME YET!

This will be fixed once we migrate to the jubjub and bls12_381 crates.
2019-12-13 20:13:30 +00:00
Jack Grigg 40749da9a7
Constant-time field inversion
WARNING: THIS IS NOT ACTUALLY CONSTANT TIME YET!

The jubjub and bls12_381 crates will replace our constant-time usages,
but we NEED to fix ff_derive because other users will expect it to
implement the Field trait correctly.
2019-12-13 19:46:04 +00:00
Jack Grigg cded08b0c5
Make Field::square take &self and return Self 2019-12-12 23:09:28 +00:00
Jack Grigg 9dac748224
Make Field::double take &self and return Self 2019-12-12 22:59:18 +00:00
Jack Grigg 91c32f1c7c
Move from Field::negate to Neg operator 2019-12-12 22:52:17 +00:00
Jack Grigg 27c8f34601
Move Field operations to operator-backed traits
The ff_derive, pairing, zcash_primitives::jubjub, and bellman dummy_engine
changes are minimally implemented on top of the existing *_assign()
functions.
2019-12-12 21:19:46 +00:00
Jack Grigg eed7e8199f
Pass bellman's multicore feature flag through to zcash_proofs
This enables someone using zcash_proofs to disable multicore.
2019-12-11 18:46:47 +00:00
Gregory Hill 7eb4a6d1d9
rename bvk to cv_sum
Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
2019-11-25 14:28:19 +00:00
Jack Grigg d1bc61800c
Move Sprout proof logic into zcash_proofs 2019-11-06 08:58:42 +00:00
Jack Grigg d6bc2fe0af
zcash_proofs 0.1.0 2019-10-08 17:43:33 +13:00
str4d 2399d9f3e3
Merge pull request #93 from defuse/qed-it-lrz
Bring in QED-it Tests
2019-10-08 13:47:36 +13:00
Jim Posen 93563c3c65 Specify rand_core >= 0.5.1 for OsRng import. 2019-10-05 12:16:10 +02:00
str4d 524055bbb4
Merge pull request #134 from NikVolf/z-rng
Avoid using rand_os crate (fixes warnings)
2019-10-02 17:35:56 -06:00
NikVolf 7476e4ea28 alphabetical order 2019-09-28 12:49:37 +03:00