Commit Graph

35 Commits

Author SHA1 Message Date
Jack Grigg f90fa65a32 Migrate to ff 0.8
MSRV is now 1.44.0, matching the ff crate.
2020-09-08 23:44:20 +01:00
Jack Grigg 227890761a Add missing intra-doc link 2020-08-25 23:32:14 +01:00
Jack Grigg 9738f45d1d s/into_iter/iter to fix warnings 2020-08-25 23:30:20 +01:00
Jack Grigg 459fa4a635 pairing: Remove BLS12-381 implementation
It is replaced by the bls12_381 crate.
2020-08-25 23:11:18 +01:00
Jack Grigg 10ac7ce51f bellman: Migrate to sha2 0.9 2020-08-25 23:11:18 +01:00
Jack Grigg 2e540e681c 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-08-25 23:11:05 +01:00
Jack Grigg d7e727255c ff: Rename PrimeField::into_repr -> PrimeField::to_repr 2020-08-25 23:09:47 +01:00
Jack Grigg 80a0c777bb ff: Move pow_vartime back into Field trait
The only places we don't use constant u64 limbs, we use PrimeField::char
instead (except in a single test where we use a field element).
2020-08-25 23:09:47 +01:00
Jack Grigg 9243a6d8bd ff: Add PrimeField::ReprEndianness associated type
This enables generic code to reliably operate on the bits of an encoded
field element, by converting them to and from a known (little)
endianness.

The BitAnd and Shr bounds on PrimeField are now removed, as users can
perform these operations themselves as needed.
2020-08-25 23:09:47 +01:00
Jack Grigg d6a1581f83 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-08-25 23:09:47 +01:00
Jack Grigg 43573a953b 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-08-25 23:09:46 +01:00
Jack Grigg 0980462d4b ff: Move pow_vartime into a trait that is generic over the limb size
The trait is implemented by default for u8 and u64, allowing pow_vartime
to be used with both the byte encoding and limb representation of field
elements.
2020-08-25 23:09:46 +01:00
Jack Grigg 2e8f08f09f Improve Field::pow API and impl
Renamed to Field::pow_vartime to indicate it is still variable time with
respect to the exponent.
2020-08-25 23:09:46 +01:00
Jack Grigg 46c992a8e7 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.
2020-08-25 23:09:46 +01:00
Jack Grigg c716dfdd63 Make Field::square take &self and return Self 2020-08-25 23:09:46 +01:00
Jack Grigg c84d48ec04 Make Field::double take &self and return Self 2020-08-25 23:09:46 +01:00
Jack Grigg c0cea09d13 Move from Field::negate to Neg operator 2020-08-25 23:09:46 +01:00
Jack Grigg c05b957e9d 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.
2020-08-25 23:09:46 +01:00
str4d 8d796652d9 Merge pull request #93 from defuse/qed-it-lrz
Bring in QED-it Tests
2019-10-08 13:47:36 +13:00
Jack Grigg f50079f03d Crate docs 2019-09-24 14:23:59 +01:00
Jack Grigg 54d31221cd Add missing cs.is_satisfied() to bellman test 2019-09-17 00:16:33 +01:00
Taylor Hornby 52bf23c5ce Fix build warnings 2019-09-16 23:06:48 +01:00
Kobi Gurkan 581ad354a7 boolean: adds tests for alloc_conditionally 2019-09-16 22:08:30 +01:00
Kobi Gurkan 0403396a77 blake2s: adds test vectors from go-jubjub 2019-09-16 20:34:21 +01:00
Taylor Hornby 9f24e47390 Fix blake2s test data length assertion. 2019-09-16 20:24:31 +01:00
Kobi Gurkan 42d5b3b6ca Add blake2s test vectors for varying sizes from go-jubjub 2019-09-16 20:23:09 +01:00
Kobi Gurkan b2597deb85 pedersen_hash: removes debug prints 2019-09-16 20:20:03 +01:00
Kobi Gurkan c903fadae8 pedersen hashes: example of size limit bug 2019-09-16 20:17:50 +01:00
Jack Grigg bc697c14bb bellman: Fix compile errors without multicore feature 2019-09-12 19:38:52 +01:00
Jack Grigg 1775843724 Take self directly in into_* functions 2019-08-24 00:39:55 +01:00
Jack Grigg 614d784b29 Rename into_ -> to_ where &self is used. 2019-08-24 00:39:54 +01:00
Jack Grigg 08664b1df9 Address various clippy warnings/errors in bellman 2019-08-24 00:38:32 +01:00
Eirik Ogilvie-Wigley ad37878533 cargo fix --edition for bellman 2019-08-20 16:45:10 -06:00
Eirik Ogilvie-Wigley e73d1a2637 cargo fmt bellman 2019-08-15 10:38:41 -06:00
Jack Grigg dfb86fcf11 Move generic circuit gadgets into bellman 2019-08-14 10:45:58 +01:00