Kris Nuttycombe
c1a8de27f3
Move Sapling transaction builder to an independent module.
2021-06-02 11:48:46 -06:00
Kris Nuttycombe
ba6fc053b5
Move transparent transaction builder to an independent module.
2021-06-02 11:48:46 -06:00
Kris Nuttycombe
8267d06846
Refactor transaction builder to create separate builders for each section.
2021-06-02 11:48:46 -06:00
str4d
f7f5cd472b
Merge branch 'master' into note-decryption-fixes
2021-06-02 18:45:01 +01:00
Kris Nuttycombe
168314cec6
Update changelog.
2021-06-01 07:05:01 -06:00
Kris Nuttycombe
62bd06f14e
Apply suggestions from code review
...
Co-authored-by: str4d <jack@electriccoin.co>
2021-06-01 07:03:31 -06:00
Kris Nuttycombe
76999eb5c7
Make txid contents private & use txid for TzeOutPoint
2021-06-01 07:03:31 -06:00
Kris Nuttycombe
936b552de2
Add NoteValue newtype, Nullifier::as_ref and proptest generation.
2021-06-01 07:03:31 -06:00
Kris Nuttycombe
3dc05a69eb
Add Nu5 NetworkUpgrade variant.
2021-06-01 07:03:31 -06:00
Kris Nuttycombe
4efb21d1c7
Make amount addition and subtraction traits use checked operations.
2021-06-01 07:03:31 -06: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
6f0e7c86a3
zcash_primitives: Add Builder::with_progress_notifier to changelog
2021-05-26 22:02:01 +01:00
Jack Grigg
d031dabcfc
Builder: Move progress notifier configuration to a builder method
...
This is what builder methods are for :) and it helps to limit the growth
of alternate `build` methods.
2021-05-26 21:58:08 +01:00
str4d
d9a3b98120
Merge pull request #377 from adityapk00/builder_progress
...
Report Sapling Tx Builder Progress
2021-05-26 21:52:38 +01:00
Jack Grigg
6717cd821c
Move F4Jumble implementation into zcash_address
2021-05-20 22:50:59 +01:00
str4d
d50bb12a97
Merge pull request #334 from str4d/dependency-updates
...
Dependency updates
2021-05-20 17:48:52 +01:00
str4d
35dadc7f6c
f4jumble: Test both directions against test vectors
2021-05-20 14:16:39 +01:00
Jack Grigg
9a80ae5cd1
bitvec 0.20
2021-05-19 18:29:37 +01:00
Jack Grigg
5623e02a7c
Migrate to ff 0.9 et al.
2021-05-19 18:29:37 +01:00
Kris Nuttycombe
1dcba34167
Add checks against f4jumble test vectors.
2021-05-19 08:50:50 -06:00
Kris Nuttycombe
774d166fff
Use VALID_LENGTH constant for f4jumble proptest generation.
2021-05-19 08:29:10 -06:00
Kris Nuttycombe
4346ca9e50
Apply suggestions from code review
...
Co-authored-by: str4d <jack@electriccoin.co>
2021-05-19 08:29:10 -06:00
Kris Nuttycombe
69ce777dd1
Use macros for personalization & iterator for g function.
...
Co-authored-by: str4d <jack@electriccoin.co>
2021-05-19 08:29:01 -06:00
Kris Nuttycombe
08a3fb9639
Implement F4Jumble
2021-05-19 08:28:58 -06:00
str4d
1b0f2060dd
Improve documentation of builder::Progress
2021-05-18 13:45:48 +01:00
Aditya Kulkarni
f3aded9c84
Send builder progress
2021-05-17 09:44:42 -07:00
Daira Hopwood
da431a0eb2
rustfmt fix
2021-05-03 14:08:06 +01:00
narodnik
618a6165c7
Replace redundant code with call to Field::random() which does the same as the code.
2021-05-03 13:34:13 +02:00
Kris Nuttycombe
8828276361
Query for unspent utxos checks to ensure that spending tx is mined.
...
Also make it an error to try to send a memo to a transparent address.
2021-04-16 14:26:51 -06:00
Kris Nuttycombe
862e221a9b
Put transparent dependencies behind a feature flag.
2021-04-16 14:23:26 -06:00
Jack Grigg
28a45028ab
cargo fmt
2021-04-16 14:03:55 +12:00
Kris Nuttycombe
3434cc8b6a
Add a note about canonicity of ephemeral public keys.
2021-04-15 15:32:45 -06: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
12cb8265d8
Fix formatting.
2021-04-12 18:47:45 -06:00
Kris Nuttycombe
fae1a1517a
Simplify try_sapling_output_recovery.
2021-04-12 18:40:17 -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
cfdbafe2e3
Add myself to crate contributors.
2021-04-08 10:13:04 -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
213cd6cce9
Fix Clippy complaints.
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
Kris Nuttycombe
e77839232d
Generalize note encryption and decryption.
...
This commit introduces a `Domain` trait which defines the types
and operations that are shared between Sapling and Orchard note
encryption and decryption processes.
2021-04-08 08:19:10 -06:00
Kris Nuttycombe
5baccdf052
Move note_encryption into the sapling module.
2021-04-08 08:19:10 -06:00
Jack Grigg
2f3847638d
zcash_primitives: Revert to SproutProof::PHGR
...
Unlike regular acronyms or abbreviations, this is author initials, which
we've decided to keep capitalised.
2021-04-02 10:39:25 +13: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
56b577b31e
clippy: Fix small lints
2021-03-27 19:01:03 +13:00
Jack Grigg
564c2714fe
clippy: Use Iterator::try_for_each
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
Jack Grigg
eefc516e26
zcash_primitives: Update changelog for Sapling refactor
2021-03-27 17:10:18 +13:00
Jack Grigg
8ac663f116
Fix some doctests and intra-doc links after moving Sapling primitives
2021-03-27 17:10:18 +13:00
Kris Nuttycombe
33effb7d67
Move sapling keys into sapling module.
2021-03-27 16:18:21 +13:00
Kris Nuttycombe
4086df772c
Move sapling-specific primitives into the sapling module.
2021-03-27 16:18:21 +13:00
Kris Nuttycombe
abbf5dfd83
Move pedersen hash test vectors into Sapling
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
88d58aac0a
Move relevant utils into 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
Kris Nuttycombe
de1345a1c2
Move group_hash to sapling module.
2021-03-27 16:18:21 +13:00
Kris Nuttycombe
c839193b20
Move TZE components to a separate module & add TzeOutPoint
2021-03-27 15:52:20 +13:00
Kris Nuttycombe
97f2502a5e
Factor transparent transaction components into a separate module.
2021-03-27 15:49:17 +13:00
Kris Nuttycombe
96709c6423
Move Sapling transaction components to a separate module.
2021-03-27 15:49:17 +13:00
Kris Nuttycombe
7fcb7bbe99
Factor Sprout transaction elements into a separate module.
2021-03-27 15:49:17 +13:00
Kris Nuttycombe
6e371a8c13
Make Sprout elements crate-public.
2021-03-27 15:49:17 +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
725699c76b
zcash_primitives 0.5.0
2021-03-26 18:51:35 +13:00
Jack Grigg
675048e52b
Fix broken intra-doc links and lints
2021-03-26 10:07:20 +13:00
Jack Grigg
55e73d7910
Fix clippy lints
2021-03-26 10:07:20 +13:00
Kris Nuttycombe
c41c71c514
Apply suggestions from code review
...
Co-authored-by: str4d <thestr4d@gmail.com>
2021-03-25 15:00:54 -06:00
Kris Nuttycombe
ebdd6cf976
Add SaplingIvk newtype to changelogs.
2021-03-24 18:39:21 -06:00
Jack Grigg
e122c3d974
Remove reference to ZIP 302 structured memos from changelog
...
We're removing those from the ZIP draft until they can be agreed upon.
2021-03-23 13:52:22 +13:00
Jack Grigg
46872e2590
Update changelogs with Memo changes
2021-03-18 10:00:27 +13:00
Jack Grigg
8a84203685
Remove Default impl from MemoBytes
...
Memo fields have two ways to encode an empty memo:
- 0xF6 followed by all-zeroes, encoding "there is no memo".
- All-zeroes, encoding the empty UTF-8 string.
In almost all cases you want the former, but users thinking about byte
slices may expect MemoBytes::default() to result in the latter. To
ensure clarity, we now require calling either MemoBytes::default() or
MemoBytes::from_bytes(&[]) to be explicit.
No such confusion exists for the Memo enum, because the two types are
visibly separated as different enum cases, and Memo::Empty makes sense
as the default.
2021-03-17 21:16:01 +13:00
Jack Grigg
c7a3ef0e88
Split memo-handling into MemoBytes struct and Memo enum
...
The MemoBytes struct is a minimal wrapper around the memo bytes, and only
imposes the existence of null-padding for shorter memos. The only error
case is attempting to construct a memo that is too long. MemoBytes is
guaranteed to be round-trip encodable (modulo null padding).
The Memo enum implements the additional memo rules defined in ZIP 302,
interpreting the contents of a memo (for example, parsing it as text).
2021-03-17 21:05:50 +13:00
Jack Grigg
48f7ef84a4
Move Memo into zcash_primitives::memo
2021-03-17 19:58:40 +13:00
Kris Nuttycombe
b5bbbb6f5a
Factor out nullifier update from database actions in scan_cached_blocks
2021-03-09 20:59:57 -07:00
Jack Grigg
463e252af4
Fix more intra-doc links
2021-03-04 23:01:42 +00:00
Jack Grigg
d221b230c6
Fix intra-doc links
2021-03-04 17:41:08 +00: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
8b64c18b0d
aes 0.6
2021-03-04 17:04:26 +00:00
Jack Grigg
9463e41cab
hex-literal 0.3
2021-03-04 17:01:59 +00:00
Jack Grigg
b960cdfd92
secp256k1 0.20
2021-03-04 17:01:59 +00:00
str4d
36e4b0d51a
Merge pull request #329 from nuttycom/ivk_payment_addresses
...
Introduce SaplingIvk newtype & use IVKs where possible.
2021-03-04 07:04:05 +13:00
str4d
47f3b5f045
Merge pull request #343 from str4d/changelogs-add-unreleased
...
Add details of unreleased changes to changelogs
2021-02-23 08:57:52 +13:00
Jack Grigg
d999463d26
Add temporary workaround for funty breakage
2021-02-22 19:15:37 +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
Kris Nuttycombe
b37b5876f2
Merge pull request #318 from nuttycom/tx_version_enum
...
Add TxVersion enum to make interacting with transaction version values safer.
2021-02-04 12:47:12 -07:00
Kris Nuttycombe
974669a50b
Fix clippy lints.
2021-02-04 11:41:29 -07:00
Kris Nuttycombe
796161e9b4
Add suggested comment clarifying future additions to the TxVersion enum
...
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-02-04 11:22:13 -07: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
1cc7949518
Rename CommitmentTree::new -> CommitmentTree::empty
2021-02-04 07:49:48 -07: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
Kris Nuttycombe
7a57aee530
Introduce SaplingIvk newtype & use IVKs where possible.
...
This includes making it possible to obtain a payment address from just the IVK + diversifier.
2021-02-02 15:27:13 -07:00
François Garillot
45f3f5a945
Simplify a few pattern matches
...
A few pattern-matches correspond directly to standard combinators on
`Result`, `Option`. This uses them for concision / clarity.
Refactorings reviewed by the author after suggestion from [comby-rust](https://github.com/huitseeker/comby-rust ).
2021-02-01 13:37:54 -05:00
Kris Nuttycombe
937fa06136
Fix randomized tests of zfuture transaction roundtrip.
2021-01-25 16:32:57 -07:00
Kris Nuttycombe
6373e7d053
Raise an error in the case that sprout version < 1.
...
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-01-25 16:32:57 -07:00
Kris Nuttycombe
1dd5a6dbcb
Check all transaction versions in has_sprout and uses_groth_proof checks.
2021-01-25 16:32:57 -07:00
Kris Nuttycombe
06cd91059f
Enable transaction serialization roundtrip tests outsize zfuture.
2021-01-25 16:32:57 -07:00
Kris Nuttycombe
da4cf23668
Add TxVersion enum to make interacting with transaction version values safer.
...
Co-authored-by: str4d <thestr4d@gmail.com>
2021-01-25 16:32:57 -07:00
Sean Bowe
6315f7dc28
Use wNAF multiplication for Sapling key agreement.
2021-01-22 15:16:06 -07:00
Kris Nuttycombe
8e8ed2bb4f
Rename get_verified_balance -> get_balance_at
2021-01-15 12:00:14 -07:00
Kris Nuttycombe
c70a9ed81f
Apply suggestions from code review
...
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
Co-authored-by: str4d <thestr4d@gmail.com>
2021-01-15 11:57:58 -07:00
Kris Nuttycombe
ce06db197a
Rustfmt.
2021-01-12 21:10:34 -07:00
Kris Nuttycombe
db9eb29eba
Merge remote-tracking branch 'upstream/master' into data_access_api
2021-01-12 21:09:40 -07:00
Kris Nuttycombe
7acc75249b
Fix documentation of human-readable prefixes.
2021-01-12 20:45:28 -07: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
Kris Nuttycombe
27d7b6c569
A few doc updates.
2021-01-08 18:08:02 -07:00
Kris Nuttycombe
472dac7a22
Revert intra_doc_link_resolution_failure flag change.
2020-12-17 07:36:18 -07:00
Kris Nuttycombe
cf0c3ea90f
Relax RngCore type constraints.
...
The intent of this change is to permit tests to use deterministic
random sources, rather than cryptographically strong ones.
2020-12-14 13:44:05 -07:00
Kris Nuttycombe
c24f663e40
Use methods on sigversion to gate ZIP-243 and TZE signature parts.
2020-12-14 14:54:29 +00:00
Kris Nuttycombe
790071953c
Use rust feature flagging to allow conditionally enabling TZE-related code.
...
This also uses the test-dependencies feature flag for conditional
inclusion of proptest-related modules which may be used by
dependent crates for generation of samples in testing.
2020-12-14 14:54:12 +00:00
Daira Hopwood
62675f4b4f
Use the SHA-256d HashReader and HashWriter for transaction hashing.
...
This hashes the transaction as it is read, rather than hashing a re-serialization.
Co-authored-by: Jack Grigg <str4d@electriccoin.co>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-12-03 21:22:58 +00:00
Daira Hopwood
1f18da239f
Add HashReader and HashWriter for SHA-256d.
...
Co-authored-by: Jack Grigg <str4d@electriccoin.co>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-12-03 21:22:58 +00:00
Kris Nuttycombe
cf2dae8af0
Add hrp_sapling_extended_spending_key to Parameters trait.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
ee0e059eb3
Add coin_type to consensus parameters.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
a437df191e
Initial skeleton of low-level database access API.
2020-12-02 09:46:17 -07:00
Kris Nuttycombe
1285ab0af2
Fix tests to account for modified default fees.
2020-11-24 01:24:19 +00:00
Kevin Gorham
53ebc378cc
ZIP-313 change default fee amount.
2020-11-24 01:22:14 +00:00
Kris Nuttycombe
f40174464a
Use slices as parameters rather than &Vec references.
...
Co-authored-by: str4d <thestr4d@gmail.com>
2020-11-19 14:49:24 -07:00
Kris Nuttycombe
726f02513d
Make the functions which produce the components of the sighash reusable.
...
When implementing transaction nonmalleability, it will be useful
to have this already done.
2020-11-19 11:25:24 -07:00
Jack Grigg
be8bae71be
Suppress clippy lints where we want the given behaviour
2020-10-30 14:10:35 +00: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
88474c71c7
Simplify expressions
2020-10-30 13:51:40 +00:00
Jack Grigg
0cb51f963c
Remove unnecessary clones
2020-10-30 13:51:40 +00:00
Jack Grigg
bc9ca20d56
Make use of assignment operators
2020-10-30 13:26:36 +00:00
Jack Grigg
890648df4d
Use !x.is_empty() instead of x.len() > 0
2020-10-30 13:25:08 +00:00
Jack Grigg
0bbcd8c408
Remove unnecessary imports
2020-10-30 13:22:46 +00:00
Aditya Kulkarni
70ecd6b2d8
Export notesize constants
2020-10-26 11:31:22 -07:00
Jack Grigg
d657ff906e
zcash_primitives: Small simplification to Script::address
2020-10-18 13:17:16 +01:00
Kris Nuttycombe
b1c3f9d3f0
ZIP 321 Reference Implementation ( #294 )
...
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
Co-authored-by: Jack Grigg <jack@electriccoin.co>
2020-10-15 14:03:40 +01:00
Kris Nuttycombe
eeb0c2b08a
Update comment in zcash_primitives/src/transaction/builder.rs
2020-10-13 14:28:54 -06:00
Kris Nuttycombe
536c77bea7
Fix formatting.
2020-10-13 07:12:33 -06:00
Kris Nuttycombe
cc121ede8e
Document `TzeIn` serialization.
2020-10-09 16:37:00 -06:00
Kris Nuttycombe
39ab6e5b95
Apply suggestions from code review
...
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2020-10-09 16:19:44 -06:00
Kris Nuttycombe
26aa23988c
Replace domain separator with a 1-byte tag.
2020-09-30 10:22:51 -06:00
Kris Nuttycombe
03b4e56a44
Formatting fix.
2020-09-23 17:14:35 -06:00
Kris Nuttycombe
b6cd096c10
Generate plausible scripts for transaction proptests.
...
Co-authored-by: str4d <thestr4d@gmail.com>
2020-09-23 14:48:10 -06:00
Kris Nuttycombe
9963fb9e57
Use CompactSize & Vector::write for tze sighash construction.
2020-09-23 14:37:48 -06:00
Kris Nuttycombe
995d063992
Documentation fixes from code review.
...
Co-authored-by: str4d <thestr4d@gmail.com>
2020-09-23 14:16:29 -06:00
Kris Nuttycombe
6a536aa88a
Use more informative type names in Extension trait.
2020-09-23 13:35:14 -06:00
Kris Nuttycombe
36c28341b3
Additional future -> zfuture renaming.
2020-09-23 13:11:47 -06:00
Kris Nuttycombe
99eb5b9336
Rename `Future -> ZFuture`
...
Proactively distinguish against future use of the
futures crate for source greppability.
2020-09-22 10:17:58 -06:00
Kris Nuttycombe
a0a36eddfd
Merge remote-tracking branch 'upstream/master' into zip-tzes
...
Fix benchmark build issues.
2020-09-21 16:43:33 -06:00
Kris Nuttycombe
ab2d5bf603
Merge remote-tracking branch 'upstream/master' into zip-tzes
2020-09-21 10:08:05 -06:00
str4d
e0587e752b
Merge pull request #290 from str4d/273-remove-decryption-epk-subgroup-check
...
Take epk as a jubjub::ExtendedPoint for note decryption
2020-09-22 03:05:35 +12:00
Kris Nuttycombe
924ee09bc4
Add documentation to primary `Extension` trait
2020-09-18 11:21:44 -06:00
Kris Nuttycombe
cfb6850d7c
Rustfmt
2020-09-18 10:52:58 -06:00
Kris Nuttycombe
80e1d35ea6
Apply additional suggestions from code review.
2020-09-18 10:40:30 -06:00
Kris Nuttycombe
90d8980162
Apply suggestions from code review
...
Co-authored-by: str4d <thestr4d@gmail.com>
2020-09-18 10:39:37 -06:00
Kris Nuttycombe
d232133216
Add constants to support static resolution of network parameters.
2020-09-17 12:58:23 -06:00
Kris Nuttycombe
1ad9294933
Remove static determination of network state.
...
In the interest of making the library usable for both
testnet and mainnet without recompilation, static resolution
of network parameters has been replaced with a parameter passed
to the relevant functions. This also moves addres prefix constants
into the network parameters.
2020-09-17 10:34:42 -06:00
Kris Nuttycombe
efaba87681
Add newtype for block height.
2020-09-17 10:26:41 -06:00
Kris Nuttycombe
c35c501734
Add comment on FUTURE_TX_VERSION/GROUP_ID`
2020-09-10 14:52:47 -06:00
Kris Nuttycombe
208208238d
Add property test for round-trip serialization of TZE-bearing transactions.
2020-09-10 14:52:47 -06:00
Kris Nuttycombe
a5d5f87b48
Bind TZE inputs and outputs in signature.
2020-09-10 14:52:47 -06:00
Kris Nuttycombe
eb4a2d5032
Add domain separator to transparent signatures.
...
Once TZEs are active, we would like to ensure that collisions
between TZE input signatures and transparent input signatures
cannot occur, so we add a domain separator to both.
This also ensures that if TZE inputs are presented for signature
without using the `Future` sighash version, that the signing
code will report an error.
2020-09-10 14:52:47 -06:00
Kris Nuttycombe
5a432b5e2b
Ensure that prevout, extension_id & mode data can be signed in builder.
2020-09-10 14:52:47 -06:00
Kris Nuttycombe
1a8168e1c9
Document transaction builder methods.
2020-09-10 14:52:47 -06:00
Kris Nuttycombe
671caa8b84
Remove unused Epoch trait.
2020-09-10 14:52:47 -06:00
Kris Nuttycombe
23634d4cd0
Document ExtensionTxBuilder methods
2020-09-10 14:52:47 -06:00
Kris Nuttycombe
9d2f388b3b
Apply idiomatic rustlang suggestions from code review
...
Co-authored-by: str4d <thestr4d@gmail.com>
2020-09-10 14:52:47 -06:00
Kris Nuttycombe
9ef15b536c
Update method documentation in zcash_primitives/src/extensions/transparent.rs
...
Co-authored-by: str4d <thestr4d@gmail.com>
2020-09-10 14:52:47 -06:00
Kris Nuttycombe
b15e49ef47
Documentation update to zcash_primitives/src/extensions/transparent.rs
...
Co-authored-by: str4d <thestr4d@gmail.com>
2020-09-10 14:52:47 -06:00
Kris Nuttycombe
af931d524a
Demo TZE fixes in response to PR comments.
2020-09-10 14:52:47 -06:00
Kris Nuttycombe
aed2759e1e
Use NetworkUpgrade for TZE epoch determination.
...
This adds a `Future` variant for both BranchId and NetworkUpgrade.
2020-09-10 14:52:47 -06:00
Kris Nuttycombe
81b6f8afd7
Formatter fix.
2020-09-10 14:52:47 -06:00
Kris Nuttycombe
4bf6309c54
Update to non-yanked version of subtle crate.
2020-09-10 14:52:47 -06:00
Kris Nuttycombe
8299f336d3
Add test for tze txn parsing.
2020-09-10 11:58:40 -06:00
Kris Nuttycombe
dc9b007e8e
Add signature hash over TZE data.
2020-09-10 11:58:40 -06:00
Kris Nuttycombe
294aa86195
Change extension_id and mode types to u32
2020-09-10 11:58:40 -06:00
Kris Nuttycombe
4edbd26d7f
Keep transaction details private.
2020-09-10 11:58:40 -06:00
Kris Nuttycombe
fe6bea1fce
Check transparent input for correctness before modifying vin.
2020-09-10 11:58:40 -06:00
Kris Nuttycombe
4a954c7f8f
Add tests for transaction builder support.
2020-09-10 11:58:40 -06:00
Kris Nuttycombe
ca8e24eef5
Add validation to demo transaction builder.
2020-09-10 11:58:40 -06:00
Kris Nuttycombe
659c34a954
Make error a type member of FromPayload trait rather than a type variable.
...
Fix demo test compilation errors.
2020-09-10 11:58:40 -06:00
Jack Grigg
961d251178
Add transaction-builder suport for TZE-bearing transactions.
2020-09-10 11:58:40 -06:00
Jack Grigg
bf7f95b0e9
TZE consensus context and program sets
...
Co-authored-by: Kris Nuttycombe <kris.nuttycombe@gmail.com>
2020-09-10 11:58:40 -06:00
Jack Grigg
ce9a695ded
Demo TZE parsing and consensus logic
2020-09-10 11:58:40 -06:00
Jack Grigg
b3332db3e9
Add TZEs to transaction format
2020-09-10 11:58:40 -06:00
Jack Grigg
192db29a25
Take epk as a jubjub::ExtendedPoint for note decryption
...
We don't need to check if epk is in the prime-order subgroup before we
trial-decrypt, which saves a third of the cost of trial-decrypting
outputs that are not ours.
2020-09-10 00:39:21 +01:00
Jack Grigg
0b9063e479
zcash_primitives: Add benchmark for Sapling note decryption
2020-09-10 00:21:05 +01: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
ebfull
c7e9523dce
Merge pull request #284 from str4d/259-ovk-none
...
zcash_primitives: Support ovk = ⊥ in note encryption
2020-09-09 14:32:57 -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
6a62993714
secp256k1 0.19
2020-09-09 00:38:54 +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
Jack Grigg
40e135783c
zcash_primitives: Support ovk = ⊥ in note encryption
...
Closes zcash/librustzcash#259 .
2020-08-28 21:17:16 +01:00
Jack Grigg
72817b0edc
zcash_primitives: Add OutgoingCipherKey struct
2020-08-28 16:17:15 +01:00
Jack Grigg
3f06d92eec
Depend on published versions of subtree crates
2020-08-27 23:25:20 +01:00
Jack Grigg
e25a7dacdf
zcash_primitives 0.3.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
a3cb89dff9
zcash_primitives: Add feature flags to docs.rs documentation
2020-08-23 06:56:03 +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
Daira Hopwood
ee6c21f95b
Scripted diff:
...
```
find . -not -path '*/.git/*' -a -type f -exec sed -i -e 's/hash_x/hash_u/g' {} \;
find . -not -path '*/.git/*' -a -type f -exec sed -i -e 's/hash_y/hash_v/g' {} \;
```
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2020-08-22 01:28:13 +01:00
Jack Grigg
d15acf8acc
zcash_primitives: Rename Note::cm to Note::cmu
2020-08-21 18:35:04 +01:00
Jack Grigg
7a6223202e
zcash_primitives: Remove redundant TODO
...
The primitives are no longer generic over a curve; we hard-code Jubjub,
so we know that the smallest u-coordinate that is not on the curve is 1.
2020-08-21 18:27:09 +01:00
Jack Grigg
ca5bc6b0ae
zcash_primitives: Fix names of some test vector macros
2020-08-21 18:25:30 +01:00
Jack Grigg
ed3489a111
zcash_primitives: Explicitly type zero-initialised arrays
2020-08-21 18:22:29 +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
10c571f2cd
zcash_primitives: 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
Matthew Fors
b86558c63a
Decrypt sapling output description given OCK ( #271 )
...
* decrypt sapling outputs directly with ock
* make prf_ock public
* unit tests for ock sapling output decryption
2020-08-19 06:38:09 +12:00
Jack Grigg
45a7861720
zcash_primitives: fpe 0.3
2020-08-16 11:16:23 +01:00
Jack Grigg
751ddad17d
zcash_primitives: crypto_api_chachapoly 0.4
2020-08-14 17:44:17 +01:00
Jack Grigg
9ced89a1b0
zcash_primitives: secp256k1 0.17
2020-08-14 17:44:17 +01:00
Jack Grigg
bc8a839c61
Migrate to hex 0.4
2020-08-14 17:44:17 +01:00
Jack Grigg
5fe2d6a57c
zcash_primitives: ripemd160 0.9 and sha2 0.9
2020-08-14 17:44:17 +01:00
ying tong
72cc8fc916
Minor refactor of enumeration in tests in note_encryption.rs
...
Co-authored-by: str4d <thestr4d@gmail.com>
2020-08-07 08:46:15 +08:00
ying tong
13f4d0844e
Avoid using unwrap() when calling derive_esk()
...
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2020-08-07 00:12:07 +08:00
therealyingtong
d54fd09c5f
Add esk check in parse_note_plaintext_without_memo() and try_sapling_output_recovery()
2020-08-06 18:39:49 +08:00
therealyingtong
5480a376df
Extract derive_esk() into separate function
2020-08-06 18:21:27 +08:00
therealyingtong
7cee29bbcc
Use <P: consensus::Parameters> type for Builder impl
2020-08-06 18:12:15 +08:00
ying tong
0f8f1b3f5d
Fix parsing of rseed in parse_note_plaintext_without_memo() and try_sapling_output_recovery()
...
Co-authored-by: str4d <thestr4d@gmail.com>
2020-08-06 18:12:15 +08:00
ying tong
40a908e0a8
Refactor leadbyte_array in note_encryption tests
...
Co-authored-by: str4d <thestr4d@gmail.com>
2020-08-06 18:12:10 +08:00
therealyingtong
8968547981
Document pub enum Rseed<Fs> with link to ZIP 212
2020-08-06 13:13:49 +08:00
therealyingtong
878646855c
Switch on leadbyte instead of tx height when decrypting outputs
2020-08-06 12:57:48 +08:00
therealyingtong
c3d89644e2
Revert SaplingNoteEncryption::new() API to take rng instead of esk
2020-08-06 12:47:35 +08:00
therealyingtong
4f22077cf6
Remove const activation heights from consensus.rs
2020-08-06 12:30:48 +08:00
therealyingtong
9970a8aefd
Hard-code NetworkUpgrade::Canopy in generate_random_rseed
2020-08-06 12:27:20 +08:00
therealyingtong
44f46e50ce
Add <P: consensus::Parameters> type parameter to Builder struct
2020-08-06 11:43:07 +08:00
therealyingtong
88072d64ec
Remove network cfg from zcash_client_backend and zcash_primitives
2020-08-06 11:35:05 +08:00
therealyingtong
c8fcdeb50b
Minor changes in note_encryption.rs
2020-08-05 15:45:18 +08:00
therealyingtong
2ed9b6f881
Refactor contextual random rseed generation into util method in zcash_primitives
2020-08-05 15:21:42 +08:00
therealyingtong
a3ae1b273d
Switch plaintext version on height for dummy outputs in Builder
2020-08-05 14:27:36 +08:00
therealyingtong
a25348dfba
Revert passing Parameters to methods
2020-08-05 12:47:29 +08:00
therealyingtong
0a47a9dbea
Pass rseed to Prover
2020-08-04 16:40:53 +08:00
therealyingtong
b34e8b903c
Add invalid version byte tests for ZIP212
2020-08-03 13:51:45 +08:00
therealyingtong
eba542c95f
Add activation heights as consts in consensus::Parameters
2020-08-03 13:40:39 +08:00
therealyingtong
b1ddd556af
Check derived esk against claimed epk when decrypting note
2020-07-31 22:40:52 +08:00
therealyingtong
895e251793
Fix tests
2020-07-31 22:40:48 +08:00
therealyingtong
6904c8f933
Implement plaintext_version_is_valid()
2020-07-31 22:28:51 +08:00
therealyingtong
eda00ec7ad
Pass esk to SaplingNoteEncryption::new and add generate_or_derive_esk()
2020-07-31 22:28:50 +08:00
therealyingtong
65504d9ca7
Add enum Rseed<E::Fs> to Note struct
2020-07-31 22:28:40 +08:00
therealyingtong
b537f0f712
Pass height to methods which encrypt or decrypt Sapling outputs
2020-07-31 12:39:39 +08:00
therealyingtong
71d31abad6
Set activation heights for Canopy
2020-07-30 12:52:02 +08: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
5b2c71e112
Move Equihash verification APIs into equihash crate
2020-06-26 13:01:04 +12:00
Jack Grigg
34725df086
zcash_client_sqlite::transact::create_to_address()
2020-06-25 18:54:41 +12:00
therealyingtong
a4b010e003
Placeholders for Canopy network upgrade
2020-06-04 15:44:15 +08:00
Jack Grigg
3779c12e31
Set activation heights for Heartwood network upgrade
2020-06-04 15:33:07 +12:00
Aditya Kulkarni
4b1d8e5226
Add methods to get OutPoint n, hash
2020-05-22 18:02:44 -07:00
Jack Grigg
4edff96321
Fix various lints
2020-05-22 18:52:35 +12:00
Jack Grigg
d7d49285d8
Remove explicit std::marker from Sized bound
...
Sized is always part of the prelude, and binding on std causes
compilation issues for no-std crates.
2020-05-15 00:20:32 +12:00
Jack Grigg
c597db59a6
ff: Rename PrimeField::into_repr -> PrimeField::to_repr
2020-05-02 18:55:13 +12:00
Jack Grigg
15e229509a
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-05-02 18:54:02 +12:00
Jack Grigg
fb31d09218
ff: Remove Ord bound from PrimeField
...
ff_derive still implements Ord and PartialOrd for the fields it
implements, because pairing::bls12_381 internally assumes that those are
implemented. Once we delete that implementation, we will remove the Ord
and PartialOrd implementations from ff_derive.
2020-05-02 18:54:02 +12:00
Jack Grigg
38f87c2e73
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-05-02 18:54:02 +12:00
Jack Grigg
55568b4d6e
ff: Remove frobenius_map from Field trait
...
It is only used internally in the bls12_381 crate, and field extensions
aren't exposed anywhere in the Zcash stack.
2020-05-02 16:07:48 +12:00
Jack Grigg
1761ebfb35
ff: Remove SqrtField trait
...
The sqrt() function is now part of the Field trait. ff_derive returns an
error on fields for which it does not support generating a square root
function.
Note that Fq6 and Fq12 in pairing::bls12_381 leave the function
unimplemented. They will be dropped once the migration to the bls12_381
crate is complete. The equivalent structs in that crate are not exposed.
2020-05-02 16:07:48 +12:00
str4d
b02cf3b467
Merge pull request #223 from str4d/remove-primefieldrepr
...
Remove ff::PrimeFieldRepr
2020-05-01 08:59:41 +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
1fe3e3784c
ff: Add Ord bound to PrimeField
2020-04-23 17:31:33 +12:00
Jack Grigg
1a40cfd39c
zcash_primitives: Make jubjub::Fs::invert constant time
2020-04-23 16:23:24 +12:00
Jack Grigg
08500ee712
ff: PrimeField: BitAnd<u64, Output = u64> + Shr<u32, Output = Self>
2020-04-23 16:23:24 +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
Aditya Kulkarni
3ccadf3017
Add binding signature only if needed
2020-04-04 10:29:30 -07:00
Jack Grigg
b6457a905b
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-03-28 00:27:59 +13: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
Sean Bowe
b52e4aac3a
Fix Field::random method declarations.
2020-03-03 17:47:29 -07:00
Jack Grigg
2d30c29d06
Pass &impl TxProver to Builder::build
...
This allows the caller to build multiple transactions with a single
proving backend.
2020-02-08 00:37:31 +00:00
Jack Grigg
76e0f658c1
Rename CommitmentTreeWitness -> MerklePath
2020-02-08 00:36:40 +00:00
Jack Grigg
3a3008caf9
Pass CommitmentTreeWitness directly into Builder::add_sapling_spend
...
This is more likely to be the data that the caller has available, and
is all we need now that a CommitmentTreeWitness can compute its root.
2020-02-07 17:31:38 +00:00
Jack Grigg
8a210ec271
CommitmentTreeWitness::root(leaf)
2020-02-07 17:21:59 +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
00499b3441
Migrate zcash_primitives benchmarks to criterion
2019-12-19 16:11:11 -06:00
Jack Grigg
ec2c304efd
no_std support for ff crate
2019-12-14 12:55:34 +00:00
Jack Grigg
1c9f5742fa
Improve Field::pow API and impl
...
Renamed to Field::pow_vartime to indicate it is still variable time with
respect to the exponent.
2019-12-14 12:27:48 +00: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
662be3551f
impl ConditionallySelectable for Field
2019-12-12 23:15:48 +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
zancas
0aa127d7b1
refactor to manage test code and data in separate modules
2019-12-11 23:58:13 +00:00
Jack Grigg
e6a8630b35
impl TryFrom<u32> for BranchId
2019-11-27 13:18:31 +00:00
Jack Grigg
cd326f2b6a
Consensus parameters for network upgrades
2019-11-27 13:18:30 +00:00
Jack Grigg
c24024b8e1
Create a consensus::BranchId enum for type safety
...
Includes all currently-known consensus branch IDs for the Zcash network.
2019-11-25 21:04:20 +00:00