Commit Graph

16750 Commits

Author SHA1 Message Date
sasha 3cf2ba8853 Fix sporadic failures in StoreAndRetrieveMnemonicSeedInEncryptedStore 2022-04-01 15:34:58 -07:00
Jack Grigg 17d576fef4 wallet: Treat `mnemonichdchain` records as key material
This is a temporary change to ensure that if this record is unreadable,
we immediately shut down the node and don't make any further changes
that could impair our ability to recover from this state later.

Part of zcash/zcash#5806.
2022-04-01 22:16:40 +00:00
Daira Hopwood 0130426dea AcceptToMemoryPool: Remove initial nullifier checks for Sprout and Sapling
(within the mempool only), that are redundant with checks in
HaveShieldedRequirements. The latter take into account nullifiers in the
chain (using CCoinsViewMemPool::GetNullifier) and include Orchard.

There is no meaningful DoS-protection motivation for the checks being
removed here, nor do they simplify reasoning about the code (if anything
the redundancy makes it more confusing).

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-04-01 23:16:11 +01:00
sasha d711a7c529 Fix test_wallet_zkeys failures by increasing diversifier search offset
1 chance in 2^-128 is unobservable, whereas 1 chance in 1024 happens
often.
2022-04-01 14:50:05 -07:00
Daira Hopwood 8e15446c17
Merge pull request #5802 from nuttycom/bug/z_listaddress_internal
Do not display internal addresses in z_listaddresses.
2022-04-01 22:47:09 +01:00
Kris Nuttycombe 5e4eb72a9b Do not display internal addresses in z_listaddresses.
Fixes #5800
2022-04-01 12:53:59 -06:00
Kris Nuttycombe 0a0ac9989e Add a test demonstrating that z_listaddresses reveals internal addrs. 2022-04-01 12:46:55 -06:00
Daira Hopwood f9a703ed51 This check done for Sprout and Sapling (which is separate from consensus nullifier checks)
was not being done for Orchard.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-04-01 19:42:30 +01:00
Kris Nuttycombe 0a5dbc10d4 Add account ID to z_listunspent results.
Fixes #5795
2022-04-01 10:02:13 -06:00
Kris Nuttycombe f7b11f6da1
Merge pull request #5775 from nuttycom/feature/orchard_list_unspent
Add Orchard support to z_listunspent.
2022-04-01 07:39:25 -06:00
str4d 445e853a60
Merge pull request #5790 from nuttycom/nu5-consensus_merge-master
Merge `master` to the nu5-consensus branch.
2022-04-01 12:08:31 +01:00
Jack Grigg e5756cc198 qa: Add test for Orchard support in `z_listunspent` 2022-04-01 02:44:56 +00:00
Kris Nuttycombe 866278f79a Merge remote-tracking branch 'upstream/master' into nu5-consensus_merge-master 2022-03-31 20:29:28 -06:00
Kris Nuttycombe 4afec83947
Merge pull request #5782 from nuttycom/cleanup/incrementalmerkletree_positions
Update to the latest incrementalmerkletree.
2022-03-31 12:57:00 -06:00
str4d bd2bc8834f
Merge pull request #5779 from str4d/persist-orchard-note-positions
wallet: Persist Orchard note positions with the witness tree
2022-03-31 19:33:08 +01:00
Kris Nuttycombe a852eb223b Update incrementalmerkletree version to fix GC bug & use updated API.
This also modifies the serialized form of the wallet's incremental
merkle tree. This will require a complete reindex for testnet wallets.
2022-03-31 10:52:48 -06:00
Kris Nuttycombe 824824d6d2 Add Orchard support to z_listunspent.
Also, ensure that Sapling internal addresses are not displayed
in z_listunspent outputs.

Fixes #5683
2022-03-31 10:41:35 -06:00
str4d fbd2912885 Apply suggestions from code review
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
Co-authored-by: Kris Nuttycombe <kris.nuttycombe@gmail.com>
2022-03-31 16:07:05 +00:00
Jack Grigg b121fd94d9 wallet: Persist Orchard tx height alongside note positions
Previously we were reconstructing the height on wallet load by looking
up the `blockHash` field of `CMerkleTx` to find the transaction's height
in the main chain. However, this field is updated whenever `AddToWallet`
is called, while the transaction's height and note positions need to be
kept in sync with `SetBestChain`, which is only called once every 10
minutes. In the case that a reorg occurs between `SetBestChain` and the
node shutting down, the resulting height on wallet load would be
inconsistent. As with note positions, any inconsistency should be
resolved by the post-load wallet rescan, which rewinds the Orchard
witness tree and unsets any position information.

Part of zcash/zcash#5784.
2022-03-31 15:45:56 +00:00
Jack Grigg 2d6cb93125 wallet: Add version information to Orchard commitment tree data
We add both C++ client version information (enabling version-specific
changes if necessary, matching the rest of the C++ wallet), and record
version information (enabling local serialization format changes).

Part of zcash/zcash#5784.
2022-03-31 15:08:09 +00:00
Jack Grigg d651f22e86 wallet: Persist Orchard note positions with the witness tree
We rewrite the entire witness tree each time we update the wallet's best
chain state, and we need the note positions to always be consistent with
the tree state (otherwise mined notes become unspendable after the node
restarts).
2022-03-30 23:23:27 +00:00
Jack Grigg ac3229201f wallet: Move Orchard note position data into a separate map 2022-03-30 23:23:27 +00:00
Jack Grigg 0255964559 qa: Add RPC test testing Orchard note position persistence
The test fails during the final `z_sendmany`, because it is selecting a
note that was detected before restarting the node. Because we force the
wallet to call `SetBestChain` on every block, the wallet doesn't need to
rescan on restart, and thus doesn't repopulate the `position` field of
the in-memory note.

This issue went unnoticed in existing tests that exercise node restarts,
because the RPC tests are fast enough that they never pass the 10-minute
timeout for writing the wallet state. This commit adds a regtest-only
config option that disables the lazy writing.
2022-03-30 23:23:27 +00:00
Kris Nuttycombe a394770ab8
Merge pull request #5772 from therealyingtong/scope-api
Update FFI to use scoped APIs for viewing keys and addresses
2022-03-30 13:04:08 -06:00
Kris Nuttycombe 53cc7ecceb Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2022-03-30 10:10:28 -06:00
therealyingtong bc33ba5a9f Update FFI to use scoped APIs for viewing keys and addresses 2022-03-30 08:30:27 -06:00
Kris Nuttycombe 72b27fb906 Add independent wallet persistence tests.
Co-authored by: @therealyingtong
2022-03-30 08:27:41 -06:00
Daira Hopwood f81364a9ad .gitignore: add files temporarily created by autoconf.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-30 13:46:35 +01:00
Daira Hopwood 560db173bd
Merge pull request #5769 from daira/fix-gtest-define
Fix an incorrect preprocessor symbol
2022-03-29 22:15:52 +01:00
Daira Hopwood a92e249e4b Fix an incorrect preprocessor symbol.
Also repair the lint-includes-guards.sh script that was checking for the incorrect symbol.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-29 20:18:16 +01:00
sasha 9befdb2c45
Merge pull request #5767 from daira/postpone-deps
Postpone native_clang and libcxx 14.0.0; admin merge as requested by @nuttycom
2022-03-29 11:12:02 -07:00
Kris Nuttycombe 72e7d2b83f
Merge pull request #5765 from nuttycom/doc/rpc_release_notes
Update release notes to include all RPC changes since 4.6.0
2022-03-29 11:25:55 -06:00
Daira Hopwood 5abe1b82b4 Postpone native_clang and libcxx 14.0.0.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-29 17:02:47 +01:00
Daira Hopwood c28b004256 qa/zcash/updatecheck.py: print status code and response of failed http requests.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-29 17:02:32 +01:00
Kris Nuttycombe c5c7a73a4c Note that Debian 9 has been removed from the list of supported platforms. 2022-03-29 09:41:03 -06:00
Kris Nuttycombe db315fd693 Update release notes to include all RPC changes since 4.6.0
This also corrects some minor errors in the help text for
a few of the RPC methods.
2022-03-29 09:41:03 -06:00
Marshall Gaucher 0ba5ccaa79
Merge pull request #5746 from defuse/do-not-print-exceptions
Only send exceptions to the log, not stderr
2022-03-29 07:10:10 -07:00
Kris Nuttycombe a574f6042b
Merge pull request #5759 from nuttycom/fix/restore_imported_addrs
Ensure that legacy imported addresses are properly restored to the wallet.
2022-03-29 07:33:36 -06:00
Charlie O'Keefe 30be071d4b
Merge pull request #5754 from daira/autoconf-macro-licensing
Additions and cleanups for contrib/debian/copyright
2022-03-28 21:33:47 -06:00
Kris Nuttycombe a04bf958ee
Merge pull request #5761 from ebfull/duplicate-orchard-nullifier
Check that duplicate Orchard nullifiers within transactions are rejected
2022-03-28 21:27:57 -06:00
Kris Nuttycombe a63a4601ea
Merge pull request #5764 from nuttycom/test/rollback_double_spend
Add an RPC test for Sapling and Orchard double-spends & fix revealed bugs.
2022-03-28 21:25:18 -06:00
Kris Nuttycombe e8f23e3629 Add a test verifying the default addr is added when importing a Sapling key. 2022-03-28 19:47:19 -06:00
Kris Nuttycombe dba00530ee Ensure that legacy imported addresses are properly restored to the wallet.
The filter that restricted the restore of default Sapling addresses to
the wallet, which limited the restoration to those addresses associated
with the legacy key, was too restrictive; it meant that imported
addresses were not restored to the wallet. That check has been inverted,
such that we now restore the default address for any key that is not
associated with the mnemonic seed.
2022-03-28 19:47:19 -06:00
Kris Nuttycombe ad97298637 Apply suggestions from code review
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-03-28 19:46:21 -06:00
Kris Nuttycombe 44eb07a2bb Guard against invalid coercion of int to u32 in FindSpendableInputs 2022-03-28 19:46:21 -06:00
Kris Nuttycombe e07e355e01 Fix overzealous matching of Orchard FVKs to addresses.
It is possible for an address to be generated for a UFVK that
contains an Orchard FVK, but where the address does not contain
an Orchard receiver. Cache restoration was failing on startup
because we failed to allow for this case.
2022-03-28 19:46:21 -06:00
Kris Nuttycombe 0b8ee33bbd Add an RPC test that attempts a double-spend. 2022-03-28 19:46:21 -06:00
Kris Nuttycombe 66756d1a13 Improve error logging in walletdb.cpp 2022-03-28 19:46:21 -06:00
Sean Bowe 0a59f8c789 Rename constant in include file to avoid conflicts with btest 2022-03-28 19:45:25 -06:00
Sean Bowe a6425b46c6 Activate NU5 at start of DuplicateOrchardNullifier test. 2022-03-28 19:45:25 -06:00