therealyingtong
18393eefa8
kind::unified: Introduce private::SealedReceiver trait.
...
Co-authored-by: Jack Grigg <jack@electriccoin.co>
2021-11-28 18:55:37 -05:00
therealyingtong
406e62e7e5
[move-only] Move Receiver and test code into kind::unified::address.
...
Co-authored-by: Jack Grigg <jack@electriccoin.co>
2021-11-28 17:09:59 -05:00
jarys
0ec7f97c97
Add `#![no_std]` support for zcash_note_encryption ( #450 )
...
Co-authored-by: str4d <thestr4d@gmail.com>
2021-11-24 13:58:52 +00:00
Jack Grigg
35e7542065
zcash_note_encryption: Move domain batch APIs into a BatchDomain trait
...
These are the only allocating APIs; this change makes it possible to
make the crate no-std compatible.
2021-11-17 12:14:26 +00:00
jarys
6e39480c58
Add `#![no_std]` support for f4jumble. ( #446 )
...
The new `f4jumble_mut` and `f4jumble_inv_mut` functions take a `&mut [u8]`, and return a new `Error` type if the slice has an invalid length.
The original `f4jumble` and `f4jumble_inv` functions are now more efficient as they only allocate once.
2021-11-03 13:46:30 +00:00
str4d
edd341faba
f4jumble: Add description to README
...
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-09-23 04:38:39 +12:00
str4d
501a343fc9
f4jumble: Update authors list
...
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-09-23 04:22:18 +12:00
Jack Grigg
e13e746e8a
Move F4Jumble implementation into f4jumble crate
2021-09-22 14:21:48 +01:00
Jack Grigg
06b7f13356
Empty f4jumble crate
2021-09-22 14:13:34 +01:00
str4d
663a394b62
Merge pull request #434 from nuttycom/feature/longer_uas
...
Update unified addresses to use CompactSize for typecode & length fields.
2021-09-16 05:47:18 +12:00
Kris Nuttycombe
3c42fcff6d
Fix upper CompactSize bound.
...
Co-authored-by: str4d <jack@electriccoin.co>
2021-09-15 10:27:27 -06:00
Kris Nuttycombe
4b67977ec0
Use u32 for typecodes.
...
Co-authored-by: str4d <jack@electriccoin.co>
2021-09-14 18:08:21 -06:00
Kris Nuttycombe
74d430102a
Add test vector checking for long f4jumble values.
2021-09-14 17:11:37 -06:00
Daira Hopwood
f9522ed2bc
Add a test that uses the second bytes of the index to G
2021-09-13 14:41:45 +01:00
Jack Grigg
65e1d32774
ff 0.11, group 0.11, etc.
2021-09-09 18:20:37 +01:00
str4d
eca002dae0
zcash_address: Assert that the unified encoding is exactly consumed
2021-09-02 23:24:23 +01:00
Kris Nuttycombe
ce6ac7aee6
Avoid reallocation in read_receiver.
2021-09-02 16:12:11 -06:00
Kris Nuttycombe
cd3d40aab3
Update f4jumble personalization.
...
Also, update the test vectors for both f4jumble and
unified addresses.
2021-09-01 14:46:44 -06:00
Kris Nuttycombe
b7ae3ddfe5
Modify unified address encoding to use CompactSize for typecode & address length
2021-09-01 14:46:44 -06:00
str4d
993925e049
Merge pull request #437 from nuttycom/zcash_note_encryption_doc_fixes
...
Fix a couple of broken doc links.
2021-09-01 21:43:46 +01:00
Kris Nuttycombe
5541552453
Fix a couple of broken doc links.
2021-09-01 14:01:47 -06:00
Kris Nuttycombe
427e6acbd4
Allow CompactSize deserialization to target any type that can be TryFrom<u64>
2021-09-01 13:57:51 -06:00
str4d
edcde252de
Merge pull request #428 from nuttycom/public_compact_size
...
Move the CompactSize, Vector, Array and Option encodings to a new zcash_encoding crate.
2021-09-01 20:45:28 +01:00
str4d
21a0d0760c
zcash_encoding: Adjust doc comments on public APIs
2021-09-01 20:43:59 +01:00
Kris Nuttycombe
c1bad64fbd
Apply suggestions from code review
...
Co-authored-by: str4d <jack@electriccoin.co>
2021-09-01 11:08:52 -06:00
Kris Nuttycombe
e9c18ebaed
Document zcash_encoding functions.
2021-09-01 10:17:03 -06:00
Kris Nuttycombe
fa092da456
Fix stray clippy complaints.
2021-08-31 13:19:24 -06:00
Kris Nuttycombe
ef98c7e48c
Add zcash_encoding crate.
...
The CompactSize type, and the standardized encodings for the Vector,
Array and Option types are moved to the newly created crate.
2021-08-31 13:19:24 -06:00
Jack Grigg
f03f05f251
zcash_note_encryption: Switch to chacha20poly1305 crate
2021-08-30 15:03:39 +01:00
Jack Grigg
0d00e1eb53
proptest 1
2021-08-23 20:21:13 +01:00
str4d
9be36f3e54
Merge pull request #417 from nuttycom/incremental_merkle_tree_ser
...
Add manual serialization for bridgetree::Frontier
2021-08-17 14:57:59 +01:00
Jack Grigg
4b4dd2ea55
zcash_note_encryption: Add support for batch-parsing `ephemeral_key`
...
This is useful when the underlying curve requires an inversion to parse
an encoded point (such as for Jubjub).
2021-08-10 02:57:11 +01:00
Jack Grigg
8a615c4393
zcash_note_encryption: Add batched trial decryption APIs
2021-08-10 02:17:10 +01:00
Jack Grigg
279a8b6bb6
Use `EphemeralKeyBytes` type in place of `[u8; 32]`
2021-08-09 21:28:42 +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
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
str4d
c02931dc82
Tweak test comment
2021-07-30 20:35:23 +01:00
Jack Grigg
00b369b2a4
zcash_address: Include HRP inside Unified Address Padding bytes
...
Closes zcash/librustzcash#418 .
2021-07-30 15:34:36 +01:00
Jack Grigg
b875f6c34b
zcash_address: Fix clippy lint by using matches! macro
2021-07-12 21:17:25 +01:00
Jack Grigg
8527dcbc32
zcash_address: Remove outdated unified::Receiver documentation
...
Receiver ordering is now explicitly defined by Typecode, and Receiver
is now a public type.
2021-07-12 21:11:24 +01:00
Jack Grigg
478625f72d
zcash_address: Add UA test cases for truncation and invalid padding
2021-07-12 20:56:35 +01:00
Jack Grigg
77d1f0c778
zcash_address: Invert Typecode::is_shielded to Typecode::is_transparent
...
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-07-12 20:19:26 +01:00
Jack Grigg
060a15eaf8
zcash_address: Enable constructing a unified::Address from Vec<Receiver>
...
This enforces the same structural validity checks as at parsing time.
2021-07-12 13:39:01 +01:00
Jack Grigg
384af079a8
zcash_address: Add `unified::Address::receivers{_as_parsed}` APIs
...
These expose the receivers in sorted order, and in parsed order.
2021-07-12 13:35:06 +01:00
Jack Grigg
b175b9bec9
zcash_address: Use preference ordering for Receivers
2021-07-12 13:34:44 +01:00
Jack Grigg
7708b27202
zcash_address: Enforce UA structural validity checks
2021-07-12 12:10:23 +01:00
Jack Grigg
cd94b41d61
zcash_address: Introduce UA-specific parser error type
2021-07-12 11:45:25 +01:00
Jack Grigg
01a8dba450
zcash_address: Add a Typecode enum
2021-07-12 11:42:49 +01:00
Jack Grigg
752ee442f8
zcash_address: Add Unified Address test vectors
2021-06-18 20:06:02 +01:00
Jack Grigg
c7c79d266e
zcash_note_encryption: Add `ShieldedOutput::ephemeral_key() -> EphemeralKeyBytes`
...
This replaces the `ShieldedOutput::epk() -> &Domain::EphemeralPublicKey`
which could not be satisfied by output types that did not parse epk.
2021-06-10 18:35:19 +01:00
str4d
2f3e4989ba
Merge pull request #352 from str4d/zcash_address
...
New component: zcash_address crate
2021-06-07 00:36:48 +01:00
Jack Grigg
af02e1142b
zcash_address: Fix clippy lint
2021-06-07 00:13:21 +01:00
str4d
1590565f04
zcash_address: Minor cleanups
...
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-06-06 23:58:52 +01:00
str4d
f36034cfac
zcash_address: Use exhaustive matching in Display impl
...
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-06-06 23:54:11 +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
eba6f417fe
zcash_note_encryption: Doc fixes
2021-05-29 00:15:25 +01:00
Jack Grigg
362838c3fa
zcash_note_encryption: Fix array size in Domain::extract_{esk, pk_d}
...
Decrypted output size is `OUT_PLAINTEXT_BYTES`, which the decryptor
can always provide (either by decrypting into the correct size array
as now, or truncating the buffer before passing it to the domain).
2021-05-28 23:48:03 +01:00
Jack Grigg
f6705f23c3
zcash_note_encryption: Add ovk recovery API
2021-05-28 23:45:23 +01:00
Jack Grigg
ae43e6c074
zcash_note_encryption: Pass cmstar_bytes to Domain::derive_ock
...
PRF^ock in the spec takes cm* as a byte array.
2021-05-28 23:41:13 +01:00
Jack Grigg
ee2b96c82d
zcash_note_encryption: s/TryFrom/From on ExtractedCommitmentBytes bound
...
This was left over from an earlier refactor where we could call a domain
API to extract cmstar from a note commitment (which could fail for
Orchard). This part of extraction was subsequently refactored into the
domain logic (and is rejected earlier for Orchard). The resulting bound
is wrong because it's always possible to serialize a scalar.
2021-05-28 22:57:48 +01:00
Jack Grigg
16627b4569
zcash_note_encryption: Enforce ZIP 212 check on esk from outPlaintext
...
It needs to equal the esk derived from the note (for v2 note plaintexts).
2021-05-28 22:33:00 +01:00
Jack Grigg
ff94f66d8e
zcash_address: Fix padding and F4Jumble positions in Address::to_bytes
...
These need to be applied to the entire UA encoding, not to the encoding
of each individual receiver.
2021-05-25 21:24:47 +01:00
Jack Grigg
ff8695de03
zcash_address: Add failing test showing unified::Address encoding bug
2021-05-25 21:24:47 +01:00
str4d
c2b57048bf
Update components/zcash_address/README.md
...
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-05-25 16:37:25 +01:00
Jack Grigg
e982d7211f
zcash_address: Implement Unified Address encoding / decoding
2021-05-20 22:50:59 +01:00
Jack Grigg
6717cd821c
Move F4Jumble implementation into zcash_address
2021-05-20 22:50:59 +01:00
Jack Grigg
ae2b8bfd6d
zcash_address: Replace Orchard address encodings with Unified Addresses
...
This commit removes the now-undefined Orchard encoding logic, and adds
the general Bech32m encoding/decoding logic for Unified Addresses. The
internal data format of Unified Addresses is not correct in this commit.
2021-05-20 22:50:59 +01:00
Jack Grigg
9f7398cd05
zcash_address: Add convert::ToAddress helper trait
2021-05-20 14:54:27 +01:00
Jack Grigg
ce8797e4b1
zcash_address: impl {Clone, Copy, Eq, Hash} for ZcashAddress
2021-05-20 14:54:27 +01:00
Jack Grigg
ff07eeaabb
zcash_address: Document ZcashAddress::convert
2021-05-20 14:54:27 +01:00
Jack Grigg
b9f704955a
zcash_address: Move ZcashAddress::convert into root
...
Using two separate `impl ZcashAddress` blocks resulted in separate
blocks in the documentation, which is unnecessary.
2021-05-20 14:54:27 +01:00
Jack Grigg
c7fcee27a2
zcash_address: Add ZcashAddress::try_from_encoded method
...
This places parsing documentation front and centre, while also making
it clear that `str::parse` is the anticipated main entry point.
2021-05-20 14:54:27 +01:00
Jack Grigg
f7b1058171
zcash_address: Extend MaybeZcash heuristics to 64-byte addresses
2021-05-20 14:54:27 +01:00
Jack Grigg
a366460157
zcash_address: ZcashAddress::convert() -> T: FromAddress
...
This enables easy conversion of an encoded Zcash address to a target
type, with automatic handling of Zcash address types that are not
supported by the target.
2021-05-20 14:54:27 +01:00
Jack Grigg
ec77175d2b
zcash_address: Add address-encoding support
...
This provides round-trip encoding for Zcash addresses.
2021-05-20 14:54:27 +01:00
Jack Grigg
c754363c07
zcash_address: Initial empty library crate
2021-05-20 14:54:25 +01:00
Jack Grigg
5623e02a7c
Migrate to ff 0.9 et al.
2021-05-19 18:29:37 +01:00
Jack Grigg
28a45028ab
cargo fmt
2021-04-16 14:03:55 +12:00
Daira Hopwood
dc0f6e7115
Update comment about which case is covered by example code
2021-04-16 00:10:05 +01:00
Kris Nuttycombe
b2b3efd4c2
Fix naming cmstar -> cmstar_bytes and cm -> cmstar
2021-04-15 15:24:45 -06:00
Kris Nuttycombe
00d04de547
Make cmstar check follow the spec more closely.
2021-04-14 15:38:58 -06:00
Kris Nuttycombe
389e6ca6a3
Minor comment on epk canonicity.
2021-04-12 18:43:21 -06:00
Kris Nuttycombe
f34e87884a
Update documentation for note encryption traits.
2021-04-12 17:41:06 -06:00
Kris Nuttycombe
6fc1d1d1c0
Use ephemeral_key bytes instead of the epk abstract point where specified.
2021-04-12 16:19:50 -06:00
Kris Nuttycombe
324fc36521
Use ShieldedOutput trait for note encryption/decryption.
...
This change modifies note encryption and decryption functions
to treat a shielded output as a single value instead of handling
the parts of an output as independent arguments.
2021-04-12 12:59:06 -06:00
Kris Nuttycombe
4f22f1d578
Apply suggestions from code review
...
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-04-12 09:18:51 -06:00
Kris Nuttycombe
e654cc4ce6
Use constant-time equality for EphemeralKeyBytes.
...
Fixes #370
2021-04-12 09:13:04 -06:00
Kris Nuttycombe
cfdbafe2e3
Add myself to crate contributors.
2021-04-08 10:13:04 -06:00
Kris Nuttycombe
24e62d3a7b
Update comments describing COMPACT_NOTE_SIZE components.
...
Co-authored-by: ebfull <ewillbefull@gmail.com>
2021-04-08 10:08:58 -06:00
Kris Nuttycombe
a560101bb2
Remove spurious mut references.
2021-04-08 10:08:00 -06:00
Kris Nuttycombe
879eea863a
Apply suggestions from code review
...
Co-authored-by: str4d <jack@electriccoin.co>
2021-04-08 08:20:23 -06:00
Kris Nuttycombe
dad8663c55
Fix zcash_note_encryption doctests.
2021-04-08 08:20:23 -06:00
Kris Nuttycombe
213cd6cce9
Fix Clippy complaints.
2021-04-08 08:20:23 -06:00
Kris Nuttycombe
be225daabf
Update zcash_primitives dev dependency for zcash_note_encryption
2021-04-08 08:20:23 -06:00
Kris Nuttycombe
5b13bb3a1e
Add try_output_recovery_with_ovk to shared note encryption code.
2021-04-08 08:20:23 -06:00
Kris Nuttycombe
266285b536
Move generalized note encryption functionality to zcash_note_encryption crate.
2021-04-08 08:20:21 -06:00
Jack Grigg
56b577b31e
clippy: Fix small lints
2021-03-27 19:01:03 +13:00
str4d
6fa90197fe
Merge pull request #357 from str4d/zcash_note_encryption
...
Empty zcash_note_encryption crate
2021-03-27 17:59:15 +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
b7c31e3f54
Empty zcash_note_encryption crate
2021-03-20 09:56: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
Jack Grigg
e6c2230afa
equihash: Silence clippy mis-lint
2020-10-23 17:38:24 +01:00
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
Jack Grigg
b5bd52e7a1
equihash 0.1.0
2020-07-10 10:25:52 +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
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