Go to file
Henry de Valence cad38415b2
network: fix bug in inventory advertisement handling (#1022)
* network: fix bug in inventory advertisement handling

The RFC https://zebra.zfnd.org/dev/rfcs/0003-inventory-tracking.html described
the use of a `broadcast` channel in place of an `mpsc` channel to get
ring-buffer behavior, keeping a bound on the size of the channel but dropping
old entries when the channel is full.

However, it didn't explicitly describe how this works (the `broadcast` channel
returns a `RecvError::Lagged(u64)` to inform receivers that they lost
messages), so the lag-handling wasn't implemented and I didn't notice in
review.

Instead, the ? operator bubbled the lag error all the way up from
`InventoryRegistry::poll_inventory` through `<PeerSet as Service>::poll_ready`
through various Tower wrappers to users of the peer set.  The error propagation
is bad enough, because it caused client errors that shouldn't have happened,
but there's a worse interaction.

The `Service` contract distinguishes between request errors (from
`Service::call`, scoped to the request) and service errors (from
`Service::poll_ready`, scoped to the service).  The `Service` contract
specifies that once a service returns an error from `poll_ready`, the service
can be assumed to be failed permanently.

I believe (but haven't tested or carefully worked through the details) that
this caused various tower middleware to report the entire peer set service as
permanently failed due to a transient inventory "error" (more of an indicator),
and I suspect that this is the cause of #1003, where all of the sync
component's requests end up failing because the peer set reported that it
failed permanently.  I am able to reproduce #1003 locally before this change
and unable to reproduce it locally after this change, though I have not tested
exhaustively.

* network: add metric for dropped inventory advertisements

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

Co-authored-by: teor <teor@riseup.net>
2020-09-07 21:24:31 -07:00
.github Move coverage step to common workflow for PRs and pushes to main (#984) 2020-09-01 13:47:34 -07:00
book Rename old references to BlockHeaderHash and BlockHeight (#1002) 2020-09-04 15:40:48 -07:00
design Update data-flow.md 2020-08-04 22:44:39 -07:00
tower-batch zebra-state: Add support for temporary sled databases (#939) 2020-08-31 18:32:55 +10:00
tower-fallback build(deps): bump pin-project from 0.4.22 to 0.4.23 2020-07-28 17:27:25 -04:00
zebra-chain network: add Network::default_port(). 2020-09-07 11:13:15 -07:00
zebra-client Align crate versions and user-agent with NU numbers. 2020-07-24 11:46:37 -07:00
zebra-consensus Rename old references to BlockHeaderHash and BlockHeight (#1002) 2020-09-04 15:40:48 -07:00
zebra-network network: fix bug in inventory advertisement handling (#1022) 2020-09-07 21:24:31 -07:00
zebra-rpc Align crate versions and user-agent with NU numbers. 2020-07-24 11:46:37 -07:00
zebra-script fix: Remove redundant ConsensusBranchId constants 2020-08-20 14:52:09 -04:00
zebra-state Rename old references to BlockHeaderHash and BlockHeight (#1002) 2020-09-04 15:40:48 -07:00
zebra-test Remove in-memory state service (#974) 2020-09-01 12:39:04 -07:00
zebra-utils Add log filters which provide block info 2020-09-02 12:12:58 -04:00
zebrad Add test for metrics and tracing endpoints (#1000) 2020-09-07 17:05:23 -07:00
.firebaserc Try building internal docs. 2020-02-10 18:12:43 -08:00
.gitignore Add .cargo to the gitignore file 2020-08-28 20:14:12 -04:00
CONTRIBUTING.md Add issue and PR templates, document RFC process 2020-08-31 00:58:50 -04:00
Cargo.lock build(deps): bump indexmap from 1.5.2 to 1.6.0 2020-09-07 07:56:39 -04:00
Cargo.toml Refactor tracing components (#834) 2020-08-06 10:29:31 -07:00
Dockerfile Explicitly pass our config to the start command 2020-09-04 01:02:32 -04:00
LICENSE-APACHE Add copyright marks on each license 2019-11-14 11:50:49 -08:00
LICENSE-MIT Add copyright marks on each license 2019-11-14 11:50:49 -08:00
README.md Reorganize the book. (#843) 2020-08-06 15:39:54 -07:00
clippy.toml Apply clippy fixes 2020-02-05 12:42:32 -08:00
cloudbuild.yaml Fix CD workflow using cloudbuild.yaml (#637) 2020-07-10 07:37:54 -04:00
codecov.yml Turn off the CodeCov PR comment, metrics available in the checks results which link to codecov.io 2020-07-24 18:18:46 -04:00
firebase.json Configure redirect for firebase hosting 2020-01-16 18:38:16 -05:00
katex-header.html Add KaTeX to rendered docs. (#832) 2020-08-05 17:34:30 -07:00
prometheus.yaml Tell Prometheus to scrape more aggressively 2020-02-14 20:14:05 -05:00

README.md

Zebra logotype


codecov License

Hello! I am Zebra, an ongoing Rust implementation of a Zcash node.

Zebra is a work in progress. It is developed as a collection of zebra-* libraries implementing the different components of a Zcash node (networking, chain structures, consensus rules, etc), and a zebrad binary which uses them.

Most of our work so far has gone into zebra-network, building a new networking stack for Zcash, zebra-chain, building foundational data structures, zebra-consensus, implementing consensus rules, and zebra-state, providing chain state.

Zebra Website.

Rendered docs from the main branch.

Join us on Discord.

License

Zebra is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT.