Commit Graph

15335 Commits

Author SHA1 Message Date
Kris Nuttycombe 52568f58a8 Ensure Sapling versions are valid after NU5 2021-07-01 12:41:25 +01:00
Larry Ruane 66de454a20 ZIP 225: v5 transaction check rules 2021-07-01 12:41:25 +01:00
Homu c3fe01200b Auto merge of #5235 - str4d:tx-dynamic-usage, r=str4d
Include Orchard bundle in transaction dynamic usage

This was missed in #5202.
2021-06-29 14:07:06 +00:00
Jack Grigg 8ad7371800 Include Orchard bundle in transaction dynamic usage 2021-06-29 15:05:46 +01:00
Homu 52e3a74a75 Auto merge of #5233 - nuttycom:feature/orchard_merkle, r=str4d
Implement Orchard commitment tree logic.
2021-06-29 12:18:18 +00:00
Jack Grigg d72f722915 test: Update CCoinsViewTest with changes to CCoinsView interface
I just LOVE how C++ didn't complain that the changes to the virtual
method APIs didn't cause any compilation errors for the tests...
2021-06-29 03:34:08 +01:00
Kris Nuttycombe 3251f0c935
Apply suggestions from code review
Co-authored-by: str4d <jack@electriccoin.co>
2021-06-28 17:56:57 -06:00
Kris Nuttycombe 0d40ea8494 Add Orchard nullifiers to nullifiers cache. 2021-06-28 17:43:23 -06:00
Kris Nuttycombe f9d823726c Add consensus check for duplicate Orchard nullifiers within a single transaction. 2021-06-28 17:37:32 -06:00
Kris Nuttycombe 572719fca6 Apply suggestions from code review
Use const pointers wherever possible.

Co-authored-by: str4d <jack@electriccoin.co>
2021-06-28 17:37:32 -06:00
Kris Nuttycombe 8fbc84842b Document source of Orchard merkle tree test data. 2021-06-28 16:40:11 -06:00
Kris Nuttycombe 5550dbe1b8 Fix implmentation of OrchardMerkleTree.DynamicMemoryUsage 2021-06-28 16:33:40 -06:00
Kris Nuttycombe 8ee8c9f6ab Consistently panic on null commitment tree pointers.
Orchard commitment tree pointers should never be null.
2021-06-28 15:27:21 -06:00
Kris Nuttycombe d46dbd9ea4 Apply style suggestions. 2021-06-28 14:49:39 -06:00
Kris Nuttycombe d533d3ccbf Fix header guards for incremental_sinsemilla_tree.h 2021-06-28 13:54:15 -06:00
Kris Nuttycombe 60f58890ec Fix Orchard incremental Merkle tree empty root. 2021-06-28 13:54:15 -06:00
Kris Nuttycombe 4b36b6fc20 Apply suggestions from code review
Co-authored-by: str4d <jack@electriccoin.co>
2021-06-28 13:54:15 -06:00
Kris Nuttycombe a3214285c2 Apply suggestions from code review
Co-authored-by: str4d <jack@electriccoin.co>
2021-06-28 13:54:15 -06:00
Kris Nuttycombe 34f192b8f0 Update to released version of incrementalmerkletree 2021-06-28 09:56:05 -06:00
Kris Nuttycombe ecec1f9769 Update orchard dependency. 2021-06-24 11:53:30 -06:00
Kris Nuttycombe 0a1e845681 Documentation cleanup. 2021-06-23 16:17:53 -06:00
Kris Nuttycombe 13fd4c9a1c Add Orchard merkle tree anchor tests. 2021-06-23 16:06:30 -06:00
Kris Nuttycombe 9569bfc291 Add Orchard bundle commitments to merkle tree. 2021-06-23 16:06:30 -06:00
Kris Nuttycombe 0c1a5878ad Check nullifiers length against bundle actions length. 2021-06-23 16:06:30 -06:00
Kris Nuttycombe fd34ecc64d Return std::optional for GetAnchor 2021-06-23 16:06:30 -06:00
Kris Nuttycombe 437b8c488a Orchard changes to coins & consensus. 2021-06-23 16:06:30 -06:00
Kris Nuttycombe 68ce7e4828 Implement the Rust side of the incremental merkle tree FFI. 2021-06-23 16:06:30 -06:00
Homu 0247c0c682 Auto merge of #5232 - str4d:5195-orchard-proof-verification, r=str4d
Check Orchard bundle-specific consensus rules, i.e. proofs

This obviously doesn't check the correct proofs yet, but this adds the consensus rule machinery so that when the circuit is implemented, we just need to upgrade the `orchard` dependency.

Closes zcash/zcash#5195.
2021-06-21 17:42:06 +00:00
Jack Grigg 1072cd4e3e Check Orchard bundle-specific consensus rules, i.e. proofs
We are already checking the other bundle-specific consensus rules:
- Encodings are checked during transaction parsing.
- Signatures are batch-validated.

Closes zcash/zcash#5195.
2021-06-21 18:33:57 +01:00
Jack Grigg 9ad5b75b30 rust: Load Orchard circuit parameters at startup 2021-06-21 18:33:57 +01:00
Homu 785803382a Auto merge of #5228 - str4d:orchard-pool-tracking, r=str4d
Orchard pool tracking

Includes the ZIP 209 update to enforce the Orchard pool never being negative.
2021-06-21 16:09:57 +00:00
str4d 86ac3e12f0
Minor fixes to documentation and formatting
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-06-21 17:08:22 +01:00
Jack Grigg 509e7c7d79 Implement Orchard pool value tracking
The ZIP 209 rules preventing the Sprout and Sapling pool values from
going negative, are extended to the Orchard pool.
2021-06-21 01:40:49 +01:00
Homu 9253e2828e Auto merge of #5227 - str4d:v2-history-tree, r=str4d
Integrate V2 history tree

Closes #5037.
2021-06-20 22:26:04 +00:00
Jack Grigg e89f93ff85 test: Add test case for popping from an empty history tree 2021-06-20 22:48:10 +01:00
Jack Grigg 3efa9cb75e rust: Document some requirements for history tree FFI methods 2021-06-20 22:42:58 +01:00
Jack Grigg 62dce234be rpc: Document getblock RPC finalorchardroot field, omit before NU5 2021-06-20 22:33:13 +01:00
str4d 92d6984842
test: Cleanups to ZIP 221 Python test code
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
2021-06-20 21:25:59 +01:00
Jack Grigg a18f8b58a9 test: Check history trees across Canopy and NU5 activations 2021-06-18 12:56:19 +01:00
Jack Grigg 16317bc6af Use V2 history trees from NU5 onward 2021-06-18 12:35:53 +01:00
Jack Grigg 66e2baa6da test: Use valid consensus branch IDs in history tree tests 2021-06-18 12:35:53 +01:00
Jack Grigg b1d3335ef6 rust: Move history tree FFI declarations into a separate header 2021-06-18 12:35:53 +01:00
Jack Grigg 3192820dbc rust: Migrate to zcash_history with versioned trees 2021-06-18 12:35:53 +01:00
Jack Grigg fbeb9412f2 rust: Move history tree FFI logic into a module 2021-06-18 12:35:53 +01:00
Homu b0e6119551 Auto merge of #5220 - str4d:5197-header-commitments, r=str4d
NU5 header commitments and consensus rules

Part of zcash/zcash#5197.
2021-06-18 10:24:28 +00:00
Jack Grigg 2d0b8b0da4 Copy authDigest in CTransaction::operator=(const CTransaction &tx)
This missing was causing `hashBlockCommitments` to be incorrectly computed
in mined blocks, due to the specific way the coinbase transaction gets
constructed. This went unnoticed when the default `authDigest` for legacy
transactions was the null hash, but was exposed when that changed to
`[0xFF; 32]`.
2021-06-18 11:20:29 +01:00
Jack Grigg 982c391871 ConnectBlock: Check NU activation when deriving block commitments
We compute block commitments ahead of their usage to avoid deriving them
multiple times. However, we only want to derive them for blocks if they
are needed; in particular, deriving hashChainHistoryRoot prior to
Heartwood activation can result in an invalid empty tree being generated.
2021-06-18 01:05:04 +01:00
Jack Grigg 9930a27992 test: Check hashBlockCommitments before, at, and after NU5 activation 2021-06-18 01:05:04 +01:00
str4d da8fcedd4d Improve docs about setting CBlockIndex hash fields
These fields have documented invariants, but comments in AddToBlockIndex are useful for review.
2021-06-18 01:05:04 +01:00
Jack Grigg d7a517465b Skip hashBlockCommitments check when testing block templates
Both hashMerkleRoot and hashAuthDataRoot are not set by the block
template, and hashAuthDataRoot is an input to hashBlockCommitments.
2021-06-18 01:05:04 +01:00