Commit Graph

2477 Commits

Author SHA1 Message Date
Kris Nuttycombe d086c57f2f Make init_accounts_table only permit sequential account identifiers.
Also, check to ensure that account creation does not exceed the
maximum account identifier value.
2022-09-14 13:55:31 -06:00
Kris Nuttycombe 75eb082203
Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2022-09-14 12:20:39 -06:00
Kris Nuttycombe abe452d8a5
Merge pull request #638 from zcash/ci-tarpaulin-llvm-engine
CI: Migrate to `cargo-tarpaulin` branch with LLVM source coverage engine
2022-09-14 11:05:02 -06:00
Jack Grigg d21b18d245 CI: Migrate to `cargo-tarpaulin` branch with LLVM source coverage engine 2022-09-14 15:55:12 +00:00
Kris Nuttycombe d0062a87d4 Add WalletWrite::create_account function 2022-09-13 18:58:28 -06:00
Kris Nuttycombe d4cbc04c16
Merge pull request #636 from zcash/batch-scanner-tag-ivks
zcash_client_backend: Add tags to IVKs in the batch scanner
2022-09-13 16:49:10 -06:00
Jack Grigg f7b7760051 zcash_client_backend: Add some typedefs for complex types 2022-09-13 21:58:32 +00:00
Jack Grigg 8f03208439 zcash_client_backend: Add tags to IVKs in the batch scanner
This removes the dependency on `SaplingIvk::to_repr()`, and enables us
to alter the type of `D::IncomingViewingKey` to improve the performance
of batch scanning.

For the welding rig, we already annotate the viewing keys with
`AccountId`, so we use `(AccountId, Scope)` as the tag.
2022-09-13 21:40:58 +00:00
Kris Nuttycombe b5908dc964
Merge pull request #632 from nuttycom/data_api/get_next_address
Replace `get_address` with `get_current_address` and `get_next_available_address`
2022-09-12 18:43:38 -06:00
Kris Nuttycombe 03b0ff7e0a Replace `get_address` with `get_current_address` and `get_next_available_address`
This updates the data access API to provide diversified address
functionality. In order to support this change, the addresses table
is updated to store diversifier index information in big-endian order
to allow sorting by diversifier index, and account initialization
is updated to store the diversifier index accordingly. The currently
unreleased `addresses_table` migration is updated to reflect this
change.
2022-09-12 17:58:22 -06:00
Kris Nuttycombe 306faeee17
Merge pull request #620 from nuttycom/wallet/add_transaction_views
Add views that join transactions & notes for Android SDK support.
2022-09-12 16:36:54 -06:00
Kris Nuttycombe 7d1e976d0a Add missing `WalletMigrationError` to changelog. 2022-09-10 17:02:43 -06:00
Kris Nuttycombe e14e44d6d7 Improve consistency of transaction views test. 2022-09-10 17:02:43 -06:00
Kris Nuttycombe 3120b304c7 Use `NULL` to represent the empty memo.
We don't need to store a bunch of copies of the empty memo, and code
should not be depending upon the presence or absence of a memo to
distinguish between different states of transaction retrieval.
2022-09-10 17:02:43 -06:00
Kris Nuttycombe a93c9d334e Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2022-09-10 17:02:43 -06:00
Kris Nuttycombe 167bcd86ce Update migration to handle the raw-tx-absent case.
The raw serialized transaction data for a transaction is not always
guaranteed to be present, and we cannot correctly calculate the fee
paid by a transaction if we don't have the raw data. For such rows
that contain only transaction metadata, the fee information will be
added at the same time the raw transaction data is added.
2022-09-10 17:02:43 -06:00
Kris Nuttycombe 7934e834d3 Add test for fee calculation in add_transaction_views migration. 2022-09-10 11:01:36 -06:00
Kris Nuttycombe b327bf7073 Move WalletMigrationAddTxViews to a submodule. 2022-09-10 11:01:36 -06:00
Kris Nuttycombe 7842e6274f Check against the standard empty memo for memo counts. 2022-09-09 16:32:37 -06:00
Kris Nuttycombe 95610f7b4f Add fee to the transactions table & compute correct net_value in v_transactions. 2022-09-09 16:12:29 -06:00
Kris Nuttycombe 66c9f31e14 Add memo counts to transaction views. 2022-09-09 16:09:56 -06:00
Kris Nuttycombe 81c948a37e Add views that join transactions & notes for Android SDK support.
Android does not provide a good way to perform outer joins in
its type-safe query builder API, so we expose views build using
those joins instead.
2022-09-09 16:09:04 -06:00
str4d e656ff5b8e
Merge pull request #610 from zcash/dependabot/github_actions/actions/cache-3.0.8
build(deps): bump actions/cache from 3.0.7 to 3.0.8
2022-09-09 19:23:07 +01:00
Kris Nuttycombe 1839696c75
Merge pull request #623 from zcash/489-addresses-table
`zcash_client_*`: Various changes to how addresses are handled
2022-09-08 18:51:16 -06:00
Jack Grigg 7112ed9da5 zcash_client_backend: Add `WalletReadTransparent::get_transparent_receivers`
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
2022-09-08 20:24:42 +00:00
Jack Grigg 154ef077b4 zcash_client_sqlite: Move address data to an `addresses` table
Closes zcash/librustzcash#489.
2022-09-08 18:50:18 +00:00
Jack Grigg 7d404d2747 zcash_client_sqlite: Fix `WalletRead::get_address` return value
Previously it would return an error if the account identifier did not
correspond to a known account.
2022-09-08 18:49:41 +00:00
Jack Grigg a32714043b zcash_client_backend: Change `WalletRead::get_address` to return UA 2022-09-08 18:49:13 +00:00
Kris Nuttycombe 7455808adc
Merge pull request #625 from nuttycom/wallet/usk_encoding
Add a binary encoding format for unified spending keys.
2022-09-08 12:22:18 -06:00
Kris Nuttycombe 7b7288c750 (cleanup) Make the internals of `zip32::DiversifierKey` private 2022-09-08 11:17:14 -06:00
Kris Nuttycombe 8439f1a4f7 Add binary encoding for unified spending keys.
This encoding is wallet-internal-only and is currently
guarded under the `unstable` feature flag.
2022-09-08 11:05:59 -06:00
Kris Nuttycombe f15a6d8e80 Add `no_std` implementations of Sapling key encoding & decoding. 2022-09-08 11:05:59 -06:00
str4d 980f6b4e6c
Merge pull request #627 from nuttycom/edition_2021
Update to Rust 2021
2022-09-07 11:41:44 +01:00
Kris Nuttycombe d7e2e2f7c1 Remove use of `IntoIterator::into_iter` 2022-09-02 12:05:15 -06:00
Kris Nuttycombe a93f5945ab Remove redundant TryFrom/TryInto imports. 2022-09-02 12:05:15 -06:00
Kris Nuttycombe 16a0e43f2d Update to Rust 2021 and explicitly set MSRVs 2022-09-02 12:05:09 -06:00
Kris Nuttycombe 0b8a0a894b
Merge pull request #626 from zcash/make-nk-internals-public
zcash_primitives: Make `NullifierDerivingKey` internals public
2022-09-01 20:16:44 -06:00
Jack Grigg e5dad037e9 zcash_primitives: Make `NullifierDerivingKey` internals public
The `zcashd` Rust code relies on being able to construct the Sapling
types transparently. This part of the "public API" of the crate was
broken when the `NullifierDerivingKey` newtype was introduced. We do
want to migrate to all of these types having stronger type safety
guarantees (by only constructing them via constructors), but that should
be done consistently across the types. For now we maintain the existing
API by changing `NullifierDerivingKey` to be a transparent newtype.
2022-09-02 01:13:20 +00:00
Kris Nuttycombe 6318edbfe0
Merge pull request #624 from nuttycom/diversifier_index_from_uints
Add conversions from u32 and u64 to DiversifierIndex
2022-08-31 17:54:14 -06:00
Kris Nuttycombe f5a18b8fa5 Add conversions from u32 and u64 to DiversifierIndex 2022-08-31 17:15:47 -06:00
Kris Nuttycombe 13269c9dcd
Merge pull request #621 from zcash/sqlite-remove-tx
zcash_client_backend: Add `WalletWrite::remove_unmined_tx` method
2022-08-31 07:31:38 -06:00
Jack Grigg 4f5d757883 zcash_client_backend: Change to `WalletWrite::remove_unmined_tx`
This fixes a bug in the logic ported from the Android SDK: it was
possible to remove a transaction in the middle of a chain, which would
cause a long-spent note to become unspent and cause the wallet balance
to be over-counted. We now restrict transaction removal to unmined
transactions, which is sufficient for the Android SDK use cases.
2022-08-30 22:54:58 +00:00
Jack Grigg 586b7e5bb0 zcash_client_backend: Add `WalletWrite::remove_tx` method
This is to replace the database mutations in the Android SDK. It is
placed behind an `unstable` feature flag until we are satisfied that it
is suitable as a general-purpose API (or replace it).
2022-08-29 21:32:18 +00:00
str4d b4fc235a2c
Merge pull request #619 from zcash/sqlite-prepared-statement-type-safety
`zcash_client_sqlite`: Improve type safety for prepared statements
2022-08-29 20:57:19 +01:00
Jack Grigg 04b1d505b2 zcash_client_sqlite: Move `DataConnStmtCache` into submodule
This removes direct access to the prepared statements, instead forcing
callers to use the type-safe methods added in the previous commit.
2022-08-29 19:25:36 +00:00
Jack Grigg 12e8c53310 zcash_client_sqlite: Add statement helper methods to `DataConnStmtCache`
These methods provide type-safe ways to interact with the prepared
statements.
2022-08-29 19:25:36 +00:00
Jack Grigg 439e8f2599 zcash_client_sqlite: Add `DataConnStmtCache::new` constructor
This is a move-only commit (other than the necessary variable renames).
2022-08-29 15:26:08 +00:00
Kris Nuttycombe 8c00ca3b88
Merge pull request #615 from nuttycom/wallet/shield_to_ufvk
Shield funds to the internal Sapling key for a specified account.
2022-08-26 16:45:15 -06:00
Kris Nuttycombe ba1bb65a5f Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2022-08-26 16:09:05 -06:00
Kris Nuttycombe c4da498cf4 Shield funds to the internal Sapling key for a specified account.
This updates `shield_transparent_funds` to look up the internal
(change) address for the account specified, and use that as the
destination for shielding transparent funds.

Fixed #614
2022-08-26 16:03:25 -06:00