Commit Graph

316 Commits

Author SHA1 Message Date
Henry de Valence 68f57b2577 Update ed25519-zebra to 1.0. 2020-07-07 11:49:21 -07:00
Henry de Valence e54438f4e4 Update zebra-chain/src/block/header.rs 2020-07-07 11:13:49 -07:00
Dimitris Apostolou ba81d7d4c0 Fix typos 2020-07-07 11:13:49 -07:00
Jane Lusby a733580fd8
add proptests for invalid forms of input (#550)
* add proptests for invalid forms of input

* apply proptests to each valid block we have

* start moving equihash logic to BlockHeader

* provide an error based interface

* cleanup logging in dependent crate

* use is_equihash_solution_valid everywhere

* switch to proper equihash crate branch
2020-07-07 11:01:02 -07:00
Alfredo Garcia db30e53470
Create a test for block size (#558)
* add block size limit test
* calculate max_transactions_in_block and max_inputs_in_tx
* abstract block generation
* move all test vectors to zebra-test
2020-07-07 10:37:32 +10:00
Alfredo Garcia d736355f9f
Add ZIP143 and ZIP243 test vectors (#585) 2020-07-03 09:45:40 +10:00
teor c8829d8408 fix: Adjust bounds on the LockTime Arbitrary impl
The previous code could generate LockTime::Time with (u32::MAX + 1),
but the maximum valid value is u32::MAX due to the field size.
2020-07-02 14:30:34 +10:00
Jane Lusby 00e750654a
add nullifier types (#568)
* add nullifier types

* Apply suggestions from code review

Co-authored-by: Deirdre Connolly <deirdre@zfnd.org>

* add zcash_deserialize impls

* Add docs

Co-authored-by: Deirdre Connolly <deirdre@zfnd.org>
2020-07-01 17:57:32 -07:00
Jane Lusby c216f5ca25
Refine type for MAC (#577) 2020-07-01 17:57:03 -07:00
Jane Lusby 8281b9040c
Start work on new Amount type (#554) 2020-07-01 16:31:30 -07:00
teor 7bace99569 fix: Update a comment with the correct parity-zcash path 2020-07-01 16:03:14 -04:00
Jane Lusby 6cbb6d4574
consolidate arbitrary impls to one file in zebra-chain (#553)
* consolidate arbitrary impls to one file in zebra-chain

* move the ones I missed

* move test-vectors

Co-authored-by: Jane Lusby <jane@zfnd.org>
2020-06-30 14:23:38 -07:00
Jane Lusby afd0e90a74
Implement equihash verification (#549)
This change brings in the `equihash` crate from librustzcash and uses it to add a basic `is_valid` test for `EquihashSolutions`.

Co-authored-by: Jane Lusby <jane@zfnd.org>
2020-06-26 11:21:02 -07:00
Alfredo Garcia 9cbd369a59
Refactor block module to have submodules (#512)
* create hash submodule for block

* create header submodule for block

* create serialize submodule for block

* add newline to hash.rs (fmt)

* Update zebra-chain/src/block/tests.rs

Co-authored-by: Jane Lusby <jlusby42@gmail.com>

Co-authored-by: Henry de Valence <hdevalence@hdevalence.ca>
Co-authored-by: Jane Lusby <jlusby42@gmail.com>
2020-06-25 09:18:05 -07:00
teor a9efb8715e chain: Update the note about time truncation 2020-06-24 18:22:36 +10:00
teor 3f5e2695e3 chain: Tweak the version and time test bounds
Use MAX constants for the block header version and time arbitrary test
ranges. Reduces the block header time arbitrary test range from 2**32 to
2**32-1 (u32::MAX). (2**32 is an invalid time value, which gets
truncated to 0 during serialization.)

Also add some comments about DateTime conversions.

Part of #477.
2020-06-24 18:22:36 +10:00
teor 719aa75581 chain: Add a comment about transaction sizes
We don't need to check transaction sizes yet, because we aren't
parsing or generating transactions outside of blocks.

Part of #483.
2020-06-24 18:22:36 +10:00
Henry de Valence e8561d8f9e rename zebra-test-vectors to zebra-test 2020-06-22 20:23:02 -07:00
teor d8b48f885b
consensus: Add a checkpoint verifier stub (#502)
consensus: Add a checkpoint verifier stub

This stub only verifies blocks whose hashes are in the checkpoint
list.

It doesn't have tests, chain child verifies to their ancestors, or
support checkpoint maximum height queries.

Part of #429.
2020-06-22 08:51:43 +10:00
Henry de Valence a0e0e2302b Update ed25519-zebra to 0.4 2020-06-16 14:35:42 -07:00
Henry de Valence 9ddcccdcb4 Update ed25519-zebra to 0.3 2020-06-16 00:42:25 -04:00
Henry de Valence a023ba9b16
Add serde bounds to zebra-chain structures. (#231) 2020-06-15 15:08:14 -07:00
teor 210e11a86d chain: Check the maximum block size when parsing
The maximum block size is 2,000,000 bytes. This commit also limits the
maximum transaction size in parsed blocks. (See #484 for the
corresponding limit on mempool transactions.)

The proptests might test the maximum block size, but they are
randomised. So we also want to explicitly test large block sizes.
(See #482 for these test cases and tests.)

Part of #477.
2020-06-15 11:00:48 -07:00
teor 585fa7a1ae chain: Verify the solutionSize field in block headers
Verify the value of the equihash solution size field in block headers.

This field isn't stored in the BlockHeader struct, so we need to verify
it at parse time.

Part of #477.
2020-06-15 19:04:43 +10:00
Jane Lusby 9f802cd8dd Wrap Transaction in Arc 2020-06-06 18:13:17 -04:00
Deirdre Connolly b263489af6
Export ed25519 zebra (#445)
And use that one, and our similar redjubjub export, everywhere.

Fixes #405

* Move PRs to 'In Progress' column on project board when created
2020-06-06 18:10:32 -04:00
teor f1de07889c Fix a typo in a comment in block.rs 2020-06-04 04:49:23 -04:00
Jane Lusby e9af80b875
Add initial version of zebra-state (#414)
* rename zebra-storage to zebra-state

* Setup initial skeleton for zebra-state

* add test

* Apply suggestions from code review

Co-authored-by: Henry de Valence <hdevalence@hdevalence.ca>

* move shared test vectors to a common crate

Co-authored-by: Jane Lusby <jane@zfnd.org>
Co-authored-by: Henry de Valence <hdevalence@hdevalence.ca>
2020-06-02 16:16:17 -07:00
dependabot-preview[bot] 145d9a1835 Bump proptest from 0.9.6 to 0.10.0
Bumps [proptest](https://github.com/altsysrq/proptest) from 0.9.6 to 0.10.0.
- [Release notes](https://github.com/altsysrq/proptest/releases)
- [Changelog](https://github.com/AltSysrq/proptest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/altsysrq/proptest/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-29 15:06:40 -04:00
dependabot-preview[bot] e317b68b1d Bump proptest-derive from 0.1.2 to 0.2.0
Bumps [proptest-derive](https://github.com/AltSysrq/proptest) from 0.1.2 to 0.2.0.
- [Release notes](https://github.com/AltSysrq/proptest/releases)
- [Changelog](https://github.com/AltSysrq/proptest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/AltSysrq/proptest/compare/proptest-derive-0.1.2...proptest-derive-0.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-28 23:00:29 -04:00
Jane Lusby 4a2d2a359c
add cargo fmt to ci (#403)
* add cargo fmt to ci

* rebase on main

* switch to stable

Co-authored-by: Jane Lusby <jane@zfnd.org>
2020-05-27 19:12:25 -07:00
Jane Lusby 4dc307f2f3 fix last warnings 2020-05-27 15:42:29 -04:00
Jane Lusby b6b35364f3 cleanup warnings throughout codebase 2020-05-27 15:42:29 -04:00
Deirdre Connolly 8d29d05761 Upgrade sha2 to 0.8.2 release
Resolves #326
2020-05-23 21:32:37 -04:00
Kiminuo 6465689555 transaction/hash.rs: Add FromStr implementation (issue #299)
Co-authored-by: Deirdre Connolly <durumcrustulum@gmail.com>
2020-05-14 15:30:11 -04:00
Deirdre Connolly 6ed6ccd62e Clean up imports and some doc comments 2020-04-29 22:42:52 -04:00
Deirdre Connolly 7367daef9f Tidy TransparentAddress FromStr/Display 2020-04-22 02:17:17 -04:00
Deirdre Connolly df7ed7ae81
Move note encryption types around (#362)
* Move around and dedupe note *Cipertext types

* Bump code coverage test timeout to 5 minutes

* Try uploading coverage to codecov.io
2020-04-19 14:45:25 -04:00
Deirdre Connolly 21eca164d8 Refine Output description ephemeral_key to jubjub::AffinePoint
And impl Arbitrary for Output to support better generation of those points in proptests.
2020-04-18 22:05:13 -04:00
Deirdre Connolly 7a4be955be Remove todo 2020-04-18 22:05:13 -04:00
Deirdre Connolly b53be18c8f Remove unused From<[u8; 32]> for SpendAuthorizingKey 2020-04-18 04:40:31 -04:00
Deirdre Connolly 630d021886 Remove unused From<[u8; 32]> for ProofAuthorizingKey 2020-04-18 04:40:31 -04:00
Deirdre Connolly d445799626 Remove the Deref's and make the From's consistent for all key types 2020-04-18 04:40:31 -04:00
Deirdre Connolly 37337c9e44 Remove some impl Deref's and PartialEq's that weren't used
Add some impl From<T> for [u8; 32] 's
2020-04-18 04:40:31 -04:00
Deirdre Connolly f8022442cf Remove some currently unused From impls for [u8; 32] 2020-04-18 04:40:31 -04:00
Deirdre Connolly 252acd85d8 Tidy imports 2020-04-18 04:40:31 -04:00
Deirdre Connolly 2156c6143b Complete impl Arbitrary for TransmissionKey 2020-04-18 04:40:31 -04:00
Deirdre Connolly abcca2c76b Finish Sapling keys roundtrip proptest 2020-04-18 04:40:31 -04:00
Deirdre Connolly 001b39c588 Impl PartialEq for AuthorizingKey and FullViewingKey 2020-04-18 04:40:31 -04:00
Deirdre Connolly 5d430cff12 Do not try to make a jubjub extended point work as a scalar in redjubjub PublicKey From impl 2020-04-18 04:40:31 -04:00