Alfredo Garcia
db2eb80b3e
Create consensus utils and move byte_reverse_hex function to it ( #705 )
...
* move byte_reverse_hex function
2020-07-22 12:29:14 +10:00
Jane Lusby
b8de256c48
remove serialization error variant of EquihashError
2020-07-22 11:09:22 +10:00
Henry de Valence
0dc2d92ad8
network: ensure dropping a Client closes the connection.
...
This fixes a bug introduced when we added heartbeat support. Recall that we
handle the Bitcoin connection state machine on a per-peer basis. Each
connection has a task created from the `Connection` struct, and a `Client:
tower::Service` "frontend" that passes requests to it via a channel. In the
`Connection` event loop, the connection checks whether the request channel has
been closed, indicating no further requests from the `Client`, in which case it
shuts itself down and cleans up resources. This occurs when all of the senders
have been dropped.
However, this behavior broke when we introduced heartbeat support, because we
spawned an additional task to send heartbeat messages along the request
channel. This meant that instead of having a single sender, dropped by the
`Client`, we have two senders, the `Client` and the "shadow client" task that
generates heartbeat messages. This means that when the `Client` is dropped, we
still have a live sender and the connection is not closed. To fix this, the
`Client` now uses a `oneshot` to shut down its corresponding heartbeat task.
This closes all senders.
2020-07-21 15:43:31 -07:00
teor
b0cd920fad
feature: Use the Heartwood protocol version in zebra-network
2020-07-21 10:46:07 -07:00
teor
e5bb96715f
fix: Reduce sync error logs to info or warn
...
Network issues are very common.
2020-07-21 10:13:03 -07:00
teor
a0dbe85acd
fix: Rewrite the config usage comment
2020-07-21 12:58:55 -04:00
teor
1cb1f1c52e
fix: Put the peer set config vars together
2020-07-21 12:20:48 -04:00
dependabot[bot]
92bb3c86db
build(deps): bump codecov/codecov-action from v1.0.10 to v1.0.11
...
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action ) from v1.0.10 to v1.0.11.
- [Release notes](https://github.com/codecov/codecov-action/releases )
- [Commits](https://github.com/codecov/codecov-action/compare/v1.0.10...6d208f5b527841fb050f92f778e86cb808dacdcb )
Signed-off-by: dependabot[bot] <support@github.com>
2020-07-21 12:19:26 -04: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
teor
1b0c0f027f
Add Hard-Coded Checkpoint Lists ( #674 )
...
* Add checkpoint list generation scripts
* Limit the checkpoint block data size
* Limit the checkpoint height gap
* Add Mainnet and Testnet checkpoint lists
* Parse hard-coded checkpoint lists
The lists were generated using the following limits:
- 256 MB spacing, based on block byte size, and
- 2000 blocks.
2020-07-21 23:11:51 +10: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
Jane Lusby
e06357f795
Add skeleton of eventual zebra book ( #653 )
...
* Add skeleton of eventual zebra book
* reorg sections
* restore file and reorg book a little
* try setting up a firebase deployment
* allow firebase ci to work on test
* download mdbook
* fix book path
* use newer version of mdbook
* remove event hook for book branch pre merge
* Apply suggestions from code review
Co-authored-by: Henry de Valence <hdevalence@hdevalence.ca>
Co-authored-by: Henry de Valence <hdevalence@hdevalence.ca>
2020-07-17 20:15:50 -07:00
Alfredo Garcia
fe2a468417
add favicon to generated docs ( #681 )
2020-07-17 16:45:29 -07:00
Jane Lusby
f3dd24bb3c
bug cleanup related to error handling ( #552 )
...
* cleanup error handling fixes
2020-07-17 18:19:00 -04:00
teor
71de6de701
fix: Only enable tokio components for servers
...
Only enable the tokio and tracing components for server commands.
2020-07-17 10:12:51 +10:00
teor
49a3a7d6d1
fix: Only launch network endpoints for server commands
...
Fixes #669 .
2020-07-16 10:40:03 -07:00
teor
c13907d1af
fix: Combine two matches
2020-07-16 10:06:29 -07:00
teor
b648375bbe
fix: Hard-code the genesis previous block hash
2020-07-16 10:06:29 -07:00
teor
39e67c8748
feature: Check the genesis hash in checkpoint lists
...
And use the consensus parameters to get the genesis previous block hash.
2020-07-16 10:06:29 -07:00
teor
648d8daf12
feature: Initial consensus parameter module
2020-07-16 10:06:29 -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
teor
1915634d2b
Check for bad heights or hashes in checkpoint lists ( #639 )
...
* Add MIN and MAX for BlockHeight and LockTime
* Remove duplicate test cases
* fix a comment about the minimum lock time
The minimum LockTime::Time is 5 November 1985 00:53:20 UTC, so the first
day that only contains valid times is 6 November 1985 (in all timezones).
Similarly, the maximum LockTime::Time is 7 February 2106 06::28::15 UTC,
so the last day that only contains valid times in all time zones is
5 February 2106.
* fix: Reject checkpoint lists with bad hashes or heights
Reject the all-zeroes hash, because it is the parent hash of the genesis
block, and should never appear in a checkpoint list.
Reject checkpoint heights that are greater than the maximum block
height.
2020-07-16 15:09:22 +10:00
teor
851afad01f
fix: Resist CheckpointVerifier memory DoS attacks ( #635 )
...
* fix: Resist CheckpointVerifier memory DoS attacks
Allow a maximum of 2 queued blocks at each height, as a tradeoff between
efficient bad block rejection, and memory usage.
Closes #628 .
* fix: Make max queued blocks at height equal to fanout
* fix: Just allocate all the capacity upfront
* fix: Use with_capacity(1) and reserve_exact(1)
2020-07-15 13:27:10 -07:00
teor
ab6d1f5ec8
fix: Use the default Zcash port in version messages ( #661 )
...
We don't provide our address yet, so the port should be ignored.
But let's use the correct port, to avoid carrying this bug forward into
working code.
2020-07-15 11:43:28 -07: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
teor
a19fdd9f25
fix: Rename to is_time_valid_at
2020-07-15 09:16:54 -07:00
teor
b2bb872df0
Use Unicode for section reference
...
Co-authored-by: Henry de Valence <hdevalence@hdevalence.ca>
2020-07-15 09:16:54 -07:00
teor
c2e4f7b0a5
refactor: Move the local clock check to a BlockHeader method
2020-07-15 09:16:54 -07:00
teor
5548dffd3b
refactor: Move the coinbase first check to a Block method
2020-07-15 09:16:54 -07:00
teor
47bc02ea44
partial revert: Use &Block, not Arc<Block>
2020-07-15 09:16:54 -07:00
Jane Lusby
72ec79dd5e
Update zebra-consensus/src/checkpoint/list.rs
...
Co-authored-by: Alfredo Garcia <oxarbitrage@gmail.com>
2020-07-15 09:16:54 -07:00
teor
6f064e0154
refactor: Use Arc<Block> in BlockVerifier
...
Arc is a bit more flexible when using futures.
And improve the documentation for coinbase_is_first_check.
Closes #627 .
2020-07-15 09:16:54 -07:00
teor
30effa6a46
doc: Improve checkpoint test comments
...
Closes #626 .
2020-07-15 09:16:54 -07:00
teor
e58c913897
refactor: Make max_height call max_height_in_range
...
Closes #630 .
2020-07-15 09:16:54 -07:00
teor
78459afe97
fix: Stop revhex on EOF
2020-07-15 19:19:02 +10:00
Alfredo Garcia
d8834b149a
Limit protocol messages size ( #645 )
...
* change body msg limit and test case
* accept body at the exact limit len
* test the edges of the limit value
2020-07-15 19:15:52 +10:00
teor
12b9fa8ae2
Let zebrad revhex read from stdin ( #648 )
...
* Log at warn level for commands that use stdout
* Let zebrad revhex read from stdin
Most unix tools support reading from stdin, so they can be used in
pipelines.
Part of #564 .
2020-07-15 16:16:07 +10:00
teor
e452ba1c13
fix: Use matches!() based on a new nightly clippy lint
2020-07-15 12:50:11 +10:00
Jane Lusby
dd0cd17b3a
reorder workspace crates ( #651 )
2020-07-14 13:23:43 -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
teor
e1bb95603c
Put zebrad/Cargo.toml in a nicer order ( #650 )
2020-07-14 10:17:05 -07:00
Alfredo Garcia
04b2eeedd0
Longer checkpoint gap test case ( #643 )
...
* create longer checkpoint test
* use futures unordered to syncronize background futures
Co-authored-by: Jane Lusby <jane@zfnd.org>
2020-07-13 09:29:21 -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