Commit Graph

16358 Commits

Author SHA1 Message Date
Kris Nuttycombe f86a65d7cb Make Orchard `finalState` serialization format match Sapling.
For consistency, we serialize the `finalState` field in the
same (sparse) encoding as Sapling and Sprout use. In the future
we may want to update this to the dense encoding that
incrementalmerkletree::bridgetree::Frontier uses, but that's not
necessary for the moment.
2022-04-08 19:48:40 -06:00
Charlie O'Keefe d0a30cd0d2
Merge pull request #5853 from nuttycom/bug/miner_guard_chainactive
Ensure pindexPrev is not null before mining against it.
2022-04-08 18:38:07 -06:00
Marshall Gaucher a660b95032
Merge pull request #5849 from therealyingtong/acct-counter-overflow
Check for overflow in IncrementAccountCounter().
2022-04-08 16:12:29 -07:00
Alfredo Garcia 6e054687c2
fix grammar in message
Co-authored-by: Kris Nuttycombe <kris.nuttycombe@gmail.com>
2022-04-08 19:17:28 -03:00
str4d 06d0f04388
Merge pull request #5793 from str4d/5766-print-test-logs-on-failure
test: Capture gtest log output and only print on error
2022-04-08 23:11:20 +01:00
Kris Nuttycombe b38189adcd
Merge pull request #5791 from therealyingtong/z_listaccounts
Add z_listaccounts API.
2022-04-08 15:30:57 -06:00
Kris Nuttycombe cc8b3f9657 Ensure pindexPrev is not null before mining against it. 2022-04-08 14:54:23 -06:00
Jack Grigg 753412c5b3 test: Capture gtest log output and only print on error
In zcash/zcash#5762 we altered the gtest runner to turn on logging to
stdout instead of dropping the logs, to make figuring out test failures
easier. However, this also meant the logs would be displayed for tests
that succeeded, and it was confusing to see `ERROR` log lines present.

We now have a test-specific initialization method for tracing that uses
synchronous logging instead of a background thread, and only logs to a
file. In the gtests, we initialize this with a new temporary file, and
add a gtest event listener that clears the file at the start of each
test, and then prints its contents if the test fails.

Example test output:

```
[ RUN      ] ChecktransactionTests.CheckVpubNotBothNonzero
gtest/test_checktransaction.cpp:39: Failure
Expected equality of these values:
  state.GetRejectReason()
    Which is: "bad-txns-vpubs-both-nonzero"
  "bad-txns-vpubs-both-nonzer"

--- Logs:
  ERROR main: CheckTransaction(): joinsplit.vpub_new and joinsplit.vpub_old both nonzero
---
[  FAILED  ] ChecktransactionTests.CheckVpubNotBothNonzero (0 ms)
```

Closes zcash/zcash#5766.
2022-04-08 20:57:57 +01:00
Kris Nuttycombe f98b2393a1 Fix error in z_listaccounts help text. 2022-04-08 13:06:41 -06:00
str4d a638e938bd
Merge pull request #5823 from str4d/add-orchard-wallet-tracing
Add trace-level logging to the Orchard wallet
2022-04-08 18:47:06 +01:00
Alfredo Garcia a4f563f2ab change error message 2022-04-08 13:24:11 -03:00
Jack Grigg 70167dd2aa rpc: Document that enabling trace-level logging is unsafe 2022-04-08 15:48:02 +00:00
Jack Grigg a06406d087 wallet: Bump a trace log message to error in `Wallet::checkpoint`
If we hit this error, the node is going to end up with an assertion
failure, so there's no verbosity harm in logging here.
2022-04-08 15:43:44 +00:00
Kris Nuttycombe 1fb153a333 Apply suggestions from code review
Co-authored-by: Jack Grigg <jack@electriccoin.co>
2022-04-08 15:41:34 +00:00
Kris Nuttycombe a4aba7cb91
Merge pull request #5830 from therealyingtong/orchard-z_listreceivedbyaddress
Support Orchard addresses in `z_listreceivedbyaddress`
2022-04-08 07:55:10 -06:00
Kris Nuttycombe c342e7d712
Merge pull request #5847 from nuttycom/bug/wallet_bestchain_init
Fix assertion in wallet initialization when wallet best block is ahead of the main chain.
2022-04-08 07:48:19 -06:00
therealyingtong 0da6bcef72 Check for overflow in IncrementAccountCounter(). 2022-04-08 14:27:51 +08:00
Kris Nuttycombe f553ae3320 Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
Co-authored-by: ying tong <yingtong@z.cash>
2022-04-07 23:05:05 -06:00
str4d 0c32c988fc
Merge pull request #5834 from nuttycom/bug/sendmany_privacy_policy_violations
Fix privacy policy violations when sending between unified addresses.
2022-04-08 04:00:31 +01:00
str4d 5f60f33daf
Merge pull request #5832 from therealyingtong/miner-latest-height
Use height of latest network upgrade in -mineraddress validation.
2022-04-08 03:01:20 +01:00
str4d 175dc4bc4a
Merge pull request #5841 from str4d/lint-cargo-patches
Add lints for Cargo patches
2022-04-08 02:01:02 +01:00
Kris Nuttycombe 773c2b515a Fix assertion in wallet initialization when wallet best block is ahead of the main chain.
In #5809, we attempted to fix the assumption that on startup, the
wallet's best chain was at the same position as the node's chain tip.
This did not account for a condition where the node's block index
might not contain the block corresponding to the wallet's best chain,
because the node had crashed before the block index containing that
block could be written to disk.

This commit adds handling so that the `ThreadNotifyWallets` thread
will not start until the wallet's best block has been restored
to the node's block index and we're able to obtain a pointer to
that state.
2022-04-07 17:23:13 -06:00
Kris Nuttycombe cb64997216 Never consider transactions that pay the default fee to be free. 2022-04-07 13:51:08 -06:00
str4d 2c13a41334
Merge pull request #5844 from str4d/postpone-rust-1.60
qa: Postpone update to Rust 1.60
2022-04-07 17:31:04 +01:00
Jack Grigg c4006a7f24 qa: Postpone update to Rust 1.60
Rust 1.60 migrates to LLVM 14, and we want to keep our Clang and Rust
compilers on matching LLVM versions.
2022-04-07 15:01:26 +00:00
Kris Nuttycombe 369fc78e0b Use DEFAULT_FEE consistently in wallet_unified_change test
This fixes a nondeterministic error where zero-fee transactions
may be excluded due to minimum-block-size rules.
2022-04-07 08:57:48 -06:00
Kris Nuttycombe 14f06f9f06 Return MAX_PRIORITY when transactions contain an Orchard bundle. 2022-04-07 08:47:47 -06:00
Kris Nuttycombe dada8b38bc Add 'AllowRevealedAmounts' in tests where it is now necessary. 2022-04-07 08:47:47 -06:00
Kris Nuttycombe 51defe9f96 Make all privacy policy checks after note selection.
This adds tests to wallet_z_sendmany that demonstrates conditions
where pool-crossing transfers were not being caught by the privacy
policy checks, which were validating only against the transfer
request rather than the actual transfer selected. This missed
cases where sending funds between unified addresses would reveal
amounts via the turnstile.

Making all privacy policy checks after note selection guards against
this error.
2022-04-07 08:47:47 -06:00
therealyingtong 63c83ad5df Fix >= bound when iterating over network upgrades. 2022-04-07 20:03:46 +08:00
therealyingtong 1ab4da3f2c Use height of latest network upgrade in -mineraddress validation.
Co-authored-by: Jack Grigg <jack@electriccoin.co>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-04-07 18:49:44 +08:00
therealyingtong dcc2a68682 Inline z_listaccounts check in wallet_accounts.py 2022-04-07 18:06:41 +08:00
therealyingtong 6af03626de Add z_listaccounts RPC.
Co-authored-by: Kris Nuttycombe <kris.nuttycombe@gmail.com>
2022-04-07 17:28:51 +08:00
str4d a86220ee62
Merge pull request #5835 from nuttycom/dep/update_secp256k1
Update to orchard-0.1.0-beta.3, incrementalmerkletree 0.3.0-beta.2, secp256k1-0.21
2022-04-07 03:21:11 +01:00
Jack Grigg b2b178bd21 lint: Add check that every Cargo patch has a matching replacement
We canonicalize git URLs when linting Cargo patches, because Cargo
treats `path/to/repo` and `path/to/repo.git` identically (and similarly
it strips a trailing slash), so we allow `.cargo/config.offline` and
`Cargo.toml` to mismatch in this way to minimise lints.
2022-04-07 02:14:52 +00:00
Kris Nuttycombe 63d13a437f Update to orchard-0.1.0-beta.3, incrementalmerkletree 0.3.0-beta.2, secp256k1-0.21 2022-04-06 17:48:49 -06:00
Kris Nuttycombe cc892fd48d
Merge pull request #5824 from nuttycom/bug/change_reveals_amounts
Fix condition where change outputs could violate z_sendmany privacy policy.
2022-04-06 14:57:08 -06:00
Kris Nuttycombe 834162a25e
Merge pull request #5833 from therealyingtong/fix-orchard-z_listunspent
Correctly derive UAs for unknown Orchard receivers.
2022-04-06 14:54:25 -06:00
str4d 8750178432
Merge pull request #5828 from zcash/docker_remove_stretch_for_buster
Update Dockerfile
2022-04-06 21:52:12 +01:00
therealyingtong 896ae6315b Correctly derive UAs for unknown Orchard receivers.
The previous code assumed that we would only see wallet addresses
that we had explicitly generated, and crashed if we detected a note
sent to a different Orchard receiver within a known account.

Fixes zcash/zcash#5827.

Co-authored-by: Jack Grigg <jack@electriccoin.co>
2022-04-06 23:42:51 +08:00
therealyingtong da5575a02d IsNoteSaplingChange: Inline internal recipient check.
This fixes the usage of IsNoteSaplingChange in z_listreceivedbyaddress.

Co-authored-by: Jack Grigg <jack@electriccoin.co>
2022-04-06 23:28:55 +08:00
Marshall Gaucher b06a3096d8
Merge pull request #5829 from zcash/merge-hotfix-v4.6.0-2
Merge hotfix-v4.6.0-2
2022-04-06 07:12:39 -07:00
therealyingtong 37c5bca411 Introduce push_orchard_result in z_listreceivedbyaddress. 2022-04-06 20:39:15 +08:00
therealyingtong 8a7283ca83 Introduce CWallet::HaveOrchardSpendingKeyForAddress. 2022-04-06 20:34:38 +08:00
therealyingtong 2f51461611 Merge remote-tracking branch 'upstream/hotfix-v4.6.0-2' into master 2022-04-06 17:38:51 +08:00
Kris Nuttycombe e6d498e9c9 Check privacy strategy when setting allowed change types. 2022-04-05 20:47:37 -06:00
Kris Nuttycombe a48aa0195c Add logging to the miner to provide more detail on tx selection. 2022-04-05 20:47:37 -06:00
Kris Nuttycombe 1d2f1d6689 Add a test demonstrating that change may cross the pool boundary without permission. 2022-04-05 18:16:57 -06:00
Marshall Gaucher c15fd4db9c
Update Dockerfile
Per discussion of Debian 9 (stretch) support
2022-04-05 16:55:42 -07:00
Jack Grigg 484edf2cdb wallet: Remove duplicate nullifier insertion into Orchard wallet
We have the same insertion a few lines earlier.
2022-04-05 18:22:36 +00:00