Add a call to SetupNetworking in BasicTestingSetup
In issue https://github.com/zcash/zcash/issues/3668 , the error code returned by `getaddrinfo_a` (10093) is `WSANOTINITIALISED`:
> Successful WSAStartup not yet performed. Either the application has not called WSAStartup or WSAStartup failed. The application may be accessing a socket that the current active task does not own (that is, trying to share a socket between tasks), or WSACleanup has been called too many times.
https://docs.microsoft.com/en-us/windows/desktop/winsock/windows-sockets-error-codes-2
`WSAStartup` is called from the `SetupNetworking` function in `util.cpp`, but `SetupNetworking` was not being called during test setup. This pull request adds that call.
Here is a gitlab pipeline running tests in the `test_bitcoin.exe` executable before this change:
https://gitlab.com/charlieok/zcash/pipelines/36483478
...and here is the same set of tests run after this change:
https://gitlab.com/charlieok/zcash/pipelines/36485098
Update IncrementalMerkleTree test vectors to use valid commitments
The original commitments were SHA256 outputs, and some were outside the
scalar field. This didn't affect the Merkle hash, which drops the high
bit from each commitment, but it does affect the creation of the Merkle
path in Rust, which requires path nodes to be valid scalars.
Here, we explicitly drop the high bit of all test vector commitments,
as well as reducing the two that remain outside the field. The test
vectors still pass, and can now also be used in the Rust implementation.
Add clarifying text for parameter size
Addresses #3648.
Parameter size was previously specified to the nearest MB so not sure if 1.7GB/800MB is not specific enough? The true figures on disk are 1647MB and 777MB.
Save and restore current_path in TestingSetup constructor/destructor
In issue https://github.com/zcash/zcash/issues/3653 , the affected tests change their current working directory to a temporary directory that is created in the TestingSetup constructor and deleted in the destructor. In Windows it seems to cause a problem when a process attempts to delete its current working directory.
This change fixes the issue by saving the path of the current working directory in the constructor, and restoring the working directory to that path in the destructor before deleting the temporary directory.
3604 fix sapling default memo - 0xF6 plus zeros
Closes#3604. For Sapling outputs, set the default memo to `no_memo` instead of all zeros. (See section 5.5 of the Sapling protocol specification.)
Closes#3329. Send alert to put non-Sapling nodes into safe mode.
The alert targets nodes running protocol version <= 170006.
Sapling compatible nodes run protocol version >= 170007.
The only upstream change relative to the previous commit is that the
various Zcash-specific dependencies have been pulled into a cargo
workspace. The dependecies in the workspace use the same commits as the
crates we had previously vendored.
The patches are necessary to handle the fact that cargo requires that
dev dependencies are available even if not used, and we would otherwise
need to vendor all the underlying crates.
Fix potentially misleading test failures
This is in response to https://github.com/zcash/zcash/pull/3590#discussion_r224677644
Currently statements such as:
```assert_equal("Embarassment", "Embarrassment", "Misspelling detected")```
Will produce essentially the following error:
```
Assertion failed: Misspelling detected; expected: <Embarassment> but was: <Embarrassment>
File "/home/eirik/Development/zcash/qa/rpc-tests/test_framework/test_framework.py", line 121, in main
self.run_test()
File "/home/eirik/Development/zcash/qa/rpc-tests/test_spelling.py", line 13, in run_test
```
Which is misleading because the item on the left is not what is actually expected.
This PR changes the assertion failure to be displayed as:
```
Assertion failed: (left == right); Misspelling detected
left: <Embarassment>
right: <Embarrassment>
File "/home/eirik/Development/zcash/qa/rpc-tests/test_framework/test_framework.py", line 121, in main
self.run_test()
File "/home/eirik/Development/zcash/qa/rpc-tests/test_spelling.py", line 13, in run_test
```
Closes#3467. Add benchmarks for Sapling spends and outputs.
Four new benchmarks are added to RPC zcbenchmark:
- createsaplingspend
- createsaplingoutput
- verifysaplingspend
- verifysaplingoutput
Remove GetUnspentFilteredNotes
Closes#3580
This PR generalized `GetFilteredNotes`, expanding its functionality to also do what we do in `GetUnspentFilteredNotes`. This enables us to remove the latter.
Make it clear that CWallet::GenerateNewZKey is Sprout specific
Closes https://github.com/zcash/zcash/issues/3577
When adding sapling support we had considered making the method `GenerateNewZKey` generic, but it ended up making more sense to add a second method `GenerateNewSaplingZKey` for sapling support.
This PR changes the name of `GenerateNewZKey` to `GenerateNewSproutZKey` and changes the return type from `libzcash::PaymentAddress` to `libzcash::SproutPaymentAddress` to make it more clear that this is what the method does.
Clarify in sendmany/z_sendmany rpc docs that amounts are not FP
Fixes#3539
I clarified in the docs that only 8 digits of precision are allowed. For example, if you try 9 digits you will get:
```
zcash-cli z_sendmany $TADDR "[{\"address\":\"$ZADDR\",\"amount\":0.123456789}]"
error code: -3
error message:
Invalid amount
```