Commit Graph

1291 Commits

Author SHA1 Message Date
Jack Grigg 20bb9a6c0f equihash: Test vectors for expand_array and indices_from_minimal
Migrated from src/gtest/test_equihash.cpp
2020-07-10 21:12:39 +12:00
Jack Grigg c89d1c8470 equihash: Test that all bits of the solution matter
Migrated from src/test/equihash_tests.cpp
2020-07-10 20:52:47 +12:00
Jack Grigg 30fe588cca equihash: Valid and invalid test vectors
Includes existing test vectors from src/test/equihash_tests.cpp, and
additional test vectors from https://github.com/zcash/zcash/pull/1487.
2020-07-10 20:35:23 +12:00
str4d f55f094ef6
Merge pull request #248 from str4d/equihash-crate
Move Equihash verifier into equihash crate
2020-07-10 11:57:11 +12:00
Jack Grigg b5bd52e7a1 equihash 0.1.0 2020-07-10 10:25:52 +12:00
str4d d380a8c8d2
Merge pull request #246 from str4d/zcash_client_sqlite
zcash_client_sqlite crate
2020-07-10 10:22:37 +12:00
Jack Grigg 8c250ca3de zcash_sqlite: Add an unreliability warning to query::get_balance docs 2020-07-10 09:50:43 +12:00
Jack Grigg 8188fae779 zcash_client_sqlite: Implement outgoing viewing key policies
This enables an SQLite light client to specify whether recipient history
can be recovered from the block chain (and by what outgoing viewing key)
with per-transaction granularity.
2020-07-09 23:48:09 +12:00
Jack Grigg 1b059d4ae0 equihash: Remove unnecessary log dependency 2020-07-09 20:53:50 +12:00
Jack Grigg 72fbd2071d equihash: Clarify order of operations in indices_from_minimal 2020-07-09 20:51:52 +12:00
Jack Grigg 7740658084 equihash: Add additional constraints on Params
These are requirements of the general Equihash implementation, that are
satisfied by the Zcash parameters.
2020-07-09 20:50:58 +12:00
Jack Grigg 092ffc7373 equihash: Crate documentation 2020-07-08 17:34:52 +12:00
Jack Grigg bcd687cffb equihash: Remove iterative and recursive APIs
The canonical verification API from Heartwood activation is the
recursive API exposed through is_valid_solution. We retain
is_valid_solution_iterative internally for testing.
2020-07-08 15:22:38 +12:00
Jack Grigg 8759684fad equihash: Add parameter validity checks 2020-07-07 22:09:24 +12:00
Jane Lusby 997657f256
Move `error!` logs into proper error type (#14)
hey kid, want some error handling?
2020-07-07 21:00:53 +12:00
str4d 9768c7141d
Merge pull request #240 from therealyingtong/canopy-nu-parameters
Placeholders for Canopy network upgrade
2020-06-27 01:41:17 +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 0a61db0317 Upgrade to rusqlite 0.23
Requires bumping the MSRV to 1.40.0 because libsqlite3-sys uses features
introduced in that version. remove_dir_all can similarly be unpinned.
2020-06-27 00:45:12 +12:00
Jack Grigg 5b2c71e112 Move Equihash verification APIs into equihash crate 2020-06-26 13:01:04 +12:00
Jack Grigg d71a599191 Empty equihash crate 2020-06-26 12:53:07 +12:00
Jack Grigg 131e00e25d zcash_client_sqlite::scan::decrypt_and_store_transaction 2020-06-25 18:54:41 +12:00
Jack Grigg b1a2e8172d zcash_client_backend: Add account to DecryptedOutput 2020-06-25 18:54:41 +12:00
Jack Grigg 3036064cd0 zcash_client_sqlite: Update received note during scan if present
Fixes a bug where rewinding a block that contained a received note would
cause a constraint violation.
2020-06-25 18:54:41 +12:00
Kevin Gorham 9363ec36d9 Added a limit value for scanning.
This provides a way to expose a more fine grained measure of scan progress. For example, by scanning in batches of 100 blocks, rather than everything that is pending.
2020-06-25 18:54:41 +12:00
Jack Grigg c8074d42b8 zcash_client_sqlite: Store is_change as INTEGER instead of BOOLEAN
Needed because SQLite internally stores BOOLEAN as INTEGER anyway, but
this causes problems with newer versions of Room on Android.
2020-06-25 18:54:41 +12:00
Jack Grigg 4cfdacedec zcash_client_sqlite: Support sending to t-addrs 2020-06-25 18:54:41 +12:00
Jack Grigg 380c2f726f Chain validity and reorg handling 2020-06-25 18:54:41 +12:00
Jack Grigg f0ce0c5530 Add mainnet support to zcash_client_sqlite via a feature flag 2020-06-25 18:54:41 +12:00
Jack Grigg a2de5d7028 Add security disclaimer to README 2020-06-25 18:54:41 +12:00
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