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
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
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
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
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
Jack Grigg
38f7a0330c
Fix various clippy lints
...
The remainder will be fixed after the refactor PRs are merged.
2021-03-27 08:50:40 +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
Kris Nuttycombe
f30502c5a2
Apply suggestions from code review
...
Co-authored-by: str4d <jack@electriccoin.co>
2021-03-25 21:24:24 -06:00
str4d
dd15e5f431
Add missing doc link
2021-03-26 15:10:39 +13:00
Kris Nuttycombe
fc3aa233e8
Update ZIP 321 parsing to use the MemoBytes type.
2021-03-26 14:47:15 +13:00
str4d
d73483f5da
Minor fixes to documentation
2021-03-26 14:18:01 +13:00
Jack Grigg
c3c7bd1d9c
bech32 0.8
2021-03-26 13:31:20 +13:00
Kris Nuttycombe
a0c441817a
Documentation fixes in zcash_client_backend.
2021-03-25 18:26:57 -06:00
Jack Grigg
675048e52b
Fix broken intra-doc links and lints
2021-03-26 10:07:20 +13:00
Kris Nuttycombe
42f15a575e
Merge pull request #359 from str4d/356-create_spend_to_address-assumption
...
zcash_client_backend: Use correct output index for t-addr recipients
2021-03-25 07:58:53 -06:00
Kris Nuttycombe
9b1156bf49
Fix rustfmt complaint.
2021-03-25 07:40:02 -06:00
Jack Grigg
678f1b6734
zcash_client_backend: Make transparent output indexing resilient
...
It's cheap to scan all transparent outputs to find the output matching
a transparent recipient.
2021-03-25 21:53:47 +13:00
Jack Grigg
6f93530554
zcash_client_backend: Remove unnecessary type conversion
2021-03-25 21:45:40 +13:00
Jack Grigg
cb6a993840
zcash_client_backend: Use correct output index for t-addr recipients
...
`create_spend_to_address` was originally written only for sending to
Sapling addresses. It was later amended to support sending to
transparent addresses, but the assumption about there being a Sapling
output was not removed. This was not an issue for most transactions
because there would be change, but in the case of a z->t transaction
with no change, `create_spend_to_address` would reliably panic.
This commit fixes the bug by setting the output index for transparent
recipients to 0. The `output_index` field of `SentTransaction` is also
documented to correctly reflect its dependency on the type of
`recipient_address`.
2021-03-24 19:01:35 +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
2b4951759c
Fix welding rig intra-doc links.
2021-03-15 17:59:23 -06:00
Kris Nuttycombe
5a9b29a75a
Address comments from code review.
2021-03-11 13:01:22 -07:00
Kris Nuttycombe
0e022f2283
Allow block scanning using either IVKs or FVKs.
2021-03-09 21:00:40 -07:00
Kris Nuttycombe
16289750e8
Remove WalletWrite::transactionally
2021-03-09 20:59:57 -07:00
Kris Nuttycombe
a74cc8b231
Remove sqlite-specific data organization from data access api.
2021-03-09 20:59:57 -07: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
5431e1ef6b
nom 6.1
2021-03-04 17:03:41 +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
Kris Nuttycombe
f0f4f58b2b
Fix generation of zip321 URIs for proptest to avoid generating invalid ones.
2021-02-04 08:32:00 -07:00
Kris Nuttycombe
1cc7949518
Rename CommitmentTree::new -> CommitmentTree::empty
2021-02-04 07:49:48 -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
Kris Nuttycombe
5cb48fa962
Fix documentation of get_received_note
2021-02-02 13:16:16 -07:00
Kris Nuttycombe
df09877b11
Use an enum to distinguish between sent and received notes in sqlite backend.
2021-01-20 10:51:27 -07:00
Kris Nuttycombe
779a5670e0
Improve data access api method documentation.
2021-01-19 12:45:55 -07:00
Kris Nuttycombe
f8ce44ff0b
Add convenience method for CompactSpend -> Nullifier.
2021-01-19 10:09:36 -07:00
Kris Nuttycombe
8fe6f0fdfd
Remove default get_balance method.
...
Recommended by @str4d
2021-01-19 08:25:10 -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
f59124ce19
Pass account ID with IVK.
2021-01-15 10:18:43 -07:00
Kris Nuttycombe
120ee25e1d
Fix argument to decrypt_and_store_transaction
2021-01-15 10:02:24 -07:00
Kris Nuttycombe
da8b7bdb8f
Work around doctest sqlite IO errors.
2021-01-13 16:14:26 -07:00