Commit Graph

2446 Commits

Author SHA1 Message Date
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
Kris Nuttycombe f800f9f144
Merge pull request #613 from zcash/add-orchard-to-usk
zcash_client_backend: Generate Orchard component for USKs
2022-08-24 11:26:08 -06:00
Jack Grigg b42344d491 zcash_client_backend: Generate Orchard component for USKs
This ensures that the resulting UFVKs and UAs also contain Orchard
components.
2022-08-24 14:56:58 +00:00
Kris Nuttycombe 5dceb93ec8
Merge pull request #612 from nuttycom/wallet/set_fixed_user_version
Set a fixed `user_version` value for the sqlite schema in the initial migration.
2022-08-23 14:29:46 -06:00
Kris Nuttycombe a643fd5ea0
Merge pull request #611 from nuttycom/wallet/test_dump_schema
Add a test to check the result of database migrations against an expected schema.
2022-08-23 14:29:08 -06:00
Kris Nuttycombe 83c47b1a42 Set a fixed `user_version` value for the sqlite schema in the initial migration. 2022-08-23 12:23:47 -06:00
Kris Nuttycombe 6b73443f53 Add a test to check the result of database migrations against an expected schema. 2022-08-23 12:16:19 -06:00
dependabot[bot] d784c7b1ec
build(deps): bump actions/cache from 3.0.7 to 3.0.8
Bumps [actions/cache](https://github.com/actions/cache) from 3.0.7 to 3.0.8.
- [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.7...v3.0.8)

---
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-08-23 05:15:52 +00:00
str4d ca84123038
Merge pull request #609 from nuttycom/wallet/update_schemer
Update to schemer 0.2
2022-08-19 17:47:50 +01:00
str4d 58f34426d4
Merge pull request #608 from nuttycom/wallet/batch_trial_decryption
Implement parallel, batched trial decryption in wallet scanning.
2022-08-19 17:43:35 +01:00
Kris Nuttycombe 5d817f6120 Update to schemer 0.2 2022-08-19 09:55:55 -06:00
Kris Nuttycombe 397c76ca8d Add tests for batched note decryption. 2022-08-18 16:48:52 -06:00
Kris Nuttycombe 6156215d4c Add parallelized batched trial decryption to wallet scanning.
Co-authored-by: str4d <jack@electriccoin.co>
2022-08-18 16:48:22 -06:00
Kris Nuttycombe 7acd47eae8 Copy parallel batch decryption data types from zcash/zcash
This is an unmodified copy of 7d1e14ac3d/src/rust/src/wallet_scanner.rs

Co-authored-by: str4d <jack@electriccoin.co>
2022-08-18 16:40:27 -06:00
str4d d85f94c4d3
Merge pull request #602 from zcash/dependabot/github_actions/actions/cache-3.0.7
build(deps): bump actions/cache from 3.0.5 to 3.0.7
2022-08-18 23:32:37 +01:00
str4d 85a1522c22
Merge pull request #607 from adityapk00/oa
Return orchard address from UA
2022-08-18 23:32:19 +01:00
str4d 59d361f494
Merge pull request #600 from nuttycom/wallet/migrations
Add database migrations to zcash_client_sqlite.
2022-08-18 23:31:16 +01:00
Kris Nuttycombe 913d572087 Allow the seed to be an optional argument to database init.
This adds a new `WalletMigrationError` type so that we have
a good place to report whether or not the seed is required.
2022-08-18 16:03:20 -06:00
Kris Nuttycombe 61fb732e7b Ensure that we detect the correct pool type for sent notes. 2022-08-18 10:15:58 -06:00
Kris Nuttycombe e0c919cc68 Apply suggestions from code review
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-08-18 10:15:58 -06:00
Kris Nuttycombe 880076b38f Improve error reporting for address & viewing key decoding. 2022-08-18 10:15:58 -06:00
Kris Nuttycombe 4930982d7e Test migrations against possibly-previously-existing database states.
This adds tests that verifies that migrations can run successfully
against databases in the following states:
* created by release version 0.3.0
* created by the `autoshielding_poc` branch
* created by current `main` prior to addition of migrations
2022-08-18 10:15:58 -06:00
Kris Nuttycombe e9db8d5b01 Use `secrecy` when handling seed phrases in migrations code. 2022-08-18 10:15:58 -06:00
Kris Nuttycombe cdfaa57496 Add migrations to support using UFVKs instead of Sapling extfvks.
Fixes #594
2022-08-18 10:15:58 -06:00
Kris Nuttycombe 7c5b320108 Introduce wallet database schema migrations.
This replaces the current wallet initialization code with a migration
that brings the database up to the state produced by release 0.3.0.
A subsequent commit will add migrations that correctly produce the
database state as of zcash/librustzcash@602270cb1f.

Fixes #369
2022-08-18 10:15:58 -06:00
Aditya Kulkarni 1fad73d5b3 Return orchard address from UA 2022-08-17 08:10:06 -05:00
dependabot[bot] 61e6376c76
build(deps): bump actions/cache from 3.0.5 to 3.0.7
Bumps [actions/cache](https://github.com/actions/cache) from 3.0.5 to 3.0.7.
- [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.5...v3.0.7)

---
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-08-12 05:15:06 +00:00
teor 276bcc34f5
Download sprout parameters in zcash_proofs (#459)
* Download sprout parameters in-memory
* Add download_sapling_parameters and deprecate download_parameters
  * This avoids confusion between sprout and sapling downloads,
    while maintaining backward compatibility.
* Download a single file, rather than parts
  * This is more efficient, because TCP adjusts its transfer speed
    in the first ~20 seconds of each new connection.
* Only download files if needed, but always check the hashes
* Allow the caller to specify a response timeout
* Stream downloads from server to disk
* Refactor file loads to use the same verifying function as downloads
* Check file sizes to help debug parameter load failures
* Remove downloaded files on error (but leave existing files alone)
* Add a sprout and sapling download example
* Move the download Read impl into its own module
* Derive standard traits on SaplingParameterPaths
* Require features for the load parameters method
2022-08-04 10:19:56 -06:00
Kris Nuttycombe 602270cb1f
Merge pull request #597 from nuttycom/cleanup/fix_doc_link_deny
Use the new name rustdoc::broken_intra_doc_links
2022-08-01 07:49:46 -06:00
Kris Nuttycombe 199c49760b Use the new name rustdoc::broken_intra_doc_links 2022-07-29 15:56:44 -06:00
Kris Nuttycombe 6cf088004f
Merge pull request #589 from nuttycom/wallet_scan_batch_decrypt
Use batch decryption for wallet scanning
2022-07-28 17:55:01 -06:00
str4d 753bb8ea18
Merge pull request #587 from zcash/dependabot/github_actions/actions/cache-3.0.5
build(deps): bump actions/cache from 3.0.4 to 3.0.5
2022-07-29 00:42:56 +01:00