Commit Graph

1524 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 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 53cc7ecceb Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2022-03-30 10:10:28 -06:00
Kris Nuttycombe 72b27fb906 Add independent wallet persistence tests.
Co-authored by: @therealyingtong
2022-03-30 08:27:41 -06: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 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
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 ad97298637 Apply suggestions from code review
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
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 0daa540128 Merge remote-tracking branch 'upstream/master' into nu5-consensus 2022-03-28 10:13:51 -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
Steven Smith e375f4ace2 Remove the fExperimentalOrchardWallet flag and related logic 2022-03-25 21:46:09 -07:00
Kris Nuttycombe 9f4e5ef2cc Add test for rollback of an Orchard spend. 2022-03-25 15:10:42 -06:00
Kris Nuttycombe dc4afca405 Correctly return p2pkh/p2sh labels for z_listunifiedreceivers 2022-03-25 10:44:18 -06:00
Kris Nuttycombe 8630891c5a Improve consistency of RPC parameter and result attribute naming.
Make consistent use of "pool", "address type" and "receiver type",
in RPC documentaion, and deprecate bare uses of "type" in RPC APIs.

Fixes #5534

Co-authored-by: str4d <thestr4d@gmail.com>
2022-03-25 10:44:18 -06:00
Kris Nuttycombe 881e0f2ca8 Rename unifiedaddress->address in z_getaddressforaccount results
Fixes #5432
2022-03-25 08:29:56 -06:00
Jack Grigg ac7dd3acca qa: Remove pinned action indices from wallet_listreceived
Orchard output ordering is no longer deterministic, as we now shuffle
spends and outputs during bundle building. But we _can_ still check that
the action index of a note being spent is correct.
2022-03-23 20:56:22 +00:00
Jack Grigg 165901c654 qa: Remove hard-coded consensus branch IDs from RPC tests
Also fixes a bug in the `nuparams` helper, which would have caused MSB
zeroes in consensus branch IDs to not be rendered in the `-nuparams`
option. This hadn't been encountered because we haven't yet generated a
consensus branch ID with a zero MSB.
2022-03-23 20:28:31 +00:00
Jack Grigg e5210d50c9 Set NU5 protocol version for regtest to 170040, bump protocol version
We need to bump the `zcashd` protocol version because the new rules are
not compatible with existing rules followed by 170015 nodes, but we
_also_ need to ensure we can still bump it again once we set the testnet
reactivation height (changing node network behaviour again). This commit
also enables RPC tests to run (because previously the nodes considered
each other to be too old for NU5 to be active, and were disconnecting).
2022-03-23 18:37:56 +00:00
Jack Grigg 9e9f58b26f Merge branch 'master' into unify-nu5-consensus-changes 2022-03-23 02:57:16 +00:00
Jack Grigg 77a971fbc1 Migrate to latest `zcash/librustzcash` revision
This includes:
- `orchard =0.1.0-beta.3` which includes the final circuit changes.
- The new NU5 consensus branch ID.
- Updated ZIP 244 test vectors (which use the NU5 consensus branch ID).
2022-03-23 02:05:06 +00:00
Jack Grigg 479b10364b qa: Exclude `native_libtinfo` from dependency update checks
We are pinning a specific version to get Arch builds working.
2022-03-22 19:33:14 +00:00
Jack Grigg e576f6616f Fix bugs in wallet_addresses RPC test
- The legacy_random source should only contain Sprout addresses (as
  zcashd now only derives transparent addresses from the mnemonic seed).
- Sapling addresses should appear in the mnemonic_seed source, not the
  legacy_seed source (as zcashd no longer ever generates keys there).

The RPC test also now has several additional checks:

- `listaddresses` does not return duplicate addresses (an address can
  only come from a single source).
- Address sets are now explicitly checked (to ensure that there are no
  unexpected addresses under the checked sources).
2022-03-22 14:55:39 +00:00
Larry Ruane e575e0f217 update listaddresses RPC for UAs, Orchard
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
2022-03-22 14:55:17 +00:00
Kris Nuttycombe ba3594f9ee Uncomment addtional tests that depend on z_viewtransaction. 2022-03-19 12:11:27 -06:00
Kris Nuttycombe b32c8d3f0f Fix missing AllowRevealedSenders flag in test. 2022-03-18 21:41:38 -06:00
Kris Nuttycombe fabff30d88
Merge pull request #5700 from nuttycom/5186-updates-to-z_viewtransaction
Add Orchard and Unified Address support to z_viewtransaction
2022-03-18 17:19:31 -06:00
Kris Nuttycombe 2d673ca704 Update z_viewtransaction documentation to correctly represent field names. 2022-03-18 11:05:48 -06:00
Kris Nuttycombe 0c977076bc Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2022-03-18 08:34:27 -06:00
Steven Smith e1e480e9c4 Ensure z_viewtransaction returns Orchard details 2022-03-18 08:31:51 -06:00
Steven Smith 445f4de0f4 Add Orchard & unified address support to z_viewtransaction.
Fixes #5186
2022-03-18 08:31:48 -06:00
Kris Nuttycombe 28210791a1
Merge pull request #5693 from str4d/z_sendmany-privacy-policy
z_sendmany: Replace `allowRevealedAmount` with `privacyStrategy`
2022-03-18 08:09:43 -06:00
Jack Grigg 65cb79e023 z_sendmany: Expand `privacyPolicy` cases
We now have a full roster of privacy policies. We can graph the
relationships between the policies; arrows point from more-private to
less-private, and each policy is permitted to reveal information covered
by all policies pointing to it (in addition to the extra information it
is permitted to reveal).

                       FullPrivacy
                            v
                   AllowRevealedAmounts
                        v           v
    AllowRevealedRecipients   ---- AllowRevealedSenders
               v             /               v
     AllowFullyTransparent <-  AllowLinkingAccountAddresses
                        v       v
                        NoPrivacy

The synthetic `LegacyCompat` policy now uses the `AllowFullyTransparent`
policy for backwards compatibility, and the `FullPrivacy` policy if the
sender or recipients involve Unified Addresses.

Closes zcash/zcash#5677.
Closes zcash/zcash#5678.
2022-03-18 02:45:23 +00:00
Jack Grigg 1505121877 z_sendmany: Replace `allowRevealedAmount` with `privacyStrategy`
This replaces the bool argument with a string argument, enabling us to
add additional privacy strategies. We also alter the default to be
backwards-compatible with existing RPC method usage, by only enabling
the strongest checks if a Unified Address is involved.

Closes zcash/zcash#5676.
2022-03-18 00:58:13 +00:00
Kris Nuttycombe 80324bc653 Merge remote-tracking branch 'upstream/master' into feature/wallet_orchard-merge_master 2022-03-17 16:52:49 -06:00
str4d 12b37d5a11
Merge pull request #5665 from str4d/5657-z_sendmany-orchard-spends
Add support for sending Orchard funds in `z_sendmany`
2022-03-16 18:12:56 +00:00
ying tong 1cd92e579c Style improvements in RPC tests.
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2022-03-15 16:22:05 -06:00
therealyingtong c1cd8a7e2d Adapt RPC tests to use z_getbalance for UAs. 2022-03-15 16:22:05 -06:00
Jack Grigg c2220f4eb9 Add support for sending Orchard funds in `z_sendmany`
Closes zcash/zcash#5665.
2022-03-15 19:53:30 +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
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 8bf99eaacc Merge remote-tracking branch 'upstream/master' into feature/wallet_orchard-merge_master 2022-03-09 22:17:49 -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
Kris Nuttycombe 98ee3bd733 Update tests with rollback checks. 2022-03-09 09:26:37 -07:00
sasha ced825edec
Merge pull request #5587 from nuttycom/feature/wallet_orchard-record_spends 2022-03-08 18:38:47 -08:00
str4d 7129827509
Merge pull request #5601 from str4d/feature/wallet_orchard-shielded_coinbase
Select Orchard receivers from UA miner addresses once NU5 activates
2022-03-08 15:32:32 +00:00
Kris Nuttycombe c3cf141936 Apply suggestions from code review
Co-authored-by: str4d <thestr4d@gmail.com>
2022-03-07 19:11:43 -07:00
Kris Nuttycombe 6171f27b02 Add a test for Orchard note detection.
We can't actually test rollback via RPC tests until
wallet persistence is implemented. This implements
a rollback scenario that will should pass after wallet
persistence is implemented.
2022-03-07 19:05:00 -07:00
str4d 13351ff31d
Merge pull request #5609 from str4d/bump-deps-4.7.0-rc1
Bump dependencies ahead of 4.7.0-rc1
2022-03-05 13:37:28 +00:00
Kris Nuttycombe cf4d0f3d2d Add test for Orchard contribution to z_gettotalbalance 2022-03-03 17:41:30 -07:00
Jack Grigg 3fa58149b0 Select Orchard receivers from UA miner addresses once NU5 activates
Closes zcash/zcash#5023.
2022-03-03 15:57:40 +00:00
Jack Grigg 9a60cdeed9 Add RPC test for the Orchard commitment tree bug on first NU5 testnet 2022-03-03 13:36:42 +00:00
therealyingtong cedf2b5ecb wallet_sendmany_any_taddr.py: Expect expired tx to be ignored. 2022-03-03 01:31:32 +08:00
therealyingtong 98cd4bab0b wallet_sendmany_any_taddr.py: Test sending output from expired tx. 2022-03-03 01:31:32 +08:00
Kris Nuttycombe bd50fbbb94 Filter returned Orchard notes by minimum confirmations. 2022-03-01 16:30:29 -07:00
therealyingtong 4a8bdabb2f wallet_sendmany_any_taddr.py: Test sending from a change taddr. 2022-03-01 11:33:54 +08:00
Jack Grigg 21430b13ac depends: Update Rust to 1.59.0 2022-03-01 00:09:18 +00:00
Jack Grigg adb7d074d5 qa: Postpone recent CCache release 2022-03-01 00:05:01 +00:00
Jack Grigg 4c49af7750 qa: Bump all postponed dependencies
We have a pending PR to address the `native_ccache` and `googletest`
dependencies, and we aren't going to touch `bdb`.
2022-03-01 00:03:42 +00:00
Jack Grigg d4078c8d25 Select Orchard receivers preferentially from UAs
The addition of `OrchardRawAddress` to `RecipientAddress` drives most of
the changes in this commit, which enable `z_sendmany` to send funds to
addresses in the Orchard pool once NU5 activates.
2022-02-25 00:52:52 +00:00
Jack Grigg bb4e792c84 Merge branch 'master' into feature/wallet_orchard-orchard_sendmany 2022-02-25 00:33:28 +00:00
Jack Grigg b0769e3f1d Add Orchard to default UA receiver types
We also add Orchard-specific information to several RPCs in order for
tests to pass:

- `z_listunifiedreceivers`
- `z_getbalanceforaccount`
- `z_getbalanceforviewingkey`
2022-02-24 02:17:52 +00:00
Larry Ruane ba9e020fcd add functional test 2022-02-17 16:47:59 -07:00
Larry Ruane 698f7ba770 z_listreceivedbyaddress: reject UA component addr (#5537) 2022-02-15 09:19:09 -07:00
sasha e568a190f3
Merge pull request #5419 from zcash/feature/wallet_unified_addresses 2022-02-14 08:17:36 -08:00
Kris Nuttycombe b1ab30c8d9 Rename sapling-specific zip32 FFI methods.
Also addresses a couple of other minor comments from code review.
2022-02-12 15:24:48 -07:00
Larry Ruane 326dafeebe fix wallet_listreceived.py, add blockdata to taddr output 2022-02-12 13:01:58 -07:00
Kris Nuttycombe 007f05493a Add change field to z_listreceivedbyaddress for transparent addrs.
This updates the `IsChange` method to check the HD keypath associated
with the key for whether the address was generated as internal
or external.
2022-02-11 12:48:35 +00:00
Larry Ruane c48e35bb66 Update z_listreceivedbyaddress to support unified addresses (5467) 2022-02-11 12:48:23 +00:00
Jack Grigg 89b9bbaf33 wallet: Separate counters for external and internal transparent keys
This fixes a potential bug with importing the mnemonic into a third
party transparent wallet. Previously, if a user called `getnewaddress`,
made a bunch of transactions that generated at least 20 change
addresses, and then called `getnewaddress` again, the two external
addresses would be separated by a gap of more than 20. If this mnemonic
were imported into a third party transparent wallet, the wallet would
not detect any funds in the second (or subsequent) transparent addresses
because it would detect 20 unused addresses in a row (via the BIP 44
default gap limit).

Now, we track external and internal keys separately; repeated calls to
`getnewaddress` will return addresses for sequential keys. This has the
added benefit that the sequence of `getnewaddress` outputs will be the
same after restoring from a backup.
2022-02-10 21:26:29 +00:00
Jack Grigg 11e62fa997 wallet: Remove `CWallet::GetKeyFromPool`
Legacy transparent addresses for external use are now obtained directly
via `GenerateNewKey(true)`.
2022-02-10 21:26:29 +00:00
Kris Nuttycombe 2aad87e147
Merge pull request #5526 from str4d/wallet-unified-addrs-in-rpcs
Handle wallet Unified Addresses in RPCs
2022-02-09 21:11:41 -07:00
Jack Grigg 88dde127f4 wallet: Show UAs instead of Sapling receivers in `z_listunspent`
We also add a `type` field to the output objects (matching the field in
`z_viewtransaction`), now that the output type can't be distinguished
solely from the address encoding.
2022-02-10 02:32:56 +00:00
Kris Nuttycombe bf79be2b57 Replace z_getbalanceforaddress with z_getbalanceforviewingkey 2022-02-09 16:58:55 -07:00
str4d 9439c79bab
Merge pull request #5469 from nuttycom/feature/wallet_unified_addresses-z_sendmany
Add support for unified addresses to z_sendmany
2022-02-08 23:42:59 +00:00
Kris Nuttycombe 3f84067658 Fix nondeterministic test failure in wallet_listreceivedby.py 2022-02-08 14:18:18 -07:00
Kris Nuttycombe 1890758b27 Apply suggestions from code review.
Co-authored-by: str4d <thestr4d@gmail.com>
2022-02-08 10:59:15 -07:00
Kris Nuttycombe cf271473eb Apply suggestions from code review
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
Co-authored-by: str4d <thestr4d@gmail.com>
2022-02-07 16:52:31 -07:00
Kris Nuttycombe 13ee447a42 Merge branch 'test_wallet_listreceived' into feature/wallet_unified_addresses-z_sendmany 2022-02-07 15:08:35 -07:00
Kris Nuttycombe fa0d4eb473 Use z_shieldcoinbase for Sprout funds in wallet_listreceived tests.
After release 4.7.0, z_sendmany will no longer support sending
funds to Sprout. By using z_shieldcoinbase, we can avoid this
limitation.
2022-02-07 15:06:19 -07:00
Larry Ruane 1e165b8396 allow UA as z_shieldcoinbase destination 2022-02-03 08:31:26 -07:00
zancas ca04cb0a58
All implementations of ComparisonTestFramework were overriding num_nodes
Moreover, they were all overriding it to the same value (1).
Set the default to 1 and remove redundant subclass constructor code.
2022-02-01 10:27:16 -07:00
zancas 4dce020678
enforce usage of the get_tests comptool interface as ComparisonTestFramework method
In practice all-and-only subclasses of ComparisonTestFramework implement get_tests.
This commit enforces this relation.
2022-02-01 10:27:10 -07:00
Kris Nuttycombe 214567be2c Add a few additional cases to z_sendmany RPC tests. 2022-02-01 08:24:31 -07:00
Kris Nuttycombe a0c27bf254 Address TODOs in rpc-tests/wallet-accounts.py 2022-02-01 08:24:31 -07:00
Kris Nuttycombe 9afea4f10b Add failing tests for z_sendmany ANY_TADDR -> UA and UA -> <legacy_taddr> 2022-01-30 11:07:00 -07:00
Kris Nuttycombe 71f17fa05c Add a check for internal vs. external outputs to wallet_listreceived test. 2022-01-27 21:29:40 -07:00
str4d 992a47103d
Merge pull request #5500 from str4d/ua-wallet-balance-rpcs
Implement balance RPC methods that support Unified Addresses
2022-01-27 20:11:38 +00:00
Kris Nuttycombe d17a0bb9de Merge remote-tracking branch 'upstream/master' into feature/wallet_unified_addresses 2022-01-25 20:27:33 -07:00
Jack Grigg 756f4fc840 wallet: Implement `z_getbalanceforaddress`
Closes zcash/zcash#5182.
2022-01-26 00:34:45 +00:00
Jack Grigg ca0dad0a8c wallet: Implement `z_getbalanceforaccount`
Closes zcash/zcash#5183.
2022-01-25 23:54:30 +00:00
Kris Nuttycombe 28eddb7c21
Merge pull request #5474 from LarryRuane/2022-01-disable-sprout-addr-gen
rpc: Disable Sprout address generation at Canopy #5368
2022-01-25 10:05:44 -07:00
Charlie O'Keefe 19bfc2f3b8
Merge pull request #5463 from zingolabs/drop_pyblake2_dep
Drop pyblake2 dependency
2022-01-25 09:32:08 -07:00
Kris Nuttycombe c4a74087b7 Modify CWallet::FindSpendableInputs to use ZTXOSelector 2022-01-24 13:10:31 -07:00
str4d a6f9c9c0bc Merge pull request #5458 from nuttycom/cleanup/sendmany_txbuilder
Use the transaction builder to implement z_sendmany.
2022-01-21 20:14:58 -07:00
Kris Nuttycombe f850e89449 Replace the badly-named `PaymentSource` with `ZTXOSelector`
The ZTXOSelector type allows selection of previous Zcash
transaction outputs (both transparent outputs and shielded notes)
on the basis of either a (legacy) bare address, or for a
BIP-44 account.
2022-01-19 13:35:38 -07:00
Jack Grigg 96c9333b74 wallet: Reverse order of arguments to z_getaddressforaccount
We now use the empty array of pools to indicate that the default pools
should be used when providing a diversifier index parameter, instead of
needing a default sentinel value for the diversifier index parameter
(which was previously suggested as '*' which would have caused issues
for defining a consistent type for that parameter).
2022-01-18 20:02:13 +00:00
Jack Grigg ff0e9f6b95 wallet: Show UAs owned by the wallet in `z_viewtransaction`
Part of zcash/zcash#5186.
2022-01-18 19:44:33 +00:00
Jack Grigg baaa3c4ac0 wallet: Implement `z_listunifiedreceivers`
Closes zcash/zcash#5181.
2022-01-18 19:44:33 +00:00
Jack Grigg 8617622e0d wallet: Implement `z_getaddressforaccount`
Closes zcash/zcash#5180.
2022-01-18 19:43:27 +00:00
Jack Grigg fe384eeb1f wallet: Implement `z_getnewaccount`
Closes zcash/zcash#5178.
2022-01-13 22:35:08 +00:00
Kris Nuttycombe cc392c70a6 Merge branch 'master' into feature/wallet_unified_addresses 2022-01-12 16:54:12 -07:00
str4d 423489c5e8
Merge pull request #5458 from nuttycom/cleanup/sendmany_txbuilder
Use the transaction builder to implement z_sendmany.
2022-01-12 23:50:09 +00:00
Kris Nuttycombe 0ca7d49626 Apply suggestions from code review
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
Co-authored-by: str4d <jack@electriccoin.co>
2022-01-12 10:45:46 -07:00
Kris Nuttycombe 9554ed2dc4 Require an explicit flag to allow cross-pool transfers in z_sendmany.
This adds an `allowRevealedAmounts` argument to z_sendmany. This
flag must be present to allow an amount-revealing cross-pool transfer
to be constructed.
2022-01-11 19:40:02 -07:00
Kris Nuttycombe 322aee238a Fix conditions around dust thresholds. 2022-01-11 19:40:02 -07:00
Kris Nuttycombe f9477a4499 Use transaction builder for asyncrpcoperation_sendmany.
This replaces the old implementation of asyncrpcoperation_sendmany
with one where all transaction construction is delegated to the
transaction builder. The capabilities of z_sendmany are somewhat
modified in the process:

* z_sendmany now permits sending funds from a Sprout address to
  both transparent and Sapling addresses. PRIVACY NOTE: When
  user sends a Sprout->Sapling transaction, the amount of the
  transaction is publicly revealed.
* z_sendmany no longer supports transactions sending funds into
  the Sprout pool, with the exception of change amounts when
  sending from a Sprout address.
* When sending transparent coinbase funds to a set of shielded
  addresses, the amount sent to recipients must fully consume
  the input value and no change is permitted. This is a slightly
  weaker constraint than was previously implemented; in the past,
  only a single shielded recipient was allowed.
2022-01-11 13:28:34 -07:00
Kris Nuttycombe d6525e24db
Merge pull request #5445 from rex4539/typos
Fix typos
2022-01-11 10:31:01 -07:00
zancas fbbdb23214
blake2b/s is integrated into hashlib, drop external python package dependency 2022-01-11 10:16:22 -07:00
Kris Nuttycombe 20266ac911 Remove uses of KeyIO::DecodeDestination 2022-01-07 11:49:07 -07:00
Kris Nuttycombe f5d4f6fef1 Remove `RawAddress`
This adds a new `AddrSet` type for use in note retrieval
as a filter, in place of a heterogeneous list of `RawAddress`
values. `RawAddress` will complicate the handling of addresses
within the wallet after the addition of unified addresses,
because it does not contain transparent receiver types, and
if we retain this polymorphism it means a lot of invalid states
are represented in places we don't want them to be. It's better
to figure out what types of addresses we're working with as soon
as possible after parsing, and use monomorphic calls from there
on in.
2022-01-06 22:29:41 -07:00
Kris Nuttycombe 98967e2ec7 Merge remote-tracking branch 'upstream/master' into feature/wallet_unified_addresses 2022-01-05 18:20:31 -07:00
Jack Grigg 4559186596 rpc: Fix regression in getblocktemplate output
We added support for the NU5 consensus rules in v4.5.0, which alters the
block header to contain a `hashBlockCommitments` value instead of the
chain history root. However, the output of `getblocktemplate` wasn't
returning this value; once NU5 activated, the `blockcommitmentshash`
field was being set to "null" (all-zeroes).

In v4.6.0 we added full NU5 support to `getblocktemplate`, by adding a
`defaultroots` field that gave default values for `hashBlockCommitments`
and the components required to derive it. However, in doing so we
introduced a regression in the (now-deprecated) legacy fields, where
prior to NU5 activation they contained nonsense.

This commit fixes the output of `getblocktemplate` to have the intended
semantics for all fields:

- The `blockcommitmentshash` and `authdataroot` fields in `defaultroots`
  are now omitted from block templates for heights before NU5 activation.

- The legacy fields now always contain the default value to be placed
  into the block header (regaining their previous semantics).

Co-authored-by: Larry Ruane <larry@z.cash>
2022-01-05 12:07:46 +00:00
Larry Ruane 97a76f1b61 test: Fix ZIP 244 implementation
Script codes must be serialized in their field encoding, which
includes the CompactSize length prefix.

Co-authored-by: Jack Grigg <jack@z.cash>
2022-01-05 12:07:46 +00:00
Larry Ruane dfefab2f55 test: check getblocktemplate output before and after NU5
This test currently fails with submitblock returning the error
"bad-heartwood-root-in-block".

Added authdigest to GBT coinbasetxn field because we can't obtain this
via getrawtransaction.

Co-authored-by: Jack Grigg <jack@z.cash>
2022-01-05 12:07:46 +00:00
Dimitris Apostolou 2006939d27
Fix typos 2022-01-02 23:16:01 +02:00
Larry Ruane 1f223ebed7 assert that the return value of submitblock is None 2021-12-28 22:10:13 -07:00
Larry Ruane b538577359 test: Use result of getblocktemplate to submitblock
This will ensure that miners can use the values returned by
getblocktemplate (in particular, the block commitment hash)
to submit a valid block using the submitblock RPC.
2021-12-22 15:35:46 -07:00
Larry Ruane 8c0177a507 test: fix bugs in test framework 2021-12-22 15:05:38 -07:00
Kris Nuttycombe 8b093a79da
Merge pull request #5402 from LarryRuane/2021-12-getblocktemplate
Add defaultroots field to getblocktemplate
2021-12-17 12:28:06 -07:00
MarcoFalke 6d60f1a9c9 [rpc] mining: Omit uninitialized currentblockweight, currentblocktx
zcash/zcash:
The `getmininginfo` RPC now omits `currentblockize` and `currentblocktx`
when a block was never assembled via RPC on this node during its current
process instantiation. The relevant RPCs are `generate` (regtest only) and
`getblocktemplate`. Blocks are also assembled when running the internal
miner (`zcashd -gen=1`), after the node mines its first block.

(cherry picked from commit bitcoin/bitcoin@fa178a6385)
2021-12-17 09:35:30 -07:00
Larry Ruane c937ba5ae5 getblocktemplate: add NU5 commitments to new `defaultroots` section
- merkleroot
- authdataroot
- chainhistoryroot
- blockcommitmentshash
2021-12-16 18:52:04 -07:00
str4d 34a8677c43
Merge pull request #5403 from LarryRuane/2021-12-nuparams
test: automatically add missing nuparams (network upgrade heights)
2021-12-17 00:42:04 +00:00
Jack Grigg 407a0d9324 qa: Postpone recent CCache releases 2021-12-16 17:58:05 +00:00
Larry Ruane 7fa0e1a6a9 test: automatically add missing nuparams
This test-only change allows python (rpc) tests to specify, for example,
that NU5 should be activated at height X, without having to specify all
the previous network upgrades. Previous upgrades can (and must) still be
specified if they activate at different block heights (than, in this
example, NU5). This makes tests easier to write (and read), especially
as the number of network upgrades increases over time.

Note that this change only affects zcashd behavior in regtest mode. For
the other network modes (testnet and mainnet), the activation heights
are hard-coded in chainparams.cpp.
2021-12-06 17:32:18 -07:00
Kris Nuttycombe 9202b127d0 Merge remote-tracking branch 'upstream/master' into feature/wallet_orchard 2021-11-23 18:38:07 -07:00
Kris Nuttycombe 13b9a69230
Merge pull request #5306 from nuttycom/feature/mnemonic_seeds
Adds HD seed derivation from ZIP-339 mnemonic phrases.

This replaces random generation of transparent spending keys with BIP-44-compatible derivation from a mnemonic seed phrase, and replaces the random HD seed previously used for Sapling HD key derivation
with the same mnemonic seed. After this change, all new transparent and Sapling addresses
will be derived from a new randomly generated mnemonic seed, which is produced in such a way that 
it is guaranteed to produce valid unified spending keys at account 0 for all address types.

Closes #5176.
Closes #2673.
2021-11-18 17:52:36 -07:00
Kris Nuttycombe c7089d2086
Merge pull request #5374 from rex4539/typos
Fix typos
2021-11-18 15:08:13 -07:00
Dimitris Apostolou e05c1ddf8a
Fix typos 2021-11-14 16:27:09 +02:00
Kris Nuttycombe 399ed5b4d7 Do not strip quotes when verifying mnemonic seed. 2021-11-07 10:16:22 -07:00
Jack Grigg 5eca8d34ba depends: Update Clang / libcxx to LLVM 13 2021-11-06 21:44:24 +00:00
Jack Grigg 373206027f depends: Update Rust to 1.56.1 2021-11-06 21:06:30 +00:00
Jack Grigg 1364db2ded Bump all postponed dependencies 2021-11-06 21:06:30 +00:00
Kris Nuttycombe d09a0c44f3 Clean up format of recovery information in the wallet dump. 2021-10-29 13:38:36 -06:00
Kris Nuttycombe 8bf4ec3b4a Require backup of the emergency recovery phrase.
After 4.5.2, all wallets will be populated with an emergency
recovery phrase, and all future addresses will be derived from
the associated seed. To prevent potential loss of funds, we
require that the user explicitly invoke the `walletconfirmbackup`
RPC method to verify that they have backed up this seed.
2021-10-29 13:38:36 -06:00
Kris Nuttycombe d6984dbf78 Fix wallet import/export test 2021-10-21 11:44:08 -06:00
Jack Grigg 0263185a65 depends: Postpone dependency updates
We aren't going to move to Clang 13 in a hotfix release. The other
dependencies passed their postponement re-evaluation date, but also
won't be updated just yet.
2021-10-08 16:54:36 +00:00
Kris Nuttycombe 2221bf5484 Add listaddresses check to wallet_addresses.py 2021-10-07 18:12:13 -06:00
Jack Grigg a7342cff71 depends: Postpone native_ccache 4.4.2 2021-09-29 01:36:35 +01:00
Jack Grigg 6e90c84be7 Fix bugs in testnet Orchard circuit
The consensus branch ID is updated (as the NU5 consensus rules are
altered). The testnet NU5 activation height is also reset.
2021-09-28 22:56:37 +01:00
Jack Grigg fd49f78042 wallet: Check spent shielded notes in CWalletTx::IsFromMe
The "IsFromMe" logic was implemented in several places in the Bitcoin
Core wallet. We had correctly updated CWallet::IsFromMe(CTransaction)
(which was used in most places in the wallet) to check for shielded
notes being spent, but did not notice that CWalletTx::IsFromMe also
needed this check.

This bug has existed since before Zcash launched. It went unnoticed
because CWalletTx::IsFromMe was previously only called from code
used to either create purely-transparent transactions, or provide
informational output on non-critical RPC methods.

Closes zcash/zcash#5325.
2021-09-28 02:51:04 +01:00
Jack Grigg 5a2e6183f3 net: Reject unknown CInv message types
Nodes will now reject messages containing unknown CInv message types,
instead of (mostly) ignoring them.
2021-09-15 20:08:01 +01:00
Jack Grigg 07143679dc test: Set up mininodes at the start of feature_zip239 2021-09-15 17:50:57 +01:00
str4d e989923041
Merge pull request #5291 from str4d/zip-239
ZIP 239 support
2021-09-16 03:08:25 +12:00
str4d 5d643898e7
Merge pull request #5293 from mdr0id/smoke_tests_update
Smoke Test Updates (Remove Sprout Logic )
2021-09-15 20:38:40 +12:00
Jack Grigg 1ad8ee8735 qa: Boost 1.77.0
- The patches `iostreams-106.patch` and `signals2-noise.patch` were
  incorporated into Boost 1.75.
- The allocator access deprecation issue was fixed in Boost 1.76.

Closes zcash/zcash#4945.
2021-09-15 00:35:53 +01:00
Jack Grigg 95280c10b0 Add named constants for legacy tx authDigest placeholder value 2021-09-14 21:26:05 +01:00
Jack Grigg befa57d0a6 test: Fix bug in mininode.SpendDescription.deserialize 2021-09-14 21:18:06 +01:00
Jack Grigg 966e285b61 depends: Update Rust to 1.54.0 2021-09-14 17:40:18 +01:00
Jack Grigg 6e562a27df Postpone dependency updates that require CMake 2021-09-14 17:33:25 +01:00
mdr0id dc41c13593 Update funding logic 2021-09-13 09:54:29 -07:00
mdr0id b6987844f8 Add usage documentation for manual and faucet driven tests 2021-09-10 19:49:52 -07:00
mdr0id 7d7d0e8565 Update funding logic bug 2021-09-10 19:46:33 -07:00
Jack Grigg a97cfd241d test: Implement CInv.__eq__() for mininode to simplify RPC test 2021-09-10 22:13:53 +01:00
Jack Grigg d503691778 Add MSG_WTX support to inv messages
The change to AlreadyHave() means that nodes will also now send getdata
requests for v5 transactions.
2021-09-10 21:47:42 +01:00
Jack Grigg 9476f5d7ef ProcessGetData: Respond to MSG_WTX requests 2021-09-10 21:46:05 +01:00
Jack Grigg de5563de71 test: Add v5 tx support to mininode 2021-09-10 21:46:05 +01:00
Jack Grigg 9047962637 test: Fix bugs in mininode transaction parser 2021-09-10 21:46:05 +01:00
Jack Grigg d715f4ecac Implement CInv message type MSG_WTX
This adds the double-hash message variant. The extra hash field is set
to null for block message types, and to all-ones for MSG_TX (to match
the legacy authHash value used for pre-v5 transactions in the Merkle
tree).
2021-09-10 21:46:05 +01:00
mdr0id 4721ee3eaa Add fix and note for timing issue 2021-09-09 14:58:30 -07:00
mdr0id 2f3698aa3a Remove sprout funding flow logic 2021-09-09 14:57:20 -07:00
Jack Grigg 7896a52015 test: Use correct field of getnetworkinfo to read protocol version
I tested the NU5 components of this PR by locally setting the protocol
version to 170014. I forgot to check that without that override, the
test would skip the NU5 checks. The reason it defaulted to NU5 is that
the test was reading the client version 4040150, which is indeed not
less than the NU5 protocol version ^_^;;
2021-09-01 01:00:26 +01:00
Jack Grigg 4c1c5f479d test: Add NU5 test cases to existing RPC tests 2021-08-27 15:31:04 +01:00
Jack Grigg e0f210f4fc test: Fix pyflakes warnings 2021-08-17 18:50:54 +01:00
Jack Grigg 1e352c108c test: Print reject reason if RPC test block rejected instead of accepted 2021-08-13 16:49:46 +01:00
MarcoFalke b67c86abdb [qa] py2: Unfiddle strings into bytes explicitly
(cherry picked from commit bitcoin/bitcoin@faa41ee204)

Zcash: Excluding RPC tests or framework code we don't have.
2021-08-13 16:49:46 +01:00
Wladimir J. van der Laan d9cb6b89b0 test: Add basic test for `reject` code
Extend P2P test framework to make it possible to expect reject
codes for transactions and blocks.

(cherry picked from commit bitcoin/bitcoin@20411903d7)
2021-08-13 16:49:46 +01:00
Shaul Kfir 55d4948207 Add absurdly high fee message to validation state (for RPC propagation)
(cherry picked from commit bitcoin/bitcoin@a651403e09)
2021-08-13 16:09:59 +01:00
Homu fd462fd8c4 Auto merge of #5269 - str4d:zip-239-prep-2, r=str4d
ZIP 239 preparations 2

Cherry-picked from the following upstream PRs:
- bitcoin/bitcoin#6722
  - Only the ancillary commits, not the mempool limiting commits (we have our own).
- bitcoin/bitcoin#6898
  - Only the first three commits (we'll cherry-pick the main content later).
- bitcoin/bitcoin#7840
2021-08-13 01:13:18 +00:00
Jack Grigg d6dd3cea67 qa: Bump `sync_mempool` timeout for `prioritisetransaction.py`
To try and get around transient CI failures.
2021-08-13 02:12:35 +01:00
John Newbery 3ef50b3647 [wallet] Remove wallet account RPCs
Also remove the RPC deprecation tests for accounts, and make one small
change to another wallet test that relies on account behaviour.

(cherry picked from commit f0dc850bf698f7377797d7d68365d4fc79b0221c)
2021-08-12 08:07:12 -06:00
John Newbery 0bf8b56b29 [RPC] [wallet] allow getbalance to use min_conf and watch_only without accounts.
(cherry picked from commit 702ae1e21a09d8c31406839c4ea507c5fa276898)
2021-08-11 19:36:14 -06:00
Gregory Maxwell 2a7ebb3aba Eliminate TX trickle bypass, sort TX invs for privacy and priority.
Previously Bitcoin would send 1/4 of transactions out to all peers
 instantly.  This causes high overhead because it makes >80% of
 INVs size 1.  Doing so harms privacy, because it limits the
 amount of source obscurity a transaction can receive.

These randomized broadcasts also disobeyed transaction dependencies
 and required use of the orphan pool.  Because the orphan pool is
 so small this leads to poor propagation for dependent transactions.

When the bypass wasn't in effect, transactions were sent in the
 order they were received.  This avoided creating orphans but
 undermines privacy fairly significantly.

This commit:
 Eliminates the bypass. The bypass is replaced by halving the
  average delay for outbound peers.

 Sorts candidate transactions for INV by their topological
  depth then by their feerate (then hash); removing the
  information leakage and providing priority service to
  higher fee transactions.

 Limits the amount of transactions sent in a single INV to
  7tx/sec (and twice that for outbound); this limits the
  harm of low fee transaction floods, gives faster relay
  service to higher fee transactions. The 7 sounds lower
  than it really is because received advertisements need
  not be sent, and because the aggregate rate is multipled
  by the number of peers.

(cherry picked from commit f2d3ba73860e875972738d1da1507124d0971ae5)

Zcash: Candidate transactions for INV are not sorted by their
topological depth because we haven't backported bitcoin/bitcoin#6654.
2021-08-12 00:37:51 +01:00
Homu 1cb1ed2653 Auto merge of #5265 - str4d:zip-239-prep-1, r=str4d
ZIP 239 preparations 1

This is the first of several backports to prepare for ZIP 239. The primary
change is altering `mapRelay` to store `CTransaction`s, which we need
because ZIP 239 requires changing `Inv` messages based on transaction
versions. The other changes are mainly for conflict removal but are also
independently useful.

Backports the following upstream PRs:
- bitcoin/bitcoin#6889
- bitcoin/bitcoin#7125
- bitcoin/bitcoin#7862
- bitcoin/bitcoin#7877
2021-08-10 00:22:32 +00:00
Pieter Wuille d3ccecd0b9 Report reindexing progress in GUI
(cherry picked from commit b4d24e142e25a21c78ab74146c3520f2259fd7c2)

Zcash: Excludes GUI changes (as we don't have the QT GUI).
2021-08-09 20:58:49 +01:00
Pieter Wuille d6d39449e5 Add -reindex-chainstate that does not rebuild block index
(cherry picked from commit d3d75479115bc3480f163df774ee9dd2f8bd9f54)
2021-08-09 20:58:49 +01:00
Jack Grigg 75b9fc4f27 test: Fix race condition in p2p_txexpiringsoon
The recent changes to mempool inv logic mean that nodes are much less
likely to immediately return an `inv` message in response to a `mempool`
message. The `p2p_txexpiringsoon` RPC test was relying on the prior
behaviour.

`TestNode.sync_with_ping` now takes an optional `waiting_for` closure
that allows the caller to require that a specific message kind is
received prior to the timeout.
2021-08-09 17:43:48 +01:00
Jack Grigg 6be1a2a9da test: Wait for transaction propagation in shorter_block_times RPC test
This was previously a transient test failure, that started reliably
failing after the move to Poisson delays.
2021-08-05 20:54:47 +01:00
Jack Grigg d9bcc2d303 depends: Update utfcpp to 3.2.1 2021-07-30 18:22:05 +01:00
Jack Grigg 374f60b326 depends: Update Clang / libcxx to LLVM 12
This is the second release in a row where LLVM has cut a X.0.1 for
everything except Darwin, so I've adjusted its URLs and paths on the
assumption this will continue.
2021-07-30 18:22:05 +01:00
Jack Grigg 0a5e69ab67 depends: Update Rust to 1.54.0 2021-07-30 18:22:05 +01:00
Jack Grigg 1eb848ada2 Postpone dependency updates we aren't doing in this release 2021-07-30 16:04:31 +01:00
str4d 92d6984842
test: Cleanups to ZIP 221 Python test code
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-06-20 21:25:59 +01:00
Jack Grigg a18f8b58a9 test: Check history trees across Canopy and NU5 activations 2021-06-18 12:56:19 +01:00
Jack Grigg 9930a27992 test: Check hashBlockCommitments before, at, and after NU5 activation 2021-06-18 01:05:04 +01:00
Jack Grigg 2d0a8f1f3a test: Check for valid hashBlockCommitments construction post-NU5 2021-06-18 01:05:04 +01:00
Jack Grigg dadb54b67b Postpone native_ccache 4.3 2021-06-08 19:30:01 +01:00
Jack Grigg e0cde186b0 Fix Rust dependency name in postponed-updates.txt 2021-06-08 19:28:05 +01:00
Jack Grigg 20c4efe1bc Postpone dependency updates until after 4.4.1 2021-06-08 19:19:20 +01:00
Jack Grigg 3cdda83868 Postpone Clang 12
We won't migrate to LLVM 12 until Rust does.
2021-04-15 12:10:50 +12:00
Jack Grigg c592bf7da0 python: Use UTF-8 encodings for opened files 2021-04-14 13:19:33 +12:00
Jack Grigg da77a3db73 qa: Postpone Boost 1.75.0
https://github.com/zcash/zcash/issues/4945 remains unresolved.
2021-04-03 17:26:16 +13:00
Jack Grigg c0e146d3f4 qa: Postpone updates that require CMake in the build system
We still aren't committing to that dependency yet.
2021-04-03 17:26:16 +13:00
Jack Grigg d1c6647934 qa: Point univalue update checker at correct upstream
Bitcoin Core doesn't actually use tags for managing versions of their
forked dependencies, so we should separately rework this logic for all
of the subtree-managed dependencies. But this at least prevents false
positives.
2021-04-03 17:15:24 +13:00
Jack Grigg f7c7e0ee13 qa: Update BerkeleyDB downloads page URL 2021-03-27 11:47:34 +13:00