Commit Graph

523 Commits

Author SHA1 Message Date
Jane Lusby 2095b4f0d3 state: insert into nullifier trees 2020-10-29 09:58:56 -07:00
teor 9667ee650f Run deserialize_blockheader on every test vector 2020-10-28 21:24:28 -04:00
teor 456842aa86 Run the equihash tests on every block test vector 2020-10-28 21:24:28 -04:00
Alfredo Garcia bcb027ebc5 change canopy.pdf to stable protocol.pdf 2020-10-28 11:34:53 -04:00
teor d745d2b47c
Stop assuming Mainnet in Address From impls (#1191) 2020-10-22 07:58:52 +10:00
Alfredo Garcia 21ad6ffc47
Reverse displayed endianness of transaction and block hashes (#1171)
* Reverse displayed endianness of transaction and block hashes
* fix zebra-checkpoints utility for new hash order
* Stop using "zebrad revhex" in zebrad-hash-lookup
* Rebuild checkpoint lists in new hash order
This change also adds additional checkpoints to the end of each list.

* Replace TransactionHash with transaction::Hash
This change should have been made in #905, but we missed Debug impls
and some docs.

Co-authored-by: Ramana Venkata <vramana@users.noreply.github.com>
Co-authored-by: teor <teor@riseup.net>
2020-10-22 07:54:02 +10:00
Deirdre Connolly eb56666d30 chain: add ShieldedData::binding_verification_key() 2020-10-20 11:16:22 -04:00
Deirdre Connolly 5a78bbb6c9 Add nullifiers(), and note_commitments() to ShieldedData 2020-10-20 11:16:22 -04:00
Deirdre Connolly f9de91716c Add docstrings for sighash 2020-10-20 11:16:22 -04:00
Deirdre Connolly db54a623b7 Export sighash::HashType 2020-10-20 11:16:22 -04:00
teor efb9bfa5de
Merge pull request #1165 from teor2345/difficulty-tidy
Tidy some difficulty code
2020-10-16 06:50:08 +10:00
teor de04e76564 Reduce the equihash proptest run time
Reduce the default number of cases run by the equihash proptests,
so they run in under 10 seconds on my machine.

Set the PROPTEST_CASES env var to override the default.
2020-10-16 06:49:43 +10:00
teor c3a8fd3894 Check PoWLimit for difficulty threshold 2020-10-15 08:31:18 +10:00
teor 00de709dd8 impl From<U256> for ExpandedDifficulty 2020-10-15 08:31:18 +10:00
teor 407962b864 Rename any remaining is_time_valid_at instances
Automated search and replace, using the script:

sed -i 's/is_time_valid_at/time_is_valid_at/' \
    $(grep -r is_time_valid_at zebra* | cut -d: -f1 | sort -u)
2020-10-13 08:11:11 +10:00
teor d504232720 Apply error and span suggestions
Co-authored-by: Jane Lusby <jlusby42@gmail.com>
2020-10-13 08:11:11 +10:00
teor c4630cd1f5 Improve error messages for header.time validation 2020-10-13 08:11:11 +10:00
teor 77e227dfe4 Fix some function docs and parameter names 2020-10-13 08:11:11 +10:00
Alfredo Garcia c0a14ecc8c
move genesis parameters to zebra-chain (#1151) 2020-10-12 14:08:23 -07:00
Alfredo Garcia c93f0b3a2e
Block Subsidy and Founders Reward Amounts (#1051)
* add general and founders reward subsidy modules
* validate founders reward
* Use funding streams after Canopy on testnet
ZIP-1014 only applies to mainnet, where Canopy is at the first halving.
On testnet, Canopy is before the first halving, and the dev fund rules
apply from Canopy. (See ZIP-214.)
Co-authored-by: teor <teor@riseup.net>
Co-authored-by: Jane Lusby <jlusby42@gmail.com>

* pass all test vectors through current subsidy validation
* Add testnet and halving subsidy tests
* add subsidy validation error tests

* rename block validation methods
* add network to block verifier

* add amount operators
* Implement Ord, Eq, and Hash for Amount
* Implement Add<Height> for Height
And make the existing Height operators do range checks.
* Apply operator suggestions
Co-authored-by: Jane Lusby <jlusby42@gmail.com>
2020-10-13 06:54:48 +10:00
Jane Lusby 855f9b5bcb
Implement MVP of NonFinalizedState and integrate it with the state service (#1101)
* implement most of the chain functions
* implement fork
* fix outpoint handling in Chain struct
* update expect for work
* split utxo into two sets
* update the Chain definition
* remove allow attribute in zebra-state/lib.rs
* merge ChainSet type into MemoryState
* Add error messages to asserts
* export proptest impls for use in downstream crates
* add testjob for disabled feature in zebra-chain
* try to fix github actions syntax
* add module doc comment
* update RFC for utxos
* add missing header
* working proptest for Chain
* propagate back results over channel
* Start updating RFC to match changes
* implement queued block pruning
* and now it syncs wooo!
* remove empty modules
* setup config for proptests
* re-enable missing_docs lint
* update RFC to match changes in impl
* add documentation
* use more explicit variable names
2020-10-08 13:07:32 +10:00
Deirdre Connolly 8b8ef6dc4d Remove extra Sum impl 2020-10-07 01:29:08 -04:00
Deirdre Connolly cc44711204 Impl<'a> Sub<&'a ValueCommitment> for ValueCommitment 2020-10-07 01:29:08 -04:00
Deirdre Connolly de6994ad52 Dupe the multiple Add impls
Co-authored-by: Jane Lusby <jlusby42@gmail.com>
2020-10-07 01:29:08 -04:00
Deirdre Connolly 62ad554d84 Remove redundant non_snake_case 2020-10-07 01:29:08 -04:00
Deirdre Connolly b5b2d6a359 Impl more Add, Sum for references and Sum test 2020-10-07 01:29:08 -04:00
Deirdre Connolly 7cd730c552 Add tests for impl (Add|Sub)(Assign) for ValueCommitment 2020-10-07 01:29:08 -04:00
Deirdre Connolly d4da79af86 Impl (Add|Sub)(Assign) for ValueCommitment 2020-10-07 01:29:08 -04:00
Deirdre Connolly f7095ae9a2 Add some more human-readable language to the doc comment on merkle_crh_sprout 2020-10-05 23:44:25 -04:00
Deirdre Connolly 0cf24be8e0 Use VecDeque in places
The unwrap()'s are all after checks to make sure the value should never be None.
2020-10-05 23:44:25 -04:00
Deirdre Connolly d6cac9ea0a Allow dead code for now 2020-10-05 23:44:25 -04:00
Deirdre Connolly ee8ac1fd38 Remove LittleEndian import 2020-10-05 23:44:25 -04:00
Deirdre Connolly b85fcdfce9 Hex-encode empty root test vectors to height 29 2020-10-05 23:44:25 -04:00
Deirdre Connolly 8ab0f92d45 Persist the byte-reversed commitments 2020-10-05 23:44:25 -04:00
Deirdre Connolly ebbb494fb3 It woooooorks 2020-10-05 23:44:25 -04:00
Deirdre Connolly 30491c2c55 Fix merkle_crh_sprout 2020-10-05 23:44:25 -04:00
Deirdre Connolly 064021b7bf Update test vectors 2020-10-05 23:44:25 -04:00
Deirdre Connolly 24fa507e41 Tidy tests 2020-10-05 23:44:25 -04:00
Deirdre Connolly 867576db21 Add a (theoretically) working Sprout note commitment tree impl and some tests 2020-10-05 23:44:25 -04:00
Deirdre Connolly 5e18e72522 Add some more human-readable language to the doc comment on merkle_crh_sapling 2020-10-05 23:43:23 -04:00
Deirdre Connolly bb0fe9955b Remove Arbitrary from NoteCommitmentTree 2020-10-05 23:43:23 -04:00
Deirdre Connolly 44af7855e4 Move hex_empty_roots test vectors into the only test that uses them 2020-10-05 23:43:23 -04:00
Deirdre Connolly 98e40aa44f Use VecDeque in places
All unwrap()'s are after checks to make sure we won't be unwrap'ing a None
2020-10-05 23:43:23 -04:00
Deirdre Connolly 6732084928 Revert Sprout note commitment tree stuff for now 2020-10-05 23:43:23 -04:00
Deirdre Connolly fea448227f Add comment about where the sapling empty merkle roots come from 2020-10-05 23:43:23 -04:00
Deirdre Connolly 3d45209f05 Sprout NoteCommitmentTree root computation 2020-10-05 23:43:23 -04:00
Deirdre Connolly 06c69913c3 We can accurately compute Sapling note commitment tree roots now 2020-10-05 23:43:23 -04:00
Deirdre Connolly 915372e6a2 Correctly computing empty internal nodes in the Sapling note commitment tree 2020-10-05 23:43:23 -04:00
Deirdre Connolly b93abea34f Incomplete impl of Sapling note commitment merkle tree 2020-10-05 23:43:23 -04:00
Deirdre Connolly 568edb54e6 Add merkle_crh_sprout() and tidy note* things 2020-10-05 23:43:23 -04:00