Commit Graph

940 Commits

Author SHA1 Message Date
Kris Nuttycombe 9716617b55 Apply suggestions from code review
Co-authored-by: Jack Grigg <thestr4d@gmail.com>
Co-authored-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-24 14:50:29 -06:00
Kris Nuttycombe 10258b8443 zcash_client_sqlite: Address comments from code review. 2024-06-21 19:13:18 -06:00
Kris Nuttycombe 72d8df8e68 zcash_client_sqlite: Align handling of transparent UTXOs with that of shielded notes.
Co-authored-by: Daira-Emma Hopwood <daira@jacaranda.org>
Co-authored-by: Jack Grigg <jack@electriccoin.co>
2024-06-21 19:13:18 -06:00
Kris Nuttycombe d92bf27bfc zcash_client_sqlite: Move transparent-inputs wallet methods into the `wallet::transparent` module. 2024-06-21 19:13:17 -06:00
str4d 5e4c4a03e5
Merge pull request #1433 from nuttycom/fix_migration_pragmas
zcash_client_sqlite: Fix handling of PRAGMA directives.
2024-06-20 00:56:02 +01:00
Kris Nuttycombe 1110f5d8fb
Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2024-06-19 16:50:20 -06:00
Kris Nuttycombe a452cf9669 zcash_client_sqlite: Fix handling of PRAGMA directives.
The `foreign_keys` pragma has no effect when used within a transaction,
so it should only be set at the top level. The `legacy_alter_table`
pragma should only be used in cases where its effect is explicitly
intended.
2024-06-19 15:16:18 -06:00
Daira-Emma Hopwood f0cf40543a Update tests in testing/pool.rs to use ZIP 317 fees.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-19 16:38:12 +01:00
Daira-Emma Hopwood 21d573122c `zcash_client_backend::{fixed,standard,zip317}::SingleOutputChangeStrategy`
now implement a different strategy for choosing whether there will be any
change, and its value. The aims are:

* Ensure that it is possible to create fully transparent transactions with
  no change (this will be needed for ZIP 320). The `InsufficientFunds`
  error in this case should have a `required` field that reflects the
  additional amount needed, according to the fee calculated without an
  extra change output.
* Avoid leaking information about note amounts in some cases: an adversary
  that knew the number of external recipients and the sum of their outputs
  was able to learn the sum of the inputs if no change output was present.
* Defend against losing money by using `DustAction::AddDustToFee` with a
  too-high dust threshold.
* Ensure that if a "change memo" is requested, there will always be a
  shielded change output in which to put it. Previously, this would not
  be the case when using `DustAction::AddDustToFee`.

Co-authored-by: Jack Grigg <jack@electriccoin.co>
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-19 13:12:17 +01:00
Daira-Emma Hopwood dcf0187e52 Fix a typo in an error message.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-18 21:24:33 +01:00
Daira-Emma Hopwood 41c30ef44d "child index" -> "address index" where applicable.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-18 21:24:33 +01:00
Daira-Emma Hopwood 9881e811ea Miscellaneous documentation improvements.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-18 21:24:33 +01:00
Daira-Emma Hopwood 6d35583a4b Add `OutPoint::fake()` helper.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-18 21:03:22 +01:00
Daira-Emma Hopwood 2337f79484 Add `zcash_keys::Address::Tex`.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-18 21:03:22 +01:00
Daira-Emma Hopwood 6c90219817 Prefer the `PoolType::{SAPLING, ORCHARD, TRANSPARENT}` constants to
`PoolType::{Shielded(_), Transparent}`.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-18 21:03:22 +01:00
Daira-Emma Hopwood 3582f84686 Allow `ChangeValue::output_pool` to reference the transparent pool by
changing its type from `ShieldedProtocol` to `PoolType`.

Also fix compilation errors when the "orchard" feature is used without
the "transparent-inputs" feature.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-18 21:03:22 +01:00
Jack Grigg cf1922cdee zcash_client_sqlite: Move pinned views to `wallet::db` module 2024-06-18 19:21:03 +00:00
Jack Grigg 39bf4caa20 zcash_client_sqlite: Initial pass at documenting table structures
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
2024-06-18 16:48:05 +00:00
Jack Grigg 3599c6afe7 zcash_client_sqlite: Move pinned indices to `wallet::db` module 2024-06-18 14:24:33 +00:00
Jack Grigg 9c98a649ee zcash_client_sqlite: Move pinned table structures to `wallet::db` module 2024-06-18 14:24:33 +00:00
Kris Nuttycombe 87e23081d0
Merge pull request #1421 from zcash/dep-bip32
Migrate from `hdwallet` to `bip32`
2024-06-17 17:04:14 -06:00
str4d 03fc64cfd0
Merge pull request #1396 from nuttycom/test/block_spanning_shards
`zcash_client_sqlite` Fix error related to commitment tree frontier insertions.
2024-06-17 19:29:44 +01:00
Kris Nuttycombe 3e090dca66 Apply suggestions from code review
Co-authored-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-17 11:40:47 -06:00
Jack Grigg f54ee4abde Migrate from `hdwallet` to `bip32`
As part of this, we migrate to `secp256k1 0.27`. This version does not
bump `secp256k1-sys`, so remains compatible with the `libsecp256k1`
revision used in `zcashd`.

The `zcash_primitives::legacy::keys::AccountPrivKey` encoding also
changes to preserve the transparent extended key metadata. Previously
the type was documented as such, but only encoded the private key and
chain code; the new encoding now matches the documentation. As a side
effect, the unstable encoding of `zcash_keys::keys::UnifiedSpendingKey`
also changes.

Closes zcash/librustzcash#1407.
Closes zcash/librustzcash#1408.
2024-06-15 00:04:37 +00:00
Kris Nuttycombe 3bc74b254b zcash_client_sqlite: Improve documentation for test setup functions. 2024-06-13 18:43:55 -06:00
Kris Nuttycombe e3956c3251 zcash_client_sqlite: Fix clippy complaint. 2024-06-13 18:09:52 -06:00
Kris Nuttycombe ecea9ca196 zcash_client_sqlite: Fix shardtree error caused by pruning after frontier insertion.
Fixes #1398
2024-06-13 18:09:46 -06:00
Kris Nuttycombe de66c5b154 zcash_client_sqlite: Add test to reproduce incomplete penultimate subtree error. 2024-06-13 18:09:39 -06:00
Kris Nuttycombe 3db515e347 zcash_client_sqlite: Allow multi-output fake blocks to send to multiple keys. 2024-06-12 16:36:20 -06:00
Kris Nuttycombe c88cd17929 zcash_client_sqlite: Add multiple output capability to fake compact block construction.
Many important test scenarios for note commitment tree structure require
the use of blocks that contain multiple notes.
2024-06-12 16:34:37 -06:00
Daira-Emma Hopwood db7ae25d7e Allow compiling with "orchard" and without "transparent-inputs".
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-12 14:51:29 +01:00
Daira-Emma Hopwood 4cd96f30a1 Fix clippy lints exposed by the MSRV bump to 1.70.0.
Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-06-12 14:51:29 +01:00
Jack Grigg bffe6a4a10 Bump MSRV to 1.70 2024-06-12 10:58:17 +00:00
Daira-Emma Hopwood aa77be8830 Update dependencies (including to avoid a vulnerability warning for atty), bump MSRV to 1.66,
and fix new clippy lints for MSRV 1.66.

* tonic 0.10 -> 0.11
* tonic-build 0.10 -> 0.11
* cargo update
* cargo update -p home@0.5.9 --precise 0.5.5
* cargo update -p prost-build@0.12.4 --precise 0.12.3
* cargo update -p prost-types@0.12.4 --precise 0.12.3
* cargo update -p prost@0.12.4 --precise 0.12.3
* cargo update -p prost-derive@0.12.5 --precise 0.12.3
* cargo update -p half@2.4.1 --precise 2.2.1

(The precise updates avoid a further MSRV bump to 1.70.)

Remaining duplicates are currently unavoidable.

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
2024-05-20 13:35:27 +01:00
str4d 5c6a6a4c86
Merge pull request #1143 from nuttycom/crate_zip321
Extract `zip321` crate from `zcash_client_backend`
2024-04-22 22:46:09 +01:00
Kris Nuttycombe d2aa6cfc7f Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2024-04-22 14:41:50 -06:00
Kris Nuttycombe aeac544aed Address comments from code review. 2024-04-22 10:55:25 -06:00
Kris Nuttycombe a7de8a3dba Release zcash_client_sqlite version 0.10.3 2024-04-08 13:24:42 -06:00
Kris Nuttycombe f7c29f0111 zcash_client_sqlite: Fix the broken `account_birthday` query. 2024-04-05 18:21:11 -06:00
Kris Nuttycombe 20e8bca8d9 zcash_client_sqlite: Add a test demonstrating the broken `account_birthday` query. 2024-04-05 16:56:54 -06:00
Kris Nuttycombe b60600a4c3 zcash_client_sqlite: Use `ZcashAddress` for persistence of sent note addresses
Prior to this change, the recipient of a sent transaction would always
be shown as the protocol-level address, instead of any unified address
intended as the recipient. Now, instead of reencoding the recipient
address, we use the original `ZcashAddress` value from the payment
request.
2024-04-05 16:48:13 -06:00
Kris Nuttycombe 86e1181259 zip321: Make `Payment` fields private. 2024-04-05 16:30:31 -06:00
Kris Nuttycombe 3ea7d84183 zcash_client_backend: Update to use extracted `zip321` crate 2024-04-05 16:25:21 -06:00
str4d 023e3cad4c
Merge pull request #1337 from nuttycom/fix_suspicious_account_query
zcash_client_sqlite: Fix sloppy named-parameter reference.
2024-04-01 21:48:09 +01:00
Kris Nuttycombe bdd0990db2 zcash_client_sqlite: Use named column accessors for `to_spendable_note` 2024-04-01 13:49:40 -06:00
Kris Nuttycombe 9bd97814db zcash_client_sqlite: Use named column references in `to_unspent_transparent_output` 2024-04-01 12:19:54 -06:00
Kris Nuttycombe e618d80cde zcash_client_sqlite: Fix sloppy named-parameter reference. 2024-04-01 12:19:49 -06:00
Kris Nuttycombe 55895b85b5 zcash_client_sqlite: Add a test for multiple-account retrieval. 2024-04-01 12:19:48 -06:00
Kris Nuttycombe c34b68204d zcash_client_sqlite: Add a migration to ensure that default addresses have an Orchard receiver. 2024-03-29 11:53:28 -06:00
Kris Nuttycombe a58355f697 zcash_client_backend: Add a failing test for note selection error. 2024-03-27 14:58:12 -06:00