Commit Graph

16622 Commits

Author SHA1 Message Date
Jack Grigg d5a271c7a4 Add bundle kind to `BundleValidityCache` initialization log message 2022-07-13 22:41:56 +00:00
Jack Grigg 087c85ec03 Cache Sapling and Orchard bundle validation
This adds two new CuckooCaches in validation, each caching whether all
of a transaction bundle's proofs and signatures were valid.

Bundles which match the validation cache never have proofs or signatures
added to the batch validators. For blocks where all transactions have
been previously observed in the mempool, the final validation of the
batches should be a no-op.

Part of zcash/zcash#6049.
2022-07-13 15:49:37 +00:00
Kris Nuttycombe 882935e35e
Merge pull request #5065 from str4d/merkle-backports
Bitcoin 0.12 Merkle tree PRs
2022-07-12 16:54:28 -06:00
Kris Nuttycombe cc9449f905
Merge pull request #5066 from str4d/cuckoocache
Replace SigCache implementation with CuckooCache
2022-07-12 15:41:05 -06:00
str4d 4ae67b01f6
Merge pull request #6070 from str4d/wallet-useful-atmp-error
Return useful error message on ATMP failure
2022-07-12 02:59:31 +01:00
instagibbs 52ae7dbb90 Return useful error message on ATMP failure
Zcash: Excludes changes to QT wallet, includes our own uses of
CommitTransaction.

(cherry picked from commit bitcoin/bitcoin@169bdabe14)
2022-07-11 23:34:48 +00:00
Jack Grigg 8e1fc6839d lint: Fix include guards 2022-07-08 22:24:26 +00:00
Pieter Wuille ef5a37138e Switch blocks to a constant-space Merkle root/branch algorithm.
This switches the Merkle tree logic for blocks to one that runs in constant (small) space.
The old code is moved to tests, and a new test is added that for various combinations of
block sizes, transaction positions to compute a branch for, and mutations:
 * Verifies that the old code and new code agree for the Merkle root.
 * Verifies that the old code and new code agree for the Merkle branch.
 * Verifies that the computed Merkle branch is valid.
 * Verifies that mutations don't change the Merkle root.
 * Verifies that mutations are correctly detected.

(cherry picked from commit bitcoin/bitcoin@eece63fa72)
2022-07-08 22:24:23 +00:00
Pieter Wuille a8086dd41f Add merkle.{h,cpp}, generic merkle root/branch algorithm
(cherry picked from commit bitcoin/bitcoin@ee60e5625b)
2022-07-08 22:24:19 +00:00
Pieter Wuille 542fcfe69d Avoid duplicate CheckBlock checks
(cherry picked from commit bitcoin/bitcoin@3b33ec85ed)
2022-07-08 21:03:40 +00:00
Pieter Wuille 204d0c37ab Do not store Merkle branches in the wallet.
Assume that when a wallet transaction has a valid block hash and transaction position
in it, the transaction is actually there. We're already trusting wallet data in a
much more fundamental way anyway.

To prevent backward compatibility issues, a new record is used for storing the
block locator in the wallet. Old wallets will see a wallet file synchronized up
to the genesis block, and rescan automatically.

(cherry picked from commit bitcoin/bitcoin@391dff16fe)
2022-07-08 21:03:40 +00:00
Dan Raviv 7498c60341 Fix header guards using reserved identifiers
Identifiers beginning with an underscore followed immediately by an uppercase letter are reserved.

(cherry picked from commit bitcoin/bitcoin@bc70ab5dff)

Zcash: We merged the other half of this in zcash/zcash@36463d42c0.
2022-07-08 21:01:14 +00:00
Jeremy Rubin 8e053da3ee Deduplicate SignatureCacheHasher
This moves the SignatureCacheHasher to the sigcache header, out of the anonymous
namespace, so that the tests can import it.

(cherry picked from commit bitcoin/bitcoin@f9c88079df)
2022-07-08 21:01:14 +00:00
Jeremy Rubin 1fee91e4e7 Decrease testcase sizes in cuckoocache tests
(cherry picked from commit bitcoin/bitcoin@3f098cccf6)
2022-07-08 21:01:14 +00:00
Hennadii Stepanov 6c0861321e Use correct C++11 header for std::swap()
(cherry picked from commit bitcoin/bitcoin@98fbd1cdff)
2022-07-08 21:01:14 +00:00
Jon Layton d012fbf3fa doc: Doxygen-friendly CuckooCache comments
(cherry picked from commit bitcoin/bitcoin@7aad3b68e7)
2022-07-08 21:01:14 +00:00
practicalswift 43693df86d Use explicit casting in cuckoocache's compute_hashes(...) to clarify integer conversion
(cherry picked from commit bitcoin/bitcoin@9142dfea81)
2022-07-08 21:01:14 +00:00
Gregory Maxwell ee2f764630 Add an explanation of quickly hashing onto a non-power of two range.
In Olaoluwa Osuntokun's recent protocol proposal they were using a
 mod in an inner loop.  I wanted to suggest a normative protocol
 change to use the trick we use here, but to find an explanation
 of it I had to dig up the PR on github.  After I posted about it
 several other developers commented that it was very interesting
 and they were unaware of it.

I think ideally the code should be self documenting and help
 educate other contributors about non-obvious techniques that
 we use.  So I've written a description of the technique with
 citations for future reference.

(cherry picked from commit bitcoin/bitcoin@dd869c60ca)
2022-07-08 21:01:14 +00:00
Pieter Wuille d0a12fdbde Allow non-power-of-2 signature cache sizes
(cherry picked from commit bitcoin/bitcoin@7482781347)
2022-07-08 21:01:14 +00:00
Jeremy Rubin 090ea700ac Add unit tests for the CuckooCache
SQUASHME: Update Tests for other SQUASHMEs

(cherry picked from commit bitcoin/bitcoin@67dac4e193)
2022-07-08 21:01:14 +00:00
Jeremy Rubin cebf89c7a7 Add CuckooCache implementation and replace the sigcache map_type with it
SQUASHME: Change cuckoocache to only work for powers of two, to avoid mod operator
SQUASHME: Update Documentation and simplify logarithm logic
SQUASHME: OSX Build Errors
SQUASHME: minor Feedback from sipa + bluematt
SQUASHME: DOCONLY: Clarify a few comments.

(cherry picked from commit bitcoin/bitcoin@c9e69fbf39)
2022-07-08 21:01:11 +00:00
str4d 050133358b
Merge pull request #6059 from superbaud/smoketest-minconf
Update smoke_test.py to compensate for changes in minimum confirmations required
2022-07-08 20:08:02 +01:00
Kris Nuttycombe ee3055f596
Merge pull request #6064 from zcash/version-5.1.0
Merge 5.1.0 stablilization branch back into the main branch
2022-07-08 08:14:59 -06:00
str4d f8e9fa4b9e
Merge pull request #6063 from zcash/release-v5.1.0
Release v5.1.0
2022-07-08 13:49:51 +01:00
Jack Grigg dda0f79277 doc: Add `decoderawtransaction` to 5.1.0 release notes 2022-07-08 10:27:04 +00:00
Jack Grigg 4d7ce75ef1 make-release.py: Updated release notes and changelog for 5.1.0. 2022-07-08 03:01:54 +00:00
Jack Grigg d79b6ca209 make-release.py: Updated manpages for 5.1.0. 2022-07-08 03:01:54 +00:00
Jack Grigg 13d1a3fc6a make-release.py: Versioning changes for 5.1.0. 2022-07-08 02:52:02 +00:00
Jack Grigg 884c149c64 qa: Postpone latest `cxx` update 2022-07-08 02:51:43 +00:00
Jack Grigg c1b40ec2a8 Add missing release note entries for 5.1.0 2022-07-08 02:47:34 +00:00
str4d b5e3c0b3fe
Merge pull request #6060 from str4d/comment-out-slow-assertion
wallet: Comment out slow assertion
2022-07-08 03:29:13 +01:00
Jack Grigg acfd757e58 wallet: Comment out slow assertion
This particular assertion has a large fixed cost per block on current
mainnet (and has done since shortly after NU5 activation), but we
haven't figured out what is causing the performance hit. It is only a
consistency check, and commenting it out decreases single-account rescan
times by around 6% on a Ryzen 9 5950X.

Part of zcash/zcash#6052.
2022-07-08 00:22:51 +00:00
sasha b72aaab820 Patch smoke_tests.py to require 4 confirmations for z_mergetoaddress 2022-07-07 01:22:40 -07:00
sasha 823c1b44c5 Improve smoke_test.py wait_for_balance message in the minconf!=1 case 2022-07-06 23:23:44 -07:00
sasha 61dd95ef0b Patch smoke_tests.py to properly handle changes in minconf behavior 2022-07-06 22:58:03 -07:00
ebfull 0766e22bdd
Merge pull request #6057 from str4d/gbt-skip-proofs-and-signatures
miner: Disable proof and signature checks in CreateNewBlock
2022-07-06 15:25:01 -06:00
Jack Grigg 5230c9f2f4 miner: Disable proof and signature checks in CreateNewBlock
The only source of transactions for `CreateNewBlock` is the mempool, and
every transaction added to the mempool goes through `AcceptToMemoryPool`
which checks proofs and signatures.

We maintain the ability to enable these checks in `TestBlockValidity`
because it is also used in an (undocumented) `getblocktemplate` mode to
check a proposed block (minus PoW), where we cannot assume the
transactions are valid.

Co-authored-by: Kris Nuttycombe <kris@nutty.land>
2022-07-06 19:38:15 +00:00
Kris Nuttycombe e03b964abf
Merge pull request #6043 from nuttycom/backport/14555-move_util_files_to_dir
scripted-diff: Move util files to separate directory.
2022-07-06 12:00:14 -06:00
str4d 606e5ed134
Merge pull request #6055 from str4d/wallet-updatedtransaction-softlock-fix
Move "previous coinbase" UI monitoring into ThreadNotifyWallets
2022-07-06 17:26:15 +01:00
Kris Nuttycombe 71b6a59ec3 scripted-diff: Move utiltest to src/util
-BEGIN VERIFY SCRIPT-
git mv src/utiltest.h src/util/test.h
git mv src/utiltest.cpp src/util/test.cpp
sed -i -e 's/"utiltest\.h"/"util\/test\.h"/g' $(git ls-files 'src/*.h' 'src/*.cpp')
sed -i -e 's/ZCASH_UTILTEST_H/ZCASH_UTIL_TEST_H/g' src/util/test.h
sed -i -e 's/utiltest\.\(h\|cpp\)/util\/test\.\1/g' src/Makefile.am
-END VERIFY SCRIPT-
2022-07-06 10:25:28 -06:00
str4d 904528997a
Merge pull request #6054 from nuttycom/bug/6044-null_block_pos
Ensure that the node has position information before attempting to read block data.
2022-07-06 15:52:42 +01:00
Jack Grigg e8a7b7253a Move "previous coinbase" UI monitoring into ThreadNotifyWallets
When the wallet notification logic was moved into a separate thread,
most wallet notifications were transferred across. This one was missed,
and it is particularly pernicious: all it does is ask the wallet to tell
the UI that a particular transaction had been updated. We don't actually
_have_ any UI connected in zcashd, but there is a side-effect: the
callback blocks on acquiring `cs_wallet`, in the main thread that
already holds `cs_main`. For particularly large wallets, this can cause
the main thread to block on `ThreadNotifyWallets`, which in turn means
that anything waiting on `cs_main` (e.g. RPC calls) is blocked.

We solve this by moving the callback into `ThreadNotifyWallets`. We
don't technically need it for `zcashd`, but we maintain it in case a
downstream fork has reconnected a UI.
2022-07-06 00:21:49 +00:00
sasha 903f5f9269
Merge pull request #6053 from zcash/release-v5.1.0-rc1
Release v5.1.0-rc1
2022-07-05 17:11:20 -07:00
Kris Nuttycombe d9c5326f17 Ensure that the node has position information before attempting to read block data. 2022-07-05 17:24:39 -06:00
sasha eb43bc5c02 make-release.py: Updated release notes and changelog for 5.1.0-rc1. 2022-07-05 22:25:25 +00:00
sasha 14b3c21f4a make-release.py: Updated manpages for 5.1.0-rc1. 2022-07-05 22:25:25 +00:00
sasha 1d996a080b make-release.py: Versioning changes for 5.1.0-rc1. 2022-07-05 22:11:55 +00:00
Jack Grigg 343ddc1752 qa: Add native_cxxbridge and rustcxx to update checker 2022-07-05 21:45:59 +00:00
Jack Grigg cb5a4acca9 Update release notes 2022-07-05 21:36:45 +00:00
Jack Grigg 2e6a6572ba qa: Postpone dependency updates 2022-07-05 20:43:26 +00:00