Commit Graph

2477 Commits

Author SHA1 Message Date
str4d 1dc3cfe724
Merge pull request #657 from nuttycom/wallet/upsert_utxos
Use upsert functionality for transparent UTXOs, rather than delete/repopulate.
2022-10-11 04:17:49 +01:00
Daira Hopwood 709577cec7
Merge pull request #666 from upbqdn/temporarily-fix-params-download
zcash_proofs: Temporarily fix params download
2022-10-09 00:36:58 +01:00
Marek 75b4036862 Avoid a needless range loop 2022-10-07 17:19:03 +02:00
Kris Nuttycombe daf02c4338
Merge pull request #667 from nuttycom/wallet/transaction_fee_allow_missing_utxo
Allow spent UTXOs to be absent in migrations when adding tx fee.
2022-10-06 17:56:17 -06:00
Kris Nuttycombe c7be8ef04a Allow spent UTXOs to be absent in migrations when adding tx fee.
The previous approach to UTXO handling involved UTXO data being
deleted from the wallet after the relevant UTXOs had been spent.
However, this means that we can no longer accurately compute
transaction fees for the transactions spending those UTXOs.
The `net_value` of the resulting rows in v_transactions will be
null.
2022-10-06 17:13:27 -06:00
str4d f04690bfc0
Merge pull request #664 from zcash/dependabot/github_actions/actions/cache-3.0.10
build(deps): bump actions/cache from 3.0.8 to 3.0.10
2022-10-06 20:44:13 +01:00
Marek f0f348ed00 Use the provided buffer when reading the response
The implementation of `io:Read` for `ResponseLazyReader` used to return
only one byte regardless of the size of the provided `buf`, which
significantly degraded the performance of loading the response.

This change makes use of the provided `buf`. On my machine with Rust
1.64, the downloading speed went up from ~100 KiB/s to ~2 MiB/s.
However, as before this change, the process still uses 100% of a single
CPU thread when downloading the response. The most likely reason is that
we still manually read each byte of the response. I can download the
same data with ~ 50 MiB/s on my machine using a different HTTP client.

This fix seems to be sufficient for now.
2022-10-05 23:47:50 +02:00
Kris Nuttycombe e9406201d5
Merge pull request #663 from nuttycom/sapling_key_cleanup
Fix Sapling key organization.
2022-10-05 14:35:16 -06:00
Marek 01a3c64606 Use `ResponseLazyReader` locally 2022-10-05 22:22:27 +02:00
Kris Nuttycombe d6484da088 Minor documentation fixes.
Co-authored-by: ying tong <yingtong@z.cash>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-10-05 13:02:21 -06:00
Kris Nuttycombe 6df6fec860 Add utxo received_by_account data to WalletTransparentOutput
Also, this removes wallet::delete_utxos_above.
2022-10-04 13:34:52 -06:00
Kris Nuttycombe 14787f574f Add a migration to add account ID to the utxos table. 2022-10-04 12:25:56 -06:00
dependabot[bot] 4fe49fd931
build(deps): bump actions/cache from 3.0.8 to 3.0.10
Bumps [actions/cache](https://github.com/actions/cache) from 3.0.8 to 3.0.10.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3.0.8...v3.0.10)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-04 05:13:45 +00:00
Kris Nuttycombe 60785a1d7a Fix Sapling key organization.
This change moves Sapling-specific key generation into a
submodule of `zip32`. Public reexports are used to keep the
existing API consistent.
2022-10-03 20:28:04 -06:00
Kris Nuttycombe ab6f7929b4
Merge pull request #660 from nuttycom/upgrade_rusqlite
Upgrade rusqlite to version 0.25
2022-10-03 18:27:18 -06:00
Kris Nuttycombe f7aa7b2c84 Upgrade rusqlite to version 0.25 2022-10-03 08:12:37 -06:00
Kris Nuttycombe 81e0d482d0
Merge pull request #656 from nuttycom/sqlite/migration_organization
Move wallet migrations into individual modules.
2022-10-03 08:10:08 -06:00
Kris Nuttycombe 3b283ca445
Merge pull request #662 from str4d/remove-direct-ff-dep
Remove direct `ff` dependency
2022-10-02 17:14:06 -06:00
Jack Grigg e54e3f21e8 zcash_client_sqlite: Remove direct ff dependency 2022-10-02 23:16:44 +01:00
Jack Grigg b3f13020ac zcash_client_backend: Remove direct ff dependency 2022-10-02 23:15:51 +01:00
Jack Grigg 620ff21005 zcash_proofs: Remove direct ff dependency 2022-10-02 23:14:14 +01:00
Kris Nuttycombe ccf9e00b00 Move wallet migrations into individual modules. 2022-10-02 14:20:17 -06:00
Kris Nuttycombe 4e631697c4
Merge pull request #653 from nuttycom/bug/wallet_max_account
zcash_client_sqlite: fix wallet::get_max_account_id
2022-09-28 09:14:40 -06:00
Kris Nuttycombe 2c16f78fee zcash_client_sqlite: fix wallet::get_max_account_id
This had the same bug as was fixed in 5b8ec380a0
2022-09-26 16:48:58 -06:00
str4d c06760e985
Merge pull request #648 from zcash/dependabot/github_actions/codecov/codecov-action-3.1.1
build(deps): bump codecov/codecov-action from 3.1.0 to 3.1.1
2022-09-26 17:34:17 +01:00
str4d 2381a515dd
Merge pull request #652 from zcash/scanner-memuse
`zcash_client_backend`: Refactor tracking of `BatchRunner` heap memory usage
2022-09-26 17:32:49 +01:00
Jack Grigg 035e53990c zcash_client_backend: Improve estimation of `rayon` spawned task size 2022-09-24 21:01:19 +00:00
Jack Grigg 913aa0a988 zcash_client_backend: Correctly track heap usage of batch items
As of zcash/librustzcash#633, `SaplingDomain::IncomingViewingKey` now
allocates memory internally, and this memory persists as long as the
`BatchRunner` is alive. Now that we have decoupled the measurement of
heap usage for batch tasks from their internals, we can add bounds to
all of the generic parameters of `Batch` to enable correctly measuring
their actual heap usage.

We also add `DynamicUsage` impls for a bunch of `zcash_primitives` types
that will be used with `BatchRunner` (or its equivalent implementation
in `zcashd`) by callers.
2022-09-24 21:01:19 +00:00
Jack Grigg c98f04330d zcash_client_backend: Move heap tracking of batch tasks behind a trait
This enables the heap usage measurements to be conditionally enabled by
the `BatchRunner` user. Importantly, when heap usage measurements are
not enabled, the `DynamicUsage` bound on `Batch` is not required.

This refactor also fixes a bug in the prior implementation. We were
counting the heap usage of a task when it started to run, but the item
may have been in the `rayon` work-stealing queues for a non-negligible
period before then. We now count the heap usage immediately before
spawning the task into the `rayon` thread pool.
2022-09-24 17:20:55 +00:00
Jack Grigg fe258ca120 zcash_client_backend: Count `tags` in `impl DynamicUsage for Batch` 2022-09-24 13:06:04 +00:00
Daira Hopwood f78c91fd0c
Merge pull request #651 from daira/update-chacha20poly1305
Update chacha20poly1305 dependency in zcash_primitives to 0.10
2022-09-23 22:12:32 +01:00
Daira Hopwood e53439a236 Update chacha20poly1305 dependency in zcash_primitives to 0.10,
consistent with zcash_note_encryption.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-09-23 21:52:40 +01:00
Kris Nuttycombe 774ffadf5a
Merge pull request #649 from zcash/batch-scanner-memory-reduction
Batch scanner memory reduction
2022-09-22 07:44:05 -06:00
Jack Grigg 9a1d61cb4e zcash_client_backend: Only store successes in batch scanner
Previously we were sending an `Option<DecryptedNote>` from each `Batch`
back to its parent `BatchRunner`. However, this requires allocating
sufficient space in the channel to handle the case where every output
can be decrypted. In general this will not be the case, and we can
instead signal "nothing decrypted" by just dropping the channel sender.
This reduces the post-batch-scanning memory usage of `BatchRunner` from
being linear in the number of on-chain outputs, to being linear in the
number of outputs for the wallet.

Ported from zcash/zcash@f7f6c2070d.
2022-09-21 23:51:40 +00:00
Jack Grigg 533722b70e zcash_client_sqlite: Add dynamic memory usage tracking to `BatchRunner`
Ported from zcash/zcash@e88ea11055.
2022-09-21 23:38:44 +00:00
dependabot[bot] dc2118e010
build(deps): bump codecov/codecov-action from 3.1.0 to 3.1.1
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3.1.0 to 3.1.1.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v3.1.0...v3.1.1)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-20 05:16:17 +00:00
Kris Nuttycombe 6cb0d21219
Merge pull request #645 from nuttycom/fix_beta_lints
Fix problems identified by clippy's beta lints
2022-09-17 15:49:49 -06:00
Kris Nuttycombe 03c3370de8 Fix problems identified by clippy's beta lints 2022-09-17 08:57:37 -06:00
Kris Nuttycombe d1f0c12c02
Merge pull request #644 from zcash/fix-fsblockdb-cached-height
zcash_client_sqlite: Fix `FsBlockDb::get_max_cached_height`
2022-09-16 21:19:25 -06:00
Jack Grigg 5b8ec380a0 zcash_client_sqlite: Fix `FsBlockDb::get_max_cached_height`
The `MAX` SQLite function returns `null` when the table is empty. The
code was expecting zero rows to be returned in this case, and was trying
to parse the `null` as an integer.
2022-09-17 02:40:19 +00:00
Kris Nuttycombe bc626156c3
Merge pull request #641 from nuttycom/upgrade_chacha20
Upgrade chacha20poly1305 dependency to version 0.10
2022-09-16 14:39:32 -06:00
Kris Nuttycombe 29220c716f Remove `zcash_primitives` as a zcash_note_encryption dev dependency.
This was only used to provide example code for Sapling usage of
the `NoteEncryption` struct; this example code has been moved
to `sapling::note_encryption`.
2022-09-16 12:52:00 -06:00
Kris Nuttycombe 72b5e6dfc3 Upgrade chacha20poly1305 dependency to version 0.10
Also upgrade  the `chacha20`, `cipher`, and `subtle` dependency
versions.
2022-09-16 12:52:00 -06:00
Kris Nuttycombe d3add8cca4
Merge pull request #596 from nuttycom/wallet/fs_block_source
Add a BlockSource implementation that reads blocks from files in the filesystem.
2022-09-15 09:55:14 -06:00
Kris Nuttycombe f8fd27653c Add a BlockSource implementation that reads blocks from files in the filesystem.
Also, this adds functionality to create and insert records into the
block metadata db that is used as the source for which blocks to read.
2022-09-15 08:27:26 -06:00
str4d 84835035d5
Merge pull request #633 from daira/prepare-epks-and-ivks
Add APIs to prepare ivk and epk and implement them for Sapling
2022-09-15 12:45:33 +01:00
Daira Hopwood 20e869f501 zcash_primitives: Use prepared epk and ivk in Sapling note decryption
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-09-15 03:40:45 +01:00
Daira Hopwood 515b0a40ec zcash_note_encryption: Add API to prepare epk.
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-09-15 03:22:41 +01:00
Daira Hopwood d77ed9c6cf Change batch decryption benchmark to cover more cases of (nivks, noutputs).
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-09-15 03:20:14 +01:00
Kris Nuttycombe 3bc8627e2b
Merge pull request #637 from nuttycom/wallet/create_account
Add WalletWrite::create_account function
2022-09-14 14:30:34 -06:00