Commit Graph

1410 Commits

Author SHA1 Message Date
Jack Grigg 02324fb767 zcash_client_sqlite::query::get_*_memo_as_utf8() 2020-06-25 18:54:41 +12:00
Jack Grigg 34725df086 zcash_client_sqlite::transact::create_to_address() 2020-06-25 18:54:41 +12:00
Jack Grigg 3ef03f2f1d zcash_client_sqlite::scan::scan_cached_blocks() 2020-06-25 18:54:41 +12:00
Jack Grigg 72dd76e4db zcash_client_sqlite::query::{get_balance, get_verified_balance} 2020-06-25 18:54:41 +12:00
Jack Grigg c8b70e569c zcash_client_sqlite::query::get_address() 2020-06-25 18:54:41 +12:00
Jack Grigg c0cf55c127 SQLite database structure and initialisation 2020-06-25 18:54:34 +12:00
str4d 7134ab8215
Merge pull request #244 from str4d/pairing-gt-fix
pairing: Bound Engine::Gt on Group instead of Field
2020-06-25 09:53:15 +12:00
Jack Grigg 5ff81049b4 Pin protobuf 2.14 until our MSRV passes 1.44.1 2020-06-24 19:45:27 +12:00
Jack Grigg 12f6ec1b2e pairing: Bound Engine::Gt on Group instead of Field 2020-06-24 19:20:25 +12:00
str4d 9f0ee56722
Merge pull request #227 from str4d/impl-ff-traits
Implement ff traits for bls12_381 and jubjub crates
2020-06-18 10:13:00 +12:00
str4d dab44bc35e
Merge pull request #241 from str4d/new-group-traits
New group traits
2020-06-17 12:06:14 +12:00
Jack Grigg ad96a38750 group: Make Wnaf generic over Group
Wnaf was originally generic over CurveProjective; in the prior refactor
commit, we renamed this to CofactorCurve. But w-NAF only requires scalar
multiplication, which is provided by the Group trait, so we relax the
bounds on Wnaf to enable it to be used with any group. We move the
generic w-NAF helper methods from the Curve trait to a new WnafGroup
extension trait, to keep the w-NAF API surface self-contained, and not
expose it to users who aren't using it.
2020-06-17 11:42:11 +12:00
Jack Grigg a105ad675a group: Separate prime and cofactor traits into modules
Instead of having the Group crate hold a Subgroup associated type (and
thus needing to define the subgroup of a prime-order group as itself),
we specify two separate sets of traits for prime-order groups and ones
with a cofactor.

Protocol implementors can either restrict their implementations to only
work with PrimeGroup, or can explicitly choose to support CofactorGroup
and then explicitly handle the subgroup edge cases with e.g.
CofactorGroup::mul_by_cofactor (which would be a no-op for PrimeGroup).

Protocol implementors can also choose to specialise to elliptic curves
if they want to leverage an affine representation and mixed addition in
their protocol for efficiency, or they can ignore those traits and stick
with the simpler group-focused traits.
2020-06-17 11:42:10 +12:00
Jack Grigg d52053d877 group: Renaming prior to trait refactor
This will reduce the size of the subsequent refactor diff.
2020-06-17 11:40:00 +12:00
Jack Grigg df13cd7480 group: Remove "compressed" notion from GroupEncoding
A generic group has a single encoding; for elliptic curves, this
happens to be the compressed encoding.
2020-06-17 11:35:17 +12:00
Jack Grigg 71586914d4 group: Extract compressed encodings from CurveAffine trait 2020-06-17 11:35:15 +12:00
Jack Grigg 3759fc8aab group: Default implementation of CurveProjective::batch_normalize
For convenience. Implementations will usually override this to take
advantage of implementation-specific batching optimisations.
2020-06-17 11:31:09 +12:00
Jack Grigg ae2d2b59b9 group: Move uncompressed encodings to an UncompressedEncoding trait
Specifications of deployed elliptic curves fall into one of two
categories:
- They specify both compressed and uncompressed encodings, allowing
  implementations to use either depending on performance vs data size
  considerations.
- They specify a single point encoding format using point compression.

I am unaware of any elliptic curve specification that explicitly forbids
compressed encodings.

To support both categories of elliptic curves, we provide the
CurveAffine::Compressed associated type which all curves must define,
and then curves that additionally specify an uncompressed encoding may
implement the UncompressedEncoding trait and its Uncompressed associated
type.

pairing::PairingCurveAffine continues to require that its groups provide
uncompressed encodings, because this is relied upon by bellman::groth16.
We can revisit this restriction when that module is refactored as a
separate crate.
2020-06-17 11:31:07 +12:00
Jack Grigg 4e685a847d Merge branch 'pairing-refactor' 2020-06-17 09:48:24 +12:00
str4d 7b94622ae0
Merge pull request #237 from str4d/bellman-scalar
Replace E: ScalarEngine with Scalar: PrimeField
2020-06-17 09:28:52 +12:00
therealyingtong a4b010e003 Placeholders for Canopy network upgrade 2020-06-04 15:44:15 +08:00
str4d cf75dc559d
Merge pull request #239 from str4d/heartwood-activation
Set activation heights for Heartwood network upgrade
2020-06-04 16:19:43 +12:00
Jack Grigg 3779c12e31 Set activation heights for Heartwood network upgrade 2020-06-04 15:33:07 +12:00
Jack Grigg 03f086221b pairing: Move PairingCurveAffine::Prepared to MultiMillerLoop trait
Prepared elements are only used by MultiMillerLoop, and we don't need
the ability to "prepare" G1 elements there.
2020-06-03 20:50:02 +12:00
Jack Grigg b9d6df9133 pairing: Extract Engine::miller_loop into a MultiMillerLoop trait
This enables MultiMillerLoop to be conditionally implemented, for
example in libraries where Engine::pairing supports no-std, but
MultiMillerLoop requires an allocator.
2020-05-31 08:35:02 +12:00
Jack Grigg da2e638c7d pairing: Pass affine references to Engine::pairing 2020-05-31 08:34:07 +12:00
Jack Grigg 57bb18ca6f pairing: Move final_exponentiation into a MillerLoopResult trait 2020-05-31 08:34:03 +12:00
Jack Grigg c8bf2e9fb7 pairing: Separate associated types for MillerLoopResult and Gt 2020-05-31 08:22:52 +12:00
Jack Grigg 534c99327a pairing: Remove Engine::Fq and Engine::Fqe
These are unused now that the Base associated types have been removed
from the group traits.
2020-05-31 08:22:52 +12:00
Jack Grigg 5a40a0fe8f group: Remove CurveProjective::Base and CurveAffine::Base
These associated types were completly unused. The only place we need
information about the base field of an elliptic curve is inside Jubjub
when operating over its coordinates to implement EC math inside the
circuit, and we can handle that either concretely, or with a future
trait specifically for that use-case.
2020-05-31 08:22:52 +12:00
Jack Grigg 0a0e513948 ff: Remove ScalarEngine 2020-05-31 02:06:24 +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
Jack Grigg b0542dd6d3 jubjub: Implement ff traits for Fr 2020-05-30 01:01:43 +12:00
Jack Grigg 463d72cc3e bls12_381: Implement ff traits for Scalar 2020-05-30 01:01:43 +12:00
Jack Grigg f208c498cf bls12_381: Fix typo in Fp::from_bytes documentation 2020-05-30 01:01:43 +12:00
str4d 5ff8562744
Merge pull request #222 from adityapk00/zecwallet_compat
Expose the `hash` and `n` fields of Transparent Outputs
2020-05-23 14:13:31 +12:00
Aditya Kulkarni 4b1d8e5226 Add methods to get OutPoint n, hash 2020-05-22 18:02:44 -07:00
str4d 121231199c
Merge pull request #205 from str4d/taddr-encoding
Implement TransparentAddress encoding and decoding
2020-05-23 12:22:01 +12:00
str4d 8831150825
Merge pull request #232 from str4d/lint-fixes
Lint fixes
2020-05-23 08:03:03 +12:00
Jack Grigg c488732022 Use text directive on sage script doc comment instead of norun
norun is an invalid directive, and no_run would cause the sage script to
be compiled as Rust.
2020-05-22 19:13:33 +12:00
Jack Grigg 2892cf94c1 Migrate to protobuf-codegen-pure 2.14 2020-05-22 18:55:46 +12:00
Jack Grigg 4edff96321 Fix various lints 2020-05-22 18:52:35 +12:00
str4d a22957b575
Merge pull request #231 from str4d/group-remove-encodedpoint
group: CurveAffine and CurveProjective trait refactor
2020-05-21 09:49:34 +12:00
Jack Grigg 5f1607c9b5 group: Rename into_*(&self) -> to_*(&self)
Rust naming convention uses the into_ prefix for methods that consume
self, and the to_ prefix for methods that take an immutable reference.
2020-05-20 11:32:12 +12:00
Jack Grigg ceecd32ac4 group: Remove EncodedPoint::from_affine
The EncodedPoint trait is replaced by explicit bounds on the
CurveAffine::{Uncompressed, Compressed} associated types.
2020-05-20 11:32:12 +12:00
Jack Grigg b77f8dddda group: Remove EncodedPoint::{into_affine, into_affine_unchecked}
Replaced by explicit APIs on the CurveAffine trait.

GroupDecodingError has been moved into pairing::bls12_381::ec, as it is
no longer used by the group traits.
2020-05-20 11:32:12 +12:00
Jack Grigg b0a3713d7e group: Add mixed-addition scalar multiplication bounds to CurveAffine
Replaces the explicit CurveAffine::mul trait method.
2020-05-20 11:32:12 +12:00
Jack Grigg 0941dddc13 group: Return subtle::Choice from CurveAffine::is_identity 2020-05-20 11:32:12 +12:00
Jack Grigg b94d567076 group: Direct-to-affine CurveProjective::batch_normalize
Replaces the mutating CurveProjective::batch_normalization API, and
removes the need for CurveProjective::is_normalized.

The new temporary implementation in pairing::bls12_381::ec is adapted
from bls12_381::g1.
2020-05-20 11:32:12 +12:00
str4d 4969ad4d93
Merge pull request #230 from str4d/group-trait
group crate refactoring
2020-05-19 08:30:53 +12:00