Commit Graph

33 Commits

Author SHA1 Message Date
dependabot[bot] 5ee48a6675
Bump chrono from 0.4.11 to 0.4.12 (#580)
Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.11 to 0.4.12.
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/master/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.11...v0.4.12)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-02 10:33:39 -07:00
dependabot[bot] a1d02c2606 Bump tracing-subscriber from 0.2.6 to 0.2.7
Bumps [tracing-subscriber](https://github.com/tokio-rs/tracing) from 0.2.6 to 0.2.7.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-subscriber-0.2.6...tracing-subscriber-0.2.7)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-02 06:47:04 -04:00
teor a706b65325
Consensus test tweaks (#538)
* Use spandoc correctly
* Refactor consensus test error handling
* Delete a checkpoint test that will soon be obsolete

* Only initialise tracing once for the block tests
* Use tracing in the checkpoint tests

* Move BlockVerifier and tests into block.rs

* Update a BlockVerifier comment
* Tweak some TODO comments
2020-06-25 10:14:23 +10:00
Jane Lusby 2abf4b93a8 consolidate test init functions into zebra-test (#541)
* consolidate test init logic into one place

* rustfmt

Co-authored-by: Jane Lusby <jane@zfnd.org>
2020-06-24 11:47:18 -07:00
teor f40bfff7c0 consensus: Simplify error handling in a test
Part of #477.
2020-06-24 18:22:36 +10:00
teor f1ce4dcf14 consensus: Inline node_time_check() into callers
node_time_check() is a small function, so we inline it into its callers.
(And then rename node_time_check_helper() to node_time_check().)

Part of #477.
2020-06-24 18:22:36 +10:00
teor 59bc8d7167 consensus: Make BlockVerifier only call AddBlock on success
We don't want to call the state's AddBlock until we know the block is
valid. This avoids subtle bugs if the state is modified in call().

(in_memory currently modifies the state in call(), on_disk modifies the
state in the async block.)

Part of #477.
2020-06-24 18:22:36 +10:00
teor 8fde8c1a6b consensus: Add tests for block node time checks
Part of #477.
2020-06-24 18:22:36 +10:00
teor a41f4f68cf consensus: move verify::block to its own file
Part of #477.
2020-06-24 18:22:36 +10:00
teor d97c769869 consensus: Refactor the node time check for testing
Part of #477.
2020-06-24 18:22:36 +10:00
teor 3c27c11012 consensus: Check block times against the local clock
Part of #477.
2020-06-24 18:22:36 +10:00
teor f10bfd5806 consensus: Add a block time check function
Add a function that checks the block header miner times against the
node's local clock.

(We'll use this function in the next commit.)

Part of #477.
2020-06-24 18:22:36 +10:00
Henry de Valence 70241d3cad Fix broken git dependencies.
Pinning hashes means these won't break again in the future; they can always be updated.
2020-06-22 20:23:02 -07:00
Henry de Valence e8561d8f9e rename zebra-test-vectors to zebra-test 2020-06-22 20:23:02 -07:00
teor 03b8453b8a
Checkpoint Verifier Tests (#517)
* Add basic checkpoint verifier tests
* Refactor a checkpoint verifier condition
* Remove some outdated comments
2020-06-23 12:15:37 +10:00
Jane Lusby 246e7cd2a9
Start testing out new version of `eyre` and `color-eyre` in zebra (#526)
* port to new version of eyre without generics

* correctly setup color_eyre hooks

Co-authored-by: Jane Lusby <jane@zfnd.org>
2020-06-22 15:36:23 -07:00
dependabot[bot] f301de41fa Bump tracing-subscriber from 0.2.5 to 0.2.6
Bumps [tracing-subscriber](https://github.com/tokio-rs/tracing) from 0.2.5 to 0.2.6.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-subscriber/-0.2.5...tracing-subscriber-0.2.6)

Signed-off-by: dependabot[bot] <support@github.com>
2020-06-22 12:01:47 -04: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
teor 26a58b23de state: Make Response::Added return the block header hash
Move block header hashing from zebra-consensus to zebra-state.
Handle zebra-state AddBlock errors in zebra-consensus BlockVerifier.
Add unit tests for BlockVerifier state error handling.

Part of #428.
2020-06-12 09:46:18 -07:00
Henry de Valence cbb50ea506 Simplify `where` bounds on services.
Placing bounds on the service's future is less ideal, because the future is
already constrained by the `Service` trait, so the bounds can be expressed more
directly and simply by bounding the service itself.

If the verification service already has to have a generic parameter for the
future (the `ZSF`), it could instead be generic over `S`, the storage service.
This has the upside that it's no longer required for the verification service
to box the storage service, so we don't add any extra layers of indirection,
and the where bounds become more straightforward, since they're centered on the
requirements for the storage service itself, not the future it returns.
Finally, we can simplify the bounds by using the request / response types
directly rather than defining wrapper types.
2020-06-12 09:46:18 -07:00
Henry de Valence adf0769ac2 Get the round trip test to pass.
The reason the test failed is that the future returned by `call` on the state
service was immediately dropped, rather than being driven to completion.
Instead, we link the state update future with the verification future by
.awaiting it in an async block.

Note that the state update future is constructed outside of the async block
returned by the verification service.  Why?  Because calling
`self.state_service.call` requires mutable access to `state_service`, which we
only have in the body of the verification service's `call` method, and not
during execution of the async block it returns (which could happen at some
later point, or never).

In Tower's model, the `call` method itself only does the work necessary to
construct a future that represents completion of the service call, and the rest
of the work is done in the future itself.  In particular, the fact that
`Service::call` takes `&mut self` means two things:

1. the service's state can be mutated while setting up the future, but not
during the future's subsequent execution,

2. any nested service calls made *by* the service *to* sub-services (e.g., the
verification service calling the state service) must either be made upfront,
while constructing the response future, or must be made to a clone of the
sub-service owned by the the response future.
2020-06-12 09:46:18 -07:00
teor 15bc64aed9 consensus: add a (failing) verify round-trip test
This test doesn't work, because the futures are not used correctly.

Part of #428.
2020-06-12 09:46:18 -07:00
teor c2590ce526 consensus: Make future handling a little nicer
Part of #428.
2020-06-12 09:46:18 -07:00
teor 7b8707be1e consensus: Add a simple block verify test
Part of #428.
2020-06-12 09:46:18 -07:00
teor d0a833f3fb consensus: Make the state service pluggable in block verification
We want to allow different state service implementations, and wrapped
state services. So we make verify::init() take a state_service, and
store that service in the BlockVerifier state_service field.

Part of #428.
2020-06-12 09:46:18 -07:00
teor 4181c8a5d5 consensus: Make BlockVerifier respond with the BlockHeaderHash
Part of #428.
2020-06-12 09:46:18 -07:00
teor c019726fb1 consensus: Add a script verifier stub
Part of #428.
2020-06-12 09:46:18 -07:00
teor af1d64b218 consensus: Add a transaction verification stub
Part of #428.
2020-06-12 09:46:18 -07:00
teor 997201c9c7 consensus: Add a mempool stub 2020-06-12 09:46:18 -07:00
teor 8f2ddef0a4 consensus: Add a block verification service
Part of #428.
2020-06-12 09:46:18 -07:00
Henry de Valence ff3efd504c Add Zebra logo to all workspace crates.
Also add html_root_url attributes.
2020-02-26 21:25:35 -08:00
Henry de Valence 92dc7a5ea1
Fix authorship, license information. (#55)
* Fix authorship, license information.

I *thought* I had done a sed pass over the Cargo defaults when doing
repository initialization, but I guess I missed it or something.
Anyways, fixed now.
2019-10-08 09:25:59 -07:00
Henry de Valence ec363d2d41 Create workspace skeleton based on design.md 2019-08-29 14:46:54 -07:00