Commit Graph

16044 Commits

Author SHA1 Message Date
Jack Grigg d49c8a2865 Add Orchard to change address generation 2022-03-15 16:41:09 +00:00
Jack Grigg d4eee99060 Add Orchard cases to note selection logic 2022-03-15 16:41:09 +00:00
Jack Grigg f2ae807891 Implement opportunistic shielding in `SpendableInputs::LimitToAmount`
We now use the total funds in each available pool to figure out whether
a particular desired selection order can provide the requested amount,
and can alter the selection order each time we add another pool.
2022-03-15 16:41:09 +00:00
Jack Grigg 920de99c85 Select spendable inputs based on recipient and change pool types
This information enables us to select notes and coins in a way that
minimizes information leakage while moving funds into the shielded pool
where possible.
2022-03-15 16:41:09 +00:00
Jack Grigg 959b068468 Fix bug in `SpendableInputs::LimitToAmount`
This method selects inputs by iterating through available notes and
coins until sufficient value is found, and then dropping the remaining
notes and coins. However, the processing of each pool type was gated on
having not selected sufficient funds. This meant that if an earlier pool
had sufficient funds to fill a transaction, later pools would not be
processed at all and their notes would be left as selectable.
2022-03-15 16:41:09 +00:00
Jack Grigg 63437e4c18 Add unit tests for `SpendableInputs::LimitToAmount` 2022-03-15 16:41:09 +00:00
Jack Grigg f56a04ded2 Refactor `CWallet::GenerateChangeAddressForAccount`
There are no functional changes in this commit, but the refactor
separates the legacy account handling, and makes it easier to integrate
new pool types.

We also rename `libzcash::ChangeType` to `OutputPool`, in anticipation
of using it to track transaction recipient pools.
2022-03-15 16:41:09 +00:00
Kris Nuttycombe c3c5236cee
Merge pull request #5656 from nuttycom/feature/wallet_orchard-note_commitment_tree_ser
Add Orchard note commitment tree serialization & restore.
2022-03-14 23:16:44 -06:00
sasha 3a957618b6
Merge pull request #5662 from nuttycom/legacy_seed_to_mnemonic
Derive the mnemonic seed from the legacy HD seed, if one is available.
2022-03-14 20:32:09 -07:00
sasha 7071b41c55
Merge pull request #5578 from superbaud/powlimit-document
comment explaining the 0x0f0f[..]0f0f powLimit constant for regtest
2022-03-14 18:47:04 -07:00
Kris Nuttycombe 5a98080677 Apply suggestions from code review
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-03-14 19:13:25 -06:00
sasha f37d186e7e
Merge pull request #5600 from superbaud/use-debian-libtinfo
remove superfluous space at end of native_packages that i introduced in #5576
2022-03-14 17:06:53 -07:00
ying tong 4d7892bdde
Merge pull request #5649 from therealyingtong/conflicted-orchard-spends
Report conflicted Orchard spends
2022-03-15 07:46:02 +08:00
Kris Nuttycombe e335ff2325 Fix indentation. 2022-03-14 17:40:10 -06:00
Kris Nuttycombe d420e2efab Derive the new mnemonic seed from the legacy HD seed, if one is available.
Fixes #5572

Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-03-14 17:40:04 -06:00
Daira Hopwood 4611493c9d
Merge pull request #5663 from nuttycom/check_master_key_validity
Return std::optional<CExtKey> from CExtKey::Master
2022-03-14 17:10:24 +00:00
Daira Hopwood 340840894a Tweaks to message text.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-14 08:24:25 +00:00
Daira Hopwood 6ee6692c83 qa/zcash/full_test_suite.py: enable `test_rpath_runpath` for Rust binaries, and
reenable `test_fortify_source` for C++ binaries.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-14 08:05:59 +00:00
Daira Hopwood 1d31d4bc7c Include $(bin_SCRIPTS) in `check-symbols`, `check-security`, and `clean` targets.
Checking for stack canaries in `check-security` is disabled for Rust executables
(Rust does support `-Z stack-protector=all` but only for the nightly compiler).

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-13 22:53:29 +00:00
Daira Hopwood 55d14faebf Correct the fallback instruction for how to clear the terminal on macOS: pressing Command + K
also clears scrollback.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-13 18:25:40 +00:00
Kris Nuttycombe 19bce27321
Merge pull request #5641 from nuttycom/feature/wallet_orchard-restore_orchard_spends
Restore Orchard spentness cache in LoadCaches
2022-03-12 14:21:38 -07:00
Kris Nuttycombe c9938d0348
Update orchard_wallet_add_notes_from_bundle documentation. 2022-03-12 11:46:48 -07:00
Daira Hopwood ccada66324 Simplify debug tracing.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-12 12:56:32 +00:00
Kris Nuttycombe 4eda33f184 Serialize the Orchard note commitment tree to the wallet.
This adds serialization of Orchard note commitment trees
to `SetBestChain` and deserialization and loading of those
trees to wallet load.
2022-03-11 22:47:37 -07:00
Kris Nuttycombe 30dd633de6 Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2022-03-11 22:39:06 -07:00
Kris Nuttycombe 5d17e53c5c Address suggestions from code review on #5637 2022-03-11 22:39:06 -07:00
Kris Nuttycombe f5b23b3336 Modify `join_network` in tests to skip mempool resync.
Prior to this change, calling `join_network` after a network split
only worked in the case that no new non-coinbase transactions were
created during the network partition; in the case that such a
transaction was created, `join_network` would fail when waiting
for mempool synchronization, because zcashd nodes do not.
automatically broadcast their mempool contents on restart.

This change modifies `setup_network` to wait for mempool synchronization
or not on the basis of a newly added do_mempool_sync flag. In the
case of `join_network`, this flag is set to `False`; the default value
is set to `True` to preserve previous functionality elsewhere.

Tests should explicitly use the `resendwallettransactions` RPC method
to ensure that mempool transactions are rebroadcast before attempting
to synchronize the network after a `join_network` call.
2022-03-11 22:39:06 -07:00
Kris Nuttycombe 1e1521f101 Ensure that Orchard spentness information is repopulated by LoadUnifiedCaches. 2022-03-11 22:39:06 -07:00
str4d 0f59c5b926
Merge pull request #5658 from str4d/5570-tx-builder-orchard-spends
Add Orchard sender support to the transaction builder
2022-03-12 04:33:06 +00:00
therealyingtong 3c0e1d9aa8 CWallet::GetConflictS: Handle conflicting Orchard spends.
Co-authored by: Kris Nuttycombe <kris@nutty.land>
2022-03-11 19:30:52 -07:00
Kris Nuttycombe 0c38ad9200 Return std::optional<CExtKey> from CExtKey::Master
Master key generation is fallible, but the type of master
key generation did not previously reflect that the generated
key might be invalid.
2022-03-11 18:47:01 -07:00
Jack Grigg 93797d185b Improve FFI interface documentation
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-03-12 01:33:39 +00:00
Daira Hopwood 577f695af5 Set `meta` for `-datadir` option.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-11 19:02:31 +00:00
Daira Hopwood 3e36252d9a Document that '~' cannot be used in `-datadir` (see #5661).
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-11 18:35:52 +00:00
Daira Hopwood d5b6e226f0 Ensure the buffer used in `prompt` is zeroized even on error.
Co-authored-by: Jack Grigg <str4d@electriccoin.co>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-11 18:21:11 +00:00
Daira Hopwood 7a98644ff2 Improve error message when the config file cannot be found, taking into account -conf and -datadir.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-11 18:16:40 +00:00
Daira Hopwood cb2c89eedf Use the tracing crate for debugging.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-11 17:17:56 +00:00
Jack Grigg 7921ef1c55 wallet: Alter `OrchardWallet::GetSpendInfo` to return the spending key
In the context of `z_sendmany`, we will need both the spending key and
note spendInfo as a pair, so it makes sense to fetch those together.
2022-03-11 03:31:00 +00:00
Jack Grigg 6a7213b5d5 Add Orchard spend support to the transaction builder
Closes zcash/zcash#5570.
2022-03-11 03:30:55 +00:00
str4d 8964763bef
Merge pull request #5653 from nuttycom/feature/wallet_orchard-merge_master
Merge master branch back to `feature/wallet_orchard`
2022-03-11 03:19:18 +00:00
Daira Hopwood f6a8461047
Merge pull request #5636 from superbaud/lazy-load-parameters
only load the proof parameters in gtests for tests that need them
2022-03-10 18:11:09 +00:00
Daira Hopwood 799b46b90a Cleanups to error handling for the first invocation of zcash-cli.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-10 17:18:26 +00:00
Daira Hopwood 999b395360 Improve memory hygiene, and use -stdin to pass the recovery phrase to the child zcash-cli process.
Co-authored-by: Jack Grigg <str4d@electriccoin.co>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-10 17:17:06 +00:00
Kris Nuttycombe 880cbe0dc4
Merge pull request #5647 from therealyingtong/orchard-nullifier-test
Update `coins_tests.cpp` to test Orchard cases.
2022-03-10 06:59:19 -07:00
Kris Nuttycombe 8bf99eaacc Merge remote-tracking branch 'upstream/master' into feature/wallet_orchard-merge_master 2022-03-09 22:17:49 -07:00
Kris Nuttycombe b21ca34d44
Merge pull request #5637 from nuttycom/feature/wallet_orchard-persist_action_ivks
Implement Orchard note persistence & restore.
2022-03-09 22:13:26 -07:00
Kris Nuttycombe f057ebb375 Apply suggestions from code review 2022-03-09 17:48:27 -07:00
Kris Nuttycombe e63d52896a Restore mined block heights when restoring decrypted notes. 2022-03-09 17:48:27 -07:00
Kris Nuttycombe ca34a97a37 Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2022-03-09 13:26:10 -07:00
Daira Hopwood d4405feddf Simplify extraction of recovery phrase.
Co-authored-by: Jack Grigg <str4d@electriccoin.co>
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-09 18:04:27 +00:00