Commit Graph

15423 Commits

Author SHA1 Message Date
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
Jack Grigg 2d0a8f1f3a test: Check for valid hashBlockCommitments construction post-NU5 2021-06-18 01:05:04 +01:00
Jack Grigg bd4c0a8515 ZIP 244 hashBlockCommitments implementation
We will start storing two new hashes in the block index from v4.5.0:
- hashAuthDataRoot
- hashFinalOrchardRoot
2021-06-18 01:05:04 +01:00
Jack Grigg 4da2347e96 Rename hashLightClientRoot to hashBlockCommitments in block header 2021-06-18 01:05:04 +01:00
Homu 52cffbc828 Auto merge of #5226 - nuttycom:add_orchard_h, r=ebfull
Move OrchardBundle to its own header file.

This is a prerequisite to the incremental merkle tree
work that otherwise would need to introduce a cyclic
dependency on transaction.h.
2021-06-17 20:04:30 +00:00
Kris Nuttycombe 2a2d87bac4 Move OrchardBundle to its own header file.
This is a prerequisite to the incremental merkle tree
work that otherwise would need to introduce a cyclic
dependency.
2021-06-17 12:37:04 -06:00
Homu 5646dc7b5d Auto merge of #5219 - nuttycom:tx_authdata_prev5_hash, r=str4d
Update transaction auth commitments for pre-v5 transactions.

As specified in https://github.com/zcash/zips/pull/520

Fixes #5218
2021-06-16 01:13:27 +00:00
Homu 464657a426 Auto merge of #5221 - str4d:book-dev-rust, r=str4d
book: Add dev guide page about Rust dependencies
2021-06-15 23:48:56 +00:00
Homu eb8dac51a8 Auto merge of #5222 - str4d:net_tests-nondeterminism, r=str4d
Remove non-determinism which is breaking net_tests

Cherry-picked from bitcoin/bitcoin#8070.
2021-06-15 22:52:05 +00:00
Ethan Heilman 9fcb2f3936 Fix typo adddrman to addrman as requested in #8070
(cherry picked from commit 2a8b3589b5a6c0863012329ddb40e7d901decf0e)
2021-06-15 23:35:39 +01:00
EthanHeilman 3c54231da6 Remove non-determinism which is breaking net_tests #8069
(cherry picked from commit f4119c6c988ea24a5218aa6bc67e57e47e051547)
2021-06-15 23:35:31 +01:00
str4d cd51c591ef
book: Note that cargo patches work with absolute paths 2021-06-15 21:55:55 +01:00
Jack Grigg 292f830509 book: Add dev guide page about Rust dependencies 2021-06-15 20:59:18 +01:00