Commit Graph

17586 Commits

Author SHA1 Message Date
Kris Nuttycombe 2fe569ec45
Merge pull request #6503 from sellout/wallet_tx_builder/remove-wallet
Remove CWallet member from WalletTxBuilder
2023-03-28 20:01:57 -06:00
Daira Emma Hopwood dd246587a3 Fix bit-rotted code in miner tests.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2023-03-29 00:05:51 +01:00
Greg Pfeil 7bf5f598ee
Update src/wallet/rpcwallet.cpp
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
2023-03-28 16:30:47 -06:00
Greg Pfeil af2526d755
Improve taddr no-memo check
Do the check deeper, preventing test_bitcoin from being able to bypass it. This
also moves it out of z_sendmany-specific code, which will be helpful when we add
other operations, like sendfromaccount.
2023-03-28 16:28:16 -06:00
Greg Pfeil effbc33276
Remove CWallet member from WalletTxBuilder
This resolves a conflict where most usage is `const`, but some modifies the
wallet. Previously it held a const member and then used `pwalletMain` directly
for the mutating calls. This now passes `CWallet` explicitly where necessary,
using `const` when possible.

This also benefits a follow-up PR (#6408) that introduces locking, which also
mutates the wallet.
2023-03-28 16:24:08 -06:00
Kris Nuttycombe 33d9ff3d24
Merge pull request #6513 from nuttycom/fix_build
Fix current build errors
2023-03-28 14:26:24 -06:00
Kris Nuttycombe 58e8d8620c revert broken "safe extract" functionality in golden tests. 2023-03-28 12:27:59 -06:00
Kris Nuttycombe 3baff76c35 Merge remote-tracking branch 'daira/fix-show-help' into fix_build 2023-03-28 10:51:13 -06:00
Jack Grigg 4a94975268 Use `RandomInvalidOutputDescription()` everywhere it makes sense
As a pre-check inside `z_sendmany` we estimate the size of the
transaction that would be created, to confirm it won't exceed any
limits. We do this by creating a fake transaction with fake outputs and
measuring its size. In the case of Sapling recipients, we'd push an
empty `OutputDescription`.

In zcash/zcash#6459 we pulled in changes that improved type safety in
the Rust types. One of these changes was that the `cv` field in a
Sapling Output Description is now enforced at parsing time to be not
small order (where previously we enforced this at proof verification
time).

The two above paragraphs collide because when measuring the size of the
fake transaction, we convert a `CMutableTransaction` into a
`CTransaction`; this calls `UpdateHash` to pin its txid, and that causes
the transaction to be serialized and then parsed across the FFI. This
causes the null `OutputDescription` to reach the Rust parser which
treats it as invalid.

There are two solutions to this, which are used in various contexts:

- Avoid pushing a null `OutputDescription` into a `CMutableTransaction`.
  This is the fix implemented in this PR for `z_sendmany`: we now call
  `RandomInvalidOutputDescription()` which gives us a consensus-invalid
  but parser-valid `OutputDescription`, suitable for estimating tx size.

- Use `UNSAFE_CTransaction` to avoid having `UpdateHash` be called on
  construction. This type is used in tests where we explicitly want to
  construct an invalid type in C++, for consensus checking purposes. One
  of the `OutputDescription()` uses was in a test, but didn't trigger
  the issue because the test was checking a different part of the
  transaction being invalid. Technically no change is needed here;
  however we now also call `RandomInvalidOutputDescription()` here for
  uniformity.

Part of zcash/zcash#6509.
2023-03-27 22:33:45 +00:00
Daira Emma Hopwood 507e23eec4 Repair show_help RPC test.
This was broken by a combination of several PRs that were apparently
merged with tests not passing (at least #6425 and #6479), due to a CI
fault.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-03-27 13:09:35 +01:00
Greg Pfeil 666a8d1b37
Merge pull request #6377 from sellout/wallet_tx_builder/z_sendmany
Extract common transaction logic from z_sendmany
2023-03-22 11:24:33 -06:00
Greg Pfeil 10a1beb7c5
Have GetRecipientPools return a copy
Previously returned a const reference to a non-const object, which could then be
modified under the caller’s feet.
2023-03-21 11:07:18 -06:00
Greg Pfeil 8ebb22c67f
Simplify SelectOVKs
This inverts the structure, dispatching on the selector pattern first, then only checking
`SpendableInputs` if the selector is multi-pool. This shortens the code, eliminates some failure
cases, and caught a bug where `SaplingExtendedFullViewingKey` selectors were not
supported (previously hidden by `match { ..., [](const auto&) … }`).
2023-03-20 18:22:53 -06:00
Greg Pfeil 5236f447c7
Apply suggestions for WalletTxBuilder from code review
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2023-03-20 16:20:50 -06:00
Greg Pfeil af2c7e7e49
Address WalletTxBuilder review feedback 2023-03-20 14:23:18 -06:00
Greg Pfeil 1f72b42b81
Additional z_sendmany test cases
Also improve error messages.
2023-03-20 11:24:50 -06:00
Greg Pfeil 62ae44a131
Ensure that a WalletTxBuilder tx balances
This also removes the code that stops adding spends if they ever go
`>= targetAmount`. The included note limiting and change calculation should
ensure that it’s always `==` at the end, and we don’t want paper over a mistake
in those earlier calculations.

There are existing tests that fail if either
- the newly-added Orchard increment is missing or
- the assertion is applied when there’s Sprout change.
2023-03-20 09:40:42 -06:00
str4d 598ede46c4
Merge pull request #6499 from str4d/update-deps-5.5.0
Update dependencies again for 5.5.0
2023-03-18 00:43:52 +00:00
Jack Grigg 0b77f8f79a cargo update 2023-03-17 23:22:53 +00:00
Greg Pfeil 5081a8e8fd
Address WalletTxBuilder PR feedback 2023-03-17 16:11:40 -06:00
Jack Grigg fe0b3ee89f depends: Postpone CCache updates again
We can update CCache when we drop support for Ubuntu 18.04.
2023-03-17 20:42:13 +00:00
Jack Grigg 679e77ce3f depends: CMake 3.26.0 2023-03-17 20:40:13 +00:00
Jack Grigg 69ab270480 depends: `cxx 1.0.92` 2023-03-17 20:32:01 +00:00
str4d 6ebf01fa83
Merge pull request #6459 from str4d/zcash_primitives-0.10
Migrate to `zcash_primitives 0.10`
2023-03-17 20:03:37 +00:00
str4d 0e7d61d6dc
Adjust documentation
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2023-03-17 17:16:33 +00:00
Daira Emma Hopwood 1da8a545d8 Adjust indentation to be consistent without changing existing code.
Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-03-17 16:55:51 +00:00
Greg Pfeil 77a26692bb
Don’t permit user-provided “internal” payments
The `Payment` type had an `isInternal` field, but it is (and should always be) `false`.
`ResolvedPayment` is the corresponding type internal to the transaction builder that can be either
internal (for change) or external (for user-requested payments).
2023-03-16 19:49:38 -06:00
Jack Grigg 7f35a0da5c Migrate to `zcash_primitives 0.10`
Closes zcash/zcash#6398.
2023-03-17 00:09:45 +00:00
str4d e9e160c7e2
Merge pull request #6474 from str4d/wallet-zcash_note_encryption
Migrate in-wallet Sapling output decryption to `zcash_note_encryption`
2023-03-16 23:19:27 +00:00
Greg Pfeil d90ca22be7
Clarify `AddressResolutionError`
- document and rename the enum cases,
- rewrite some of the exception messages, and
- restructure the UA recipient case.
2023-03-16 17:18:47 -06:00
Greg Pfeil 9f84ce2858
Update WalletTxBuilder based on review
Some of the more significant changes are
- remove release note entry for already-released feature;
- rephrase some error messages and comments;
- add a missing case to `EstimateTxSize`;
- don’t return a selector when we don’t have a UFVK for a UA, which allows some
  simplifications (and elimination of a failure case) to happen; and
- remove a redundant `InsufficientFundsError`.
2023-03-16 13:57:57 -06:00
str4d a37c1b06ec
Merge pull request #6493 from str4d/ci-update-workflows
Update CI workflows
2023-03-16 17:33:25 +00:00
Jack Grigg feb1f41ce6 CI: Check out both the base and PR branches for "recent base" check
This should hopefully ensure that we end up with a single Git repository
that has both branches in it, enabling `git merge-base --is-ancestor` to
work correctly.
2023-03-16 16:22:28 +00:00
Jack Grigg ac3568a557 CI: Provide `write` permission for `pull-requests`
The "recent base" check attempts to remove a label from the PR being
checked, which uses the `issues` API. But a `write` permission for the
`issues` API appears to be insufficient.
2023-03-16 15:51:20 +00:00
Jack Grigg 41bd54c8ae cargo vet prune 2023-03-16 15:45:04 +00:00
Jack Grigg d54f7d001e CI: Migrate to `cargo-vet 0.5` 2023-03-16 15:44:31 +00:00
Jack Grigg 5c316e8d50 CI: Remove most usages of `actions-rs` actions
These actions are unmaintained. The only one we continue to use is
`actions-rs/clippy-check` because there is no suitable alternative.
2023-03-16 15:38:15 +00:00
Greg Pfeil ad26296b89
Make RPC test output more deterministic
* sort the result summary (always)
* add a flag, `--deterministic` (`-d`), to enable other output changes
* don’t print progress `.` (with `-d`)
* don’t print durations/runtime (with `-d`)

This isn’t fully deterministic as tests can still complete out of order, but
even there these changes make it easier to diff regions. Adding `--jobs 1`
should make it fully deterministic at the cost of performance.
2023-03-16 01:32:45 -06:00
Kris Nuttycombe b177eeb89e
Merge pull request #6490 from str4d/book-eos-heights-v5.3.3-v5.4.2
book: Add End-of-Support heights for v5.3.3 and v5.4.2
2023-03-15 18:23:42 -06:00
str4d 207c88474f
Improvements to code comments
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2023-03-15 23:52:09 +00:00
str4d 1b7b73b794
Merge pull request #6489 from str4d/ci-checks-fix-head-ref
CI: Use `github.head_ref` instead of `HEAD` for "recent base" check
2023-03-15 17:56:38 +00:00
Jack Grigg 85c3a701f9 book: Add End-of-Support heights for v5.3.3 and v5.4.2 2023-03-15 17:54:41 +00:00
Jack Grigg 41997a5ac3 CI: Use `github.head_ref` instead of `HEAD` for "recent base" check
The `pull_request_target` event causes `actions/checkout` to check out
the target branch (e.g. the main repo's `master` branch) instead of the
PR's branch. This meant that after zcash/zcash#6487 merged, the check
would always pass (because the queried revision is always present in the
history of `master`). `github.head_ref` correctly points to the tip of
the PR's branch, ensuring that `git merge-base --is-ancestor` performs
the expected comparison.
2023-03-15 15:33:05 +00:00
Kris Nuttycombe 219b9c68b0
Merge pull request #6487 from str4d/ci-checks-more-fixes
CI: More fixes to "recent base" check
2023-03-14 21:48:39 -06:00
str4d 38f7ed3ce4
Merge pull request #6466 from nuttycom/cleanup/params_const_correctness
Improve CChainParams const correctness.
2023-03-15 03:02:35 +00:00
Jack Grigg 8a33c66a68 CI: Include explicit `failure()` condition in "recent base" check
This is necessary to override the default `success()` status check, and
allow the narrowing condition to function correctly.
2023-03-15 02:48:55 +00:00
Jack Grigg 08347f40fc CI: Fetch all history for "recent base" check
This ensures that the branch history containing the commit in question
is present.
2023-03-15 02:44:48 +00:00
Kris Nuttycombe b1240282d6 Explicitly provide CChainParams to `EnforceNodeDeprecation`
This is another step in the long process of removing access to global
state.
2023-03-14 16:15:30 -06:00
Kris Nuttycombe da0a9c1313 Improve const-ness of CChainParams retrieval by network ID
This change ensures that we do not return non-const CChainParams
references.
2023-03-14 16:15:30 -06:00
Jack Grigg d154cd760c wallet: Remove recipient-side `SaplingNotePlaintext::decrypt`
All recipient-side decryption now relies on `zcash_note_encryption`.
2023-03-14 21:50:31 +00:00