Commit Graph

17619 Commits

Author SHA1 Message Date
Kris Nuttycombe 1feec6a3b4
Merge pull request #6494 from daira/examine
Improve code readability using `examine` macro
2023-04-04 16:32:04 -06:00
Kris Nuttycombe b3dbfb1ddd
Merge pull request #6527 from daira/zip317-computations
ZIP 317 preparation: fix bitrotted miner tests and add conventional fee computations
2023-04-04 16:30:51 -06:00
Kris Nuttycombe c3693a5f85
Merge pull request #6517 from miodragpop/fix-cross-win
Fix for broken cross-build to Windows target on Ubuntu 22.04 and Debian 11
2023-04-04 16:30:16 -06:00
Daira Emma Hopwood 3adf580dc0 Refactor that avoids using exceptions for local flow control and is simpler.
Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-04 22:03:27 +01:00
Kris Nuttycombe 1afd532ba8
Merge pull request #6526 from sellout/split-cxxbridge
Split C++ generated from Rust into own lib
2023-04-04 14:58:48 -06:00
Kris Nuttycombe 945e4b47ff
Merge pull request #6523 from DeckerSU/patch-insertblockindex-args
InsertBlockIndex: pass const reference on hash, instead of hash
2023-04-04 14:53:18 -06:00
Daira Emma Hopwood ac3e345689 Refactoring to avoid an unnecessary temporary.
Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-04 21:26:52 +01:00
Daira Emma Hopwood 32e1d2eeeb Refactoring to avoid duplicated code.
Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-04 21:26:52 +01:00
Daira Emma Hopwood 6bb8c60f41 Use the new `examine` macro to replace all instances of
`std::visit(match {...}, specimen)`, improving code readability.

For ease of review, this commit includes only obviously correct
transformations that all follow the same pattern.

Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-04 21:26:39 +01:00
Daira Emma Hopwood 60755efaf1 Add `examine`, a wrapper around `std::visit` that reverses the arguments.
Co-authored-by: Greg Pfeil <greg@electriccoin.co>
Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-04 21:20:10 +01:00
Kris Nuttycombe 3c4dbf86b3
Merge pull request #6500 from nuttycom/upgrade/ff_0.13
Update to use the `ff 0.13` dependency stack.
2023-04-03 21:15:48 -06:00
Daira Emma Hopwood d55d12d6e2 Add audits for updates to futures-* 0.3.28 and redjubjub 0.7.0.
Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-04 02:06:48 +01:00
Daira Emma Hopwood ff49b812da `cargo update`
Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-04 02:06:48 +01:00
Kris Nuttycombe 3b0f6ad3ab
Merge pull request #6525 from sellout/makefile-editorconfig
Correct EditorConfig for Makefiles
2023-04-03 18:55:59 -06:00
Greg Pfeil 1aac7c0c32
Split C++ generated from Rust into own lib
This allows us to compile it with different flags. In particular, there are
warnings we can’t easily fix in the generated code.
2023-04-03 18:09:30 -06:00
Sean Bowe fccdb03c53 Add additional audits. 2023-04-03 16:41:07 -06:00
Kris Nuttycombe 43a0fe237e Update to use the `ff 0.13` dependency stack. 2023-04-03 16:33:06 -06:00
Daira Emma Hopwood 4fd3493291 Implement ZIP 317 computations.
Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
2023-04-03 23:05:50 +01:00
Greg Pfeil 8de607322e
Correct EditorConfig for Makefiles
It was deciding to convert tabs to spaces on save, which isn’t great.
2023-04-03 13:30:59 -06:00
DeckerSU 78804dd438
InsertBlockIndex: pass const reference on hash, instead of hash
InsertBlockIndex should take a const reference to a uint256 instead of
just a uint256.

LoadBlockIndexGuts also assume std::function<CBlockIndex*(const uint256&)> insertBlockIndex
as an argument:

2d456afebe/src/txdb.h (L150)
2023-04-02 23:00:08 +02:00
Greg Pfeil 6e42aaeed6
Update release-notes for transparent change restriction
Co-authored-by: Kris Nuttycombe <kris@nutty.land>
2023-04-01 22:59:33 -06:00
Greg Pfeil 1786c60677
Require `AllowRevealedRecipients` for t-change 2023-04-01 22:58:52 -06:00
Miodrag Popović e276f07349
Update depends/hosts/mingw32.mk to use posix variant library path
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2023-04-01 11:51:36 +02:00
Kris Nuttycombe 2d456afebe
Merge pull request #6408 from sellout/wallet_tx_builder/lock-notes
Lock notes (except Orchard) in wallet_tx_builder
2023-03-31 18:05:06 -06:00
Greg Pfeil 342563eb48
Merge pull request #6352 from sellout/deterministic-rpc-tests
Make RPC test output more deterministic
2023-03-30 14:33:03 -06:00
Greg Pfeil 69ab52cb3e
Improve Doxygen for note locking 2023-03-30 14:22:34 -06:00
Miodrag Popović e6372f4f1f Fix for broken cross-build to Windows target on Ubuntu 22.04 and Debian 11 2023-03-30 11:02:24 +02:00
Kris Nuttycombe 564ef2a3ac
Merge pull request #6502 from rex4539/typos
Fix typos
2023-03-29 22:23:33 -06:00
Kris Nuttycombe 06f4525bc1
Merge pull request #6410 from sellout/wallet_tx_builder/refactor-privacy-policy
Refactor RPC privacyPolicy handling
2023-03-29 18:39:11 -06:00
Greg Pfeil 06553d1399
Lock notes (except Orchard) in wallet_tx_builder
This fixes an RPC test failure that tests specifically for this with
z_shieldcoinbase. This also exposed an issue where an overly-high fee resulted
in a negative Payment causing an exception too deep. Added an assert when
creating a Payment and guarded against it for z_shieldcoinbase.

Fixes #2621 and #5654 (but does not handle Orchard locking, which is tracked in
a separate issue).
2023-03-29 16:59:43 -06:00
Kris Nuttycombe f60d2c71e7
Refactor RPC privacyPolicy handling
Extracted from z_sendmany to be used across multiple transaction
operations. Previously, it also checked a `bool` to decide what “LegacyCompat”
means, but bools are too easy to concoct, so it now expects the sender and
recipients to be checked internally. Also, z_sendmany was generating the bool
only from the sender, illustrating how easy it is to miss something when you try
to precompute.
2023-03-29 16:56:20 -06:00
Dimitris Apostolou fdae3213ac Fix typos 2023-03-29 13:40:48 -06:00
Kris Nuttycombe 4892bf327d
Merge pull request #6470 from sellout/error-on-tmemos
Improve taddr no-memo check.
2023-03-29 09:17:23 -06:00
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