Commit Graph

11532 Commits

Author SHA1 Message Date
Homu 333b9a0d0b Auto merge of #3170 - ebfull:sapling-merkle-tree, r=ebfull
Sapling merkle tree implementation

Closes #3056.

Please also review https://github.com/zcash/librustzcash/pull/8

This PR:

1. Introduces ZCSaplingIncrementalMerkleTree using Pedersen hashes.
2. Adds support for Sapling anchors into consensus rules. (Adds commitments, checks anchors are correct, handles block (dis)connects, etc.)
3. Handles mempool eviction for obsolete anchors.
4. Enforces correctness of block's Sapling root field
5. Changes miner to correctly apply the Sapling root to the block header
6. Handles mempool consistency checks for anchors
2018-05-07 20:37:46 -07:00
Sean Bowe 40bfb9e5b9 Swap bit endianness of test vectors 2018-05-07 18:57:04 -06:00
Sean Bowe fcbe7eef8d Update sapling-crypto and librustzcash 2018-05-07 18:56:55 -06:00
Jack Grigg e935beb810
wallet: Make some arguments const that can be 2018-05-07 22:13:26 +01:00
Jack Grigg b87e271a9a
wallet: Change IsLockedNote to take a JSOutPoint
This removes the uint64_t -> size_t -> uint64_t round trip, as well as the
JSOutPoint -> parts -> JSOutPoint round trip.
2018-05-07 21:56:57 +01:00
Sean Bowe f6f97dfb1c Fix miner tests 2018-05-07 14:37:46 -06:00
Sean Bowe 8c57bbac15 Fix broken error messages. 2018-05-07 14:37:46 -06:00
Sean Bowe e390a475c1 Fix outdated comment 2018-05-07 14:37:46 -06:00
Sean Bowe 98d2f090ca Evict transactions with obsolete anchors from the mempool 2018-05-07 14:37:46 -06:00
Sean Bowe 673a0a79b3 Adjust tests to handle Sapling anchor cache 2018-05-07 14:37:46 -06:00
Sean Bowe 31a04d2875 Calculate the correct hashFinalSaplingRoot in the miner. 2018-05-07 14:37:46 -06:00
Sean Bowe b4ff707605 Add support for Sapling anchor checks in mempool consistency checks. 2018-05-07 14:37:46 -06:00
Sean Bowe 1f8be05b63 Add consensus support for Sapling merkle trees. 2018-05-07 14:37:46 -06:00
Sean Bowe 85b39f57bb Add `PushSaplingAnchor` 2018-05-07 14:37:46 -06:00
Sean Bowe c643ff0b51 Add support for PopAnchor(.., SPROUT/SAPLING) 2018-05-07 14:37:46 -06:00
Sean Bowe 27616b9a04 Add support for Sapling anchors in coins/txdb. 2018-05-07 14:37:46 -06:00
Sean Bowe e814be60fe Rename hashSproutAnchorEnd to hashFinalSproutRoot to be consistent. 2018-05-07 14:37:46 -06:00
Sean Bowe f2c6d214e5 Rename hashSaplingAnchorEnd to hashFinalSaplingRoot to match spec. 2018-05-07 14:37:46 -06:00
Sean Bowe 7b62078782 Remove underscores from gtest test names. 2018-05-07 14:37:46 -06:00
Sean Bowe 7703a673ea Generalize the PushAnchor implementation behavior. 2018-05-07 14:37:43 -06:00
Sean Bowe 9ea4e387b2 Generalize the PopAnchor implementation behavior. 2018-05-07 13:46:06 -06:00
Sean Bowe 18322f074c Introduce support for GetBestAnchor(SAPLING). 2018-05-07 13:46:06 -06:00
Sean Bowe 2bd59e1473 Rename PushAnchor to PushSproutAnchor. 2018-05-07 13:46:06 -06:00
Sean Bowe 008f4ee8e7 Rename GetAnchorAt to GetSproutAnchorAt. 2018-05-07 13:46:06 -06:00
Sean Bowe 8b8d70cad9 Rename DB_ANCHOR to DB_SPROUT_ANCHOR. 2018-05-07 13:46:06 -06:00
Sean Bowe 30325eebf5 Add primitive implementation of GetSaplingAnchorEnd. 2018-05-07 13:46:06 -06:00
Sean Bowe 691a3fa2e9 Rename hashReserved to hashSaplingAnchorEnd. 2018-05-07 13:46:06 -06:00
Sean Bowe 08f0728884 Rename hashAnchor to hashSproutAnchor. 2018-05-07 13:46:06 -06:00
Sean Bowe d455828fdc Specifically describe anchors as Sprout anchors. 2018-05-07 13:46:06 -06:00
Sean Bowe 28d20bdb11 Rename NullifierType to ShieldedType. 2018-05-07 13:46:06 -06:00
Sean Bowe 2f23a656fb Add regression tests and test vectors for Sapling merkle tree 2018-05-07 13:46:06 -06:00
Sean Bowe 2b002a7e60 Add implementation of Sapling merkle tree 2018-05-07 13:46:06 -06:00
Sean Bowe a7cbb8475f Abstract `uncommitted` and depth personalization for IncrementalMerkleTree. 2018-05-07 13:46:06 -06:00
Homu 1d4235dce7 Auto merge of #3239 - str4d:sapling-default-tx-version, r=str4d
Update CreateNewContextualCMutableTransaction for Sapling

Part of #3063.
2018-05-07 12:27:47 -07:00
Jack Grigg e1d41f21f3
Update tests for CreateNewContextualCMutableTransaction changes 2018-05-07 20:21:55 +01:00
Homu 265eca3f47 Auto merge of #3212 - str4d:2864-sapling-tx-size-limit, r=str4d
Raise 100kB transaction size limit from Sapling activation

Closes #2864.
2018-05-07 02:20:42 -07:00
Homu 8ef1d333b5 Auto merge of #2894 - per-gron:dont-export-unless-needed, r=str4d
Make some globals static that can be

I wrote this patch as part of making a Bazel build system but it really is independent from that so I'm putting this as a separate PR.

External linkage does not help and just encourages sloppy dependencies (ie using symbols only declared in a cpp file in some other cpp file) and can lead to weird issues when there are name collisions.
2018-05-04 15:05:43 -07:00
Jack Grigg e1dbec49b7
Add test of Sapling transaction size boundary 2018-05-04 11:17:30 +01:00
Jack Grigg 892ae945f7
Rework z_sendmany z-address recipient limit
From Sapling, the z-address recipients could require either JSDescriptions or
OutputDescriptions. Instead of trying to give an exact number in the help text,
rely on transaction size estimation to guide user behaviour.
2018-05-04 11:17:30 +01:00
Jack Grigg 25fee3509a
Rename MAX_TX_SIZE to MAX_TX_SIZE_AFTER_SAPLING 2018-05-04 11:17:30 +01:00
Jack Grigg ddcee7e13a
Benchmark the largest valid Sapling transaction in validatelargetx
11130 inputs results in a transaction between 1992301 and 2003431 bytes.
2018-05-04 11:17:30 +01:00
Jack Grigg 15ec5525e3
Raise 100kB transaction size limit from Sapling activation
Closes #2864.
2018-05-04 11:17:30 +01:00
Jack Grigg 768cd14cf9
Add missing include guard
Extracted from bitcoin/bitcoin#12757
- Commit 8fd6af89a0c061d79bb3fd2ba704b61dcc2e9211
2018-05-04 10:37:14 +01:00
Pieter Wuille 488d43dd8f
Convert base58_tests from type/payload to scriptPubKey comparison 2018-05-04 10:27:11 +01:00
Pieter Wuille 10e5357e8b
Import Bech32 C++ reference code & tests
This includes a reformatted version of the Bech32 reference code
(see https://github.com/sipa/bech32/tree/master/ref/c%2B%2B), with
extra documentation.
2018-05-04 10:27:11 +01:00
MarcoFalke 57be66d30e
[test] Remove unused code
Zcash: left createArgs() as we still have rpc_wallet_tests which uses it.
2018-05-04 10:27:11 +01:00
Homu d97bfb766b Auto merge of #3228 - str4d:3058-taddr-encoding-refactor, r=str4d
Refactor t-address encoding

Includes code cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#11117
- bitcoin/bitcoin#11259
  - Only the second commit (first is for QT code)
- bitcoin/bitcoin#11167
  - Only the first commit (the rest are not part of the t-address encoding refactor).

Part of #3058. Precursor to #3202.
2018-05-03 18:12:22 -07:00
Homu 2d1a3cf8f5 Auto merge of #3183 - bitcartel:least_authority_issue_d, r=str4d
Closes #3182 - Least Authority Issue D

Prevent undefined behaviour when null pointer is passed in as parameter to function

Includes a backport of bitcoin/bitcoin#10250.
2018-05-03 16:39:10 -07:00
Homu c7f5d5ce1c Auto merge of #3227 - str4d:3191-nullifier-macos-fix, r=str4d
Fix -Wstring-plus-int warning on clang
2018-05-03 14:36:39 -07:00
Jack Grigg 11aa594440
Remove obsolete CreateJoinSplit and GenerateParams binaries 2018-05-03 13:18:03 +01:00