Commit Graph

16333 Commits

Author SHA1 Message Date
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
Sean Bowe 9bee74e370 Revert "AddBogusOrchardSpends"
This reverts commit d33b0dd0105e66a4788f595412f1289632a6ba5d.
2022-03-28 19:45:25 -06:00
Sean Bowe 652a0df78d Hardcode transaction data for DuplicateOrchardNullifier test. 2022-03-28 19:45:25 -06:00
Sean Bowe 90b07d65be Add test that checks if a bundle containing duplicate Orchard nullifiers is rejected. 2022-03-28 19:45:25 -06:00
Sean Bowe dcc47bd882 AddBogusOrchardSpends 2022-03-28 19:45:25 -06:00
Kris Nuttycombe d4b2ec6359
Merge pull request #5762 from str4d/fix-orchard-conflicts-test
test: Fix `WalletTests.GetConflictedOrchardNotes` gtest
2022-03-28 19:39:44 -06:00
Jack Grigg 1e9bdcd0a2 test: Fix `WalletTests.GetConflictedOrchardNotes` gtest
The test was creating a fake shielding transaction, but by using a
single null `COutPoint` it was accidentally trying to create a coinbase
transaction, which was then rejected by the consistency checks on the
Rust side (which require that no inputs be provided for a coinbase
transaction, which by definition has no real inputs).
2022-03-29 00:26:22 +00:00
Jack Grigg ba7d3c41bf rust: Improve `PrecomputedTransactionData` construction errors
We now log separate errors for "provided inputs when signing a coinbase
transaction" and "provided the wrong number of inputs to a transaction".
2022-03-29 00:26:22 +00:00
Jack Grigg 7892888379 test: Improve gtest handling of `TransactionBuilderResult::GetTxOrThrow`
We can't directly use `EXPECT_NO_THROW` on a function that returns a
result; instead we manually call `GTEST_FAIL` if the builder result is
an error.
2022-03-29 00:26:22 +00:00
Jack Grigg 52e039ebd8 builder: Handle `std::ios_base::failure` exceptions during sighash
These can occur if e.g. `PrecomputedTransactionData` encounters an error
during parsing of its inputs on the Rust side.
2022-03-29 00:26:22 +00:00
Jack Grigg 8b68d73802 test: Print all logged errors to stdout during gtests
This makes it easier to figure out test failures caused by errors on the
Rust side, for which we generally log the error and then return a simple
failure condition (`false` or `nullptr`) which obscures the error on the
C++ side.

We add similar logic to the Boost test framework, but commented out by
default because it results in very verbose test output.
2022-03-29 00:26:22 +00:00
Kris Nuttycombe 0daa540128 Merge remote-tracking branch 'upstream/master' into nu5-consensus 2022-03-28 10:13:51 -06:00
Charlie O'Keefe ddcfc1c5b7
Merge pull request #5757 from nuttycom/fix/ua_error_improvement
Improve error message for when a UA is only usable after a future NU.
2022-03-27 10:56:15 -06:00
Kris Nuttycombe 021a8d1b4b Improve error message for when a UA is only usable after a future NU.
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-03-27 09:26:36 -06:00
Daira Hopwood dfea6c69d2 Repair `feature_zip239` RPC test by checking the debug log of node 0 rather than its stderr.
Since we no longer redirect stderr, this will correctly fail if stderr has unexpected output.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-27 08:37:03 +01:00
Daira Hopwood 65d96aaa10 Switch Jack Grigg's copyright on src/rust/{include/tracing.h, src/tracing_ffi.rs} to the
Zcash developers (with his permission).

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-26 18:56:34 +00:00
Daira Hopwood ac25936d0e contrib/debian/copyright: add license for Apache-2.0.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-26 18:48:31 +00:00
Daira Hopwood 21e5fa90af contrib/debian/copyright: add licenses of Rust dependencies that do not have Expat/MIT as an option.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2022-03-26 18:45:57 +00:00