Commit Graph

1333 Commits

Author SHA1 Message Date
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