Commit Graph

211 Commits

Author SHA1 Message Date
Jane Lusby 867dd0b475
Setup tracing-flame for use profiling zebrad (#436)
* Setup tracing-flame for use profiling zebrad

* start work on conditional flamegraph generation

* review time!

* update comments

* Update Cargo.toml

* disable default features for inferno

* reorganize

* missing one trait

* Apply suggestions from code review

* graceful shutdown!

* remove special case handling on ctrlc for cleanup

* rename signal fn to better represent its responsibility

* remove unused global hook for flushing flamegraph

* move tracing logic to the right file

* just copy linkerd's signal handling logic

* update book

* make zebrad app drop on shutdown normally

* Update zebrad/src/components/tokio.rs

Co-authored-by: teor <teor@riseup.net>

* Update zebrad/src/application.rs

Co-authored-by: teor <teor@riseup.net>

* Apply suggestions from code review

Co-authored-by: teor <teor@riseup.net>

* cleanup a little

* ooh yea there's an API for that

* setup env-filter for backup subscriber

* document env filter

* document return codes

* forgot to save

* Update book/src/applications/zebrad.md

Co-authored-by: teor <teor@riseup.net>

Co-authored-by: teor <teor@riseup.net>
2020-08-05 16:35:56 -07:00
Alfredo Garcia ded273413a
Use transcripts in block verify tests (#675)
* change consensus block tests to transcripts

* fix lints

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

Co-authored-by: Jane Lusby <jlusby42@gmail.com>
2020-08-05 14:41:41 -07:00
teor b7fac7b3bc feature: Make ExpandedDifficulty use U256 internally
Adds a dependency on the primitive-types crate.

Also adds custom hex debug formatting for compact and expanded
difficulties.
2020-08-04 12:29:07 +10:00
dependabot[bot] 8e268150a7 build(deps): bump tracing-subscriber from 0.2.9 to 0.2.10
Bumps [tracing-subscriber](https://github.com/tokio-rs/tracing) from 0.2.9 to 0.2.10.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-subscriber-0.2.9...tracing-subscriber-0.2.10)

Signed-off-by: dependabot[bot] <support@github.com>
2020-08-03 21:11:50 -04:00
dependabot[bot] f3b65f9609 build(deps): bump tracing from 0.1.17 to 0.1.18
Bumps [tracing](https://github.com/tokio-rs/tracing) from 0.1.17 to 0.1.18.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-0.1.17...tracing-0.1.18)

Signed-off-by: dependabot[bot] <support@github.com>
2020-08-03 15:49:30 -04:00
teor 195948e5b1 feature: Add an ExpandedDifficulty type and conversion
Also add tests.
2020-08-03 10:28:31 +10:00
Alfredo Garcia f2d7bb3177
Command execution tests (#690)
* add zebrad acceptance tests
* add custom command test helpers that work with kill
* add and use info event for start and seed commands
* combine conflicting tests into one test case

Co-authored-by: Jane Lusby <jane@zfnd.org>
2020-08-01 16:15:26 +10:00
Jane Lusby e6b849568f
Add support for errors in zebra_test::Transcript (#678)
* Add support for errors in zebra_test::Transcript

* test transcript with an error checker

* switch to option instead of MockError

* update docs

* dont use verifier against ready_and

* cleanup exports and add docs

* handle todos

* fix doctest

* temp: use cleaner error handling example

* add ability to test only for presence of error
2020-07-31 11:54:18 -07:00
Jane Lusby 1015db25a8
remap the state storage to only store blocks once (#741) 2020-07-31 09:21:54 +10:00
dependabot[bot] ce7f3e6c01 build(deps): bump sled from 0.34.0 to 0.34.2
Bumps [sled](https://github.com/spacejam/sled) from 0.34.0 to 0.34.2.
- [Release notes](https://github.com/spacejam/sled/releases)
- [Changelog](https://github.com/spacejam/sled/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spacejam/sled/compare/v0.34...v0.34.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-29 12:27:39 -04:00
dependabot[bot] 9a8fe2109f build(deps): bump pin-project from 0.4.22 to 0.4.23
Bumps [pin-project](https://github.com/taiki-e/pin-project) from 0.4.22 to 0.4.23.
- [Release notes](https://github.com/taiki-e/pin-project/releases)
- [Changelog](https://github.com/taiki-e/pin-project/blob/master/CHANGELOG.md)
- [Commits](https://github.com/taiki-e/pin-project/compare/v0.4.22...v0.4.23)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-28 17:27:25 -04:00
Henry de Valence 7d0a3debb6 chain: ensure impl Deserialize for Amount validates data.
This uses serde's try_from attribute to run deserialized values through the
TryFrom impl.  Also adds a test to make sure that validation actually does
happen.
2020-07-28 12:20:40 -07:00
Henry de Valence 04044be6d1 tower-batch: test fallback verification example. 2020-07-27 14:52:06 -07:00
dependabot[bot] 842c69c60c build(deps): bump serde_json from 1.0.56 to 1.0.57
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.56 to 1.0.57.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.56...v1.0.57)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-27 13:48:15 -04:00
Alfredo Garcia 5b3c6e4c6c
Port bash checkpoint scripts to zebra-checkpoints single rust binary (#740)
* make zebra-checkpoints
* fix LOOKAHEAD_LIMIT scope
* add a default cli path
* change doc usage text
* add tracing
* move MAX_CHECKPOINT_HEIGHT_GAP to zebra-consensus
* do byte_reverse_hex in a map
2020-07-25 17:53:00 +10:00
dependabot[bot] f7c59c99b5 build(deps): bump tracing-subscriber from 0.2.8 to 0.2.9
Bumps [tracing-subscriber](https://github.com/tokio-rs/tracing) from 0.2.8 to 0.2.9.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-subscriber-0.2.8...tracing-subscriber-0.2.9)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-24 14:31:44 -04:00
dependabot[bot] e99e9653eb
build(deps): bump sled from 0.33.0 to 0.34.0 (#735)
Bumps [sled](https://github.com/spacejam/sled) from 0.33.0 to 0.34.0.
- [Release notes](https://github.com/spacejam/sled/releases)
- [Changelog](https://github.com/spacejam/sled/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spacejam/sled/compare/v0.33...v0.34)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-23 10:55:34 -07:00
dependabot[bot] 909b74a613
build(deps): bump tracing from 0.1.16 to 0.1.17 (#734)
Bumps [tracing](https://github.com/tokio-rs/tracing) from 0.1.16 to 0.1.17.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-0.1.16...tracing-0.1.17)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-23 10:54:56 -07:00
Jane Lusby c1a1493159
use dirs crate for default location of state and config (#714)
* use dirs crate for default location of state and config
* panic if a path isn't specified for zebra-state
2020-07-23 21:12:20 +10:00
Henry de Valence 4a98b8fa0d Add basic metrics to the syncer. 2020-07-22 21:59:00 -07:00
Jane Lusby a722cf33f7 enable new tracing instrumentation in tokio 2020-07-22 14:39:54 -04:00
Henry de Valence 0586da7167 Revert #500 (generic errors in tower-batch).
Unfortunately, since the Batch wrapper was changed to have a generic error
type, when wrapping it in another Service, nothing constrains the error type,
so we have to specify it explicitly to avoid an inference hole.  This is pretty
unergonomic -- from the compiler error message it's very unintuitive that the
right fix is to change `Batch::new` to `Batch::<_, _, SomeError>::new`.

The options are:

1. roll back the changes that make the error type generic, so that the error
   type is a concrete type;

2. keep the error type generic but hardcode the error in the default
   constructor and add an additional code path that allows overriding the
   error.

However, there's a further issue with generic errors: the error type must be
Clone.  This problem comes from the fact that there can be multiple Batch
handles that have to share access to errors generated by the inner Batch
worker, so there's not a way to work around this.  However, almost all error
types aren't Clone, so there are fairly few error types that we would be
swapping in.

This suggests that in case (2) we would be maintaining extra code to allow
generic errors, but with restrictive enough generic bounds to make it
impractical to use generic error types.  For this reason I think that (1) is a
better option.
2020-07-22 14:29:55 -04:00
dependabot[bot] 7067ac6e0d build(deps): bump tokio from 0.2.21 to 0.2.22
Bumps [tokio](https://github.com/tokio-rs/tokio) from 0.2.21 to 0.2.22.
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-0.2.21...tokio-0.2.22)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-22 12:43:38 -04:00
Henry de Valence 1047d2f690 sync: add backpressure to syncer
Closes #617.
Closes #698.

The remaining work on the syncer is alluded to in a new comment:

1. Correctly constructing a block locator object
2. Detecting when we've stopped making progress syncing and restarting obtain_tips.
2020-07-21 20:16:23 -07:00
teor b0cd920fad feature: Use the Heartwood protocol version in zebra-network 2020-07-21 10:46:07 -07:00
dependabot[bot] c8fe4b43d8 build(deps): bump indexmap from 1.4.0 to 1.5.0
Bumps [indexmap](https://github.com/bluss/indexmap) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/bluss/indexmap/releases)
- [Commits](https://github.com/bluss/indexmap/compare/1.4.0...1.5.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-21 12:19:01 -04:00
dependabot[bot] 2208a6a22d build(deps): bump tracing-subscriber from 0.2.7 to 0.2.8
Bumps [tracing-subscriber](https://github.com/tokio-rs/tracing) from 0.2.7 to 0.2.8.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-subscriber-0.2.7...tracing-subscriber-0.2.8)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-21 12:01:40 -04:00
dependabot[bot] 599afb7fbb build(deps): bump metrics-runtime from 0.13.0 to 0.13.1
Bumps [metrics-runtime](https://github.com/metrics-rs/metrics) from 0.13.0 to 0.13.1.
- [Release notes](https://github.com/metrics-rs/metrics/releases)
- [Commits](https://github.com/metrics-rs/metrics/compare/metrics-runtime-v0.13.0...metrics-runtime-v0.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-21 12:00:42 -04:00
dependabot[bot] 474de52e5c
build(deps): bump displaydoc from 0.1.6 to 0.1.7 (#689)
Bumps [displaydoc](https://github.com/yaahc/displaydoc) from 0.1.6 to 0.1.7.
- [Release notes](https://github.com/yaahc/displaydoc/releases)
- [Commits](https://github.com/yaahc/displaydoc/commits)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-20 11:00:15 -07:00
dependabot[bot] 2d8e518499 build(deps): bump redjubjub from 0.2.1 to 0.2.2
Bumps [redjubjub](https://github.com/ZcashFoundation/redjubjub) from 0.2.1 to 0.2.2.
- [Release notes](https://github.com/ZcashFoundation/redjubjub/releases)
- [Changelog](https://github.com/ZcashFoundation/redjubjub/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ZcashFoundation/redjubjub/compare/0.2.1...0.2.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-16 09:42:44 -04:00
dependabot[bot] f70f3b324c Bump sled from 0.32.1 to 0.33.0
Bumps [sled](https://github.com/spacejam/sled) from 0.32.1 to 0.33.0.
- [Release notes](https://github.com/spacejam/sled/releases)
- [Changelog](https://github.com/spacejam/sled/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spacejam/sled/compare/v0.32.1...v0.33)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-15 10:21:59 -07:00
Henry de Valence e58de06cb0 tower-fallback: add docs
Thanks to @seanmonstar for pointing to the article on the downsides of fallback.
2020-07-15 10:09:37 -07:00
Henry de Valence ecda5445d5 tower-fallback: switch to Box<dyn Error + Send + Sync + 'static>
Previously the code used Either for error handling, but a boxed std Error is
smaller in the happy path and more useful.
2020-07-15 10:09:37 -07:00
Henry de Valence 4be0a8edc3 tower-fallback: add implementation. 2020-07-15 10:09:37 -07:00
dependabot[bot] c3fcac8a5c Bump hyper from 0.13.6 to 0.13.7
Bumps [hyper](https://github.com/hyperium/hyper) from 0.13.6 to 0.13.7.
- [Release notes](https://github.com/hyperium/hyper/releases)
- [Changelog](https://github.com/hyperium/hyper/blob/master/CHANGELOG.md)
- [Commits](https://github.com/hyperium/hyper/compare/v0.13.6...v0.13.7)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-14 10:40:53 -07:00
dependabot[bot] d945ec3620 Bump bytes from 0.5.5 to 0.5.6
Bumps [bytes](https://github.com/tokio-rs/bytes) from 0.5.5 to 0.5.6.
- [Release notes](https://github.com/tokio-rs/bytes/releases)
- [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/bytes/compare/v0.5.5...v0.5.6)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-14 10:39:42 -07:00
dependabot[bot] ebcf6b0385 Bump sled from 0.32.0 to 0.32.1
Bumps [sled](https://github.com/spacejam/sled) from 0.32.0 to 0.32.1.
- [Release notes](https://github.com/spacejam/sled/releases)
- [Changelog](https://github.com/spacejam/sled/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spacejam/sled/compare/v0.32...v0.32.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-13 11:51:35 -04:00
Jane Lusby 2b48008129
setup skeleton zebra-utils crate for independent binaries (#638)
* setup skeleton zebra-utils crate for independent binaries

* resolve review comments
2020-07-10 12:31:01 -07:00
Jane Lusby 06fff62561 remove git dependency on equihash crate 2020-07-10 07:52:52 -04:00
Jane Lusby 765e1e61e7
fix spandoc instrumentation for await expressions (#618)
* fix spandoc instrumentation for await expressions

* depend on released version of spandoc
2020-07-09 17:43:44 -04:00
Henry de Valence 8b72781fe1 deps: Update redjubjub to 0.2
Closes #606.
2020-07-09 15:20:23 -04:00
dependabot[bot] d627889104 Bump tracing from 0.1.15 to 0.1.16
Bumps [tracing](https://github.com/tokio-rs/tracing) from 0.1.15 to 0.1.16.
- [Release notes](https://github.com/tokio-rs/tracing/releases)
- [Commits](https://github.com/tokio-rs/tracing/compare/tracing-0.1.15...tracing-0.1.16)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-09 10:22:27 -07:00
Deirdre Connolly 2cd58c8325
Add RedJubjub signature verifier service (#460)
Using tower-batch-based async pattern.

Now the Verifier is agnostic of redjubjub SigTypes.  Updated tests to
generate sigs of both types and batch verifies the whole batch.

Resolves #407
2020-07-08 17:23:00 -04:00
teor f2052b398b
feature: Implement CheckpointVerifier (#524)
* Return Poll::Ready(Err(_)) when verification has finished
* Turn checkpoint::init() into CheckpointVerifier::new()
* Accept IntoIterator<...> for CheckpointVerifier::new()
* Add a CheckpointList type

* Replace the state service with oneshot channels.
* Reject redundant checkpoint blocks
* impl Drop for CheckpointVerifier

* Add fields for caching blocks, and managing verify chains.
* Add current checkpoint functions
* Use a checkpoint range
* Get full backtraces with Err::Try
* Add enums for verification progress and target block heights.

* Replace install_tracing() with zebra_test::init()
* Add a test that mixes good and bad blocks
* Add timeouts to the checkpoint test futures
2020-07-08 21:22:36 +10:00
dependabot[bot] 2a6a3ee518 Bump chrono from 0.4.12 to 0.4.13
Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.12 to 0.4.13.
- [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.12...v0.4.13)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-07 18:31:55 -04:00
dependabot[bot] 3debe97cb2 Bump equihash from `5b2c71e` to `ae2a248`
Bumps [equihash](https://github.com/ZcashFoundation/librustzcash) from `5b2c71e` to `ae2a248`.
- [Release notes](https://github.com/ZcashFoundation/librustzcash/releases)
- [Commits](5b2c71e112...ae2a248133)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-07 12:31:09 -07:00
Henry de Valence 68f57b2577 Update ed25519-zebra to 1.0. 2020-07-07 11:49:21 -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
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