Commit Graph

529 Commits

Author SHA1 Message Date
Jack Grigg 0f2689b9c3 zcash_client_sqlite: Maintain a nullifier map from out-of-order scanning
Closes zcash/librustzcash#876.
2023-07-21 18:01:52 +00:00
Jack Grigg a87dca00e2 Documentation updates, fixes, and cleanups
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2023-07-19 14:54:01 +00:00
Jack Grigg 2a98f94f05 Add more debug and trace logging
The `Debug` impl for `sapling::Node` is updated to output hex-encoded
bytes for readability.
2023-07-18 17:23:57 +00:00
Jack Grigg f7163e9dd9 Code simplifications
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2023-07-18 17:23:55 +00:00
Jack Grigg ed4b6dc9b9 Fix bugs in `ScanRange::truncate_*` 2023-07-18 17:22:48 +00:00
Kris Nuttycombe 6fa0b46d8e Implement `suggest_scan_ranges` and `update_chain_tip`
This implements a priority queue backed by the wallet database for scan
range ordering. The scan queue is updated on each call to `put_blocks`
or to `update_chain_tip`.
2023-07-07 20:13:45 -06:00
Jack Grigg a11545459b Bump patched dependencies to bring in shardtree bugfixes 2023-07-06 22:19:21 +00:00
Kris Nuttycombe d55fa09464 Add a check to ensure that blocks passed to `put_blocks` are sequential. 2023-07-06 12:13:39 -06:00
Kris Nuttycombe 1b5a24a655 Batch data store writes of `put_block`
Instead of calling `put_block` for each block scanned,
`scan_cached_blocks` will now defer the block writes until the scan of a
batch is complete and will perform the block writes and note commitment
tree updates all within a single transaction.

This should ordinarily be fine in terms of memory consumption, because
the block data being saved is pruned to only that spend an output
information that is related to transactions in the wallet, which will
normally be sparse enough that the block range size that is appropriate
for a given platform to run within a batch scanner adequately bounds the
memory consumption of this pruned representation.
2023-07-06 12:13:39 -06:00
Kris Nuttycombe 81a32f284e Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2023-07-06 11:24:16 -06:00
Kris Nuttycombe 98147e0d7d Make `from_height` and `limit` parameters to `scan_cached_blocks` non-optional. 2023-07-05 18:56:19 -06:00
Kris Nuttycombe faccf56f04 Split `PoolType` enum into `PoolType` and `ShieldedProtocol`
There are cases where we wish to return informaiton that is relevant to
a specific shielded protocol and `Transparent` is an invalid case. This
is a minor preparatory refactoring that makes this distinction
expressible.
2023-07-05 18:20:43 -06:00
Kris Nuttycombe 1e5b23aeba zcash_client_backend: Add `put_sapling_subtree_roots` to `WalletCommitmentTrees`
Also add the `zcash_client_sqlite` implementation & tests for the new
method.
2023-07-05 18:18:20 -06:00
Kris Nuttycombe c13c8c6678 Address comments from code review. 2023-07-03 17:08:01 -06:00
Kris Nuttycombe c363e71fa9 Rename proto::compact::{BlockMetadata => ChainMetadata} 2023-07-03 16:19:13 -06:00
Kris Nuttycombe 42ed6ba2a1 Rename `zcash_client_backend::welding_rig` to `zcash_client_backend::scanning` 2023-07-03 10:49:03 -06:00
Kris Nuttycombe e3aafdad19 Move chain continuity checks into `scan_block_with_runner`
In preparation for out-of-order range-based scanning, it is necessary
to ensure that the size of the Sapling note commitment tree is carried
along through the scan process and that stored blocks are always
persisted with the updated note commitment tree size.
2023-07-03 10:49:03 -06:00
Kris Nuttycombe 77b638012b Remove `zcash_client_backend::data_api::chain::validate_chain`
Local chain validation will be performed internal to
`scan_cached_blocks`, and as handling of chain reorgs will need to
change to support out-of-order scanning, the `validate_chain` method
will be superfluous. It is removed in advance of other changes in order
to avoid updating it to reflect the forthcoming changes.
2023-07-01 17:58:01 -06:00
Kris Nuttycombe e225a54d2e Use `NonZeroU32` for all `min_confirmations` values. 2023-06-30 12:37:41 -06:00
Kris Nuttycombe 45177a51e1 Fix off-by-one error in scan_block_with_runner. 2023-06-30 09:30:24 -06:00
Kris Nuttycombe c05b3d0c8c Add a test demonstrating off-by-one error in `scan_block_with_runner` 2023-06-30 09:30:24 -06:00
Kris Nuttycombe 8fa3a08c0b Fix indexing error in checkpoint determination. 2023-06-30 09:30:24 -06:00
Kris Nuttycombe d65b129b43 Apply changelog, documentation & style suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2023-06-30 09:30:24 -06:00
Kris Nuttycombe ba709177d3 Reorganize Sapling and Orchard note commitment tree sizes in CompactBlock.
We move thes fields out into a separate BlockMetadata struct to ensure
that future additions to block metadata are structurally separated from
future additions to block data.
2023-06-29 15:35:18 -06:00
Kris Nuttycombe c42cffeb1d zcash_client_backend: Replace `WalletWrite::advance_by_block` with `WalletWrite::put_block`
Also, add assertions to prevent attempting the creation of zero-conf
shielded spends.
2023-06-29 15:35:18 -06:00
Kris Nuttycombe 3e358bc1c9 zcash_client_backend: Use `shardtree` for note commitments in block scanning.
Also adds a skeleton `zcash_client_sqlite` implementation of
`shardtree::ShardStore` and a skeleton migration for related
database changes.
2023-06-29 15:35:18 -06:00
Kris Nuttycombe 32e2991c4d zcash_client_backend: Add note commitment tree sizes to `CompactBlock` serialization. 2023-06-26 10:19:43 -06:00
Hazel OHearn 4fbdd64c89 Add Orchard support to `zcash_primitives::transaction::builder::Builder`
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
2023-06-23 14:09:59 -06:00
Nate Wilcox 5ba44b9019 Update dependencies to resolve https://rustsec.org/advisories/RUSTSEC-2022-0090 2023-06-17 12:44:35 -07:00
Kris Nuttycombe e7fb276b04 Release zcash_proofs 0.12.0 2023-06-06 15:56:29 -06:00
Kris Nuttycombe f9cacc5b21 Release zcash_primitives 0.12.0 2023-06-06 15:56:28 -06:00
Kris Nuttycombe 60ac1070c5 Release zcash_address version 0.3.0 2023-06-06 15:53:16 -06:00
Kris Nuttycombe 75e529eea6 Upgrade to `bs58 0.5` 2023-06-06 15:53:14 -06:00
Kris Nuttycombe 3dd0c63095 Update to `incrementalmerkletree 0.4`, `orchard 0.5` 2023-06-06 14:27:39 -06:00
Kris Nuttycombe 0b126a107c
Clarify `Zip321Error::TooManyPayments` documentation.
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2023-06-06 09:29:43 -06:00
Kris Nuttycombe bca951bf44 doc-only: Document ZIP 321 error variants.
Fixes #499
2023-06-06 08:42:54 -06:00
Kris Nuttycombe ebcfae987d Update the data access API in preparation for shardtree introduction. 2023-06-02 10:59:17 -06:00
Kris Nuttycombe 4b3ea857df
Merge pull request #818 from nathan-at-least/resolve-RUSTSEC-2023-0018
Bump `tempfile` to 3.5.0 to mitigate RUSTSEC-2023-0018…
2023-05-22 20:19:43 -06:00
Kris Nuttycombe b341903ae2
Merge pull request #842 from zcash/msrv-1.65
Bump MSRV for `zcash_primitives` and dependents to 1.65
2023-05-19 09:28:43 -06:00
Kris Nuttycombe ea84243e0f Add `get_memo` change to the zcash_client_backend CHANGELOG 2023-05-17 08:56:24 -06:00
Kris Nuttycombe d99b4d4d6e Update memo retrieval API to reflect that memos may not be present.
Memos may be absent for both sent and received notes in cases where only
compact block information has been used to populate the wallet database.
This fixes a potential crash in the case that we attempt to decode a
SQLite `NULL` as a byte array. It does, however, introduce a slight
semantic confusion that will need to be considered in the case of future
updates where a note may not have an associated memo; at present, the
only reason we might not have the memo is that we might not have
retrieved the full transaction information from the chain, but in the
future there might be other possible reasons for this absence.

Fixes #384
2023-05-16 10:27:40 -06:00
Jack Grigg a092da8d5d Fix clippy lints for 1.65 2023-05-16 15:59:58 +00:00
Jack Grigg 8681b56d52 Bump MSRV for `zcash_primitives` and dependents to 1.65 2023-05-16 15:37:07 +00:00
Kris Nuttycombe 87212b6137
Merge branch 'main' into resolve-RUSTSEC-2023-0018 2023-05-12 09:08:59 -06:00
Kris Nuttycombe a718810fa8
Update zcash_client_backend/src/data_api/wallet.rs 2023-05-09 12:32:56 -06:00
Daira Emma Hopwood 9cc6319f26 Fix clippy lints.
Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-05-09 17:59:03 +01:00
Daira Emma Hopwood 3903935234 Deprecate `transaction::components::amount::DEFAULT_FEE` and
`zcash_primitives::transaction::fees::fixed::FeeRule::standard()`.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-05-09 17:18:34 +01:00
Daira Emma Hopwood 736d11b45b Change `transaction::fees::fixed::FeeRule::standard()` to use the ZIP 317
minimum fee (10000 zatoshis rather than 1000 zatoshis) as the fixed fee.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-05-09 16:42:41 +01:00
Daira Emma Hopwood 4cf27126e5 Revert "Update DEFAULT_FEE to 10_000 from 1000"
This reverts commit 2a6dc59c5d.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-05-09 13:15:52 +01:00
Kris Nuttycombe d37e6adee5
Merge pull request #783 from nuttycom/upgrade_bridgetree
Upgrade `zcash_primitives` to use updated `incrementalmerkletree` types.
2023-05-08 12:00:00 -06:00