Commit Graph

735 Commits

Author SHA1 Message Date
Henry de Valence dcd3f7bb2d tower-batch: copy tower-buffer source code.
There's a lot of functional overlap between the batch design and tower-buffer's
existing internals, so we'll just vendor its source code and modify it.
If/when we upstream it, we can deduplicate common components.
2020-06-16 14:35:42 -07:00
Deirdre Connolly dab3eeca3c Go back to stable clippy-check
The experimental one duplicates outputs X however many github checks run, rust or not.
2020-06-16 17:14:27 -04:00
Jane Lusby 685bdaf2df don't require absense of cancel handles
Prior to this change, we required that services that are canceled do not
have a cancel handle in the `cancel_handles` list, based on the
assumption that the handle must have been removed in the process of
canceling this service.

This doesn't holding up though, because it is currently possible for us
to have the same peer connect to us multiple times, the second connect
removes the cancel handle of the original connect and inserts it's own
cancel handle in its place. In this scenario, when the first service is
polled for readiness it will see that it has been canceled and go to
clean itself up, but when it asserts that it doesn't have a cancel
handle it will see the cancel handle of the second connect event, which
uses the same key as the first connect, and fail its debug assertion.

This change removes that debug assert on the assumption that it is okay
for a peer to connect multiple times consecutively, and that the correct
behavior in that case is to just cancel the first connection and
continue as normal.
2020-06-16 13:42:31 -07:00
Jane Lusby 06fd3b2503 be more explicit with pattern in drain_requests 2020-06-16 12:04:45 -07:00
Jane Lusby b0ecd019b6 apply comments from code review 2020-06-16 12:04:45 -07:00
Jane Lusby d09c339dc5 little more cleaning 2020-06-16 12:04:45 -07:00
Jane Lusby 528fd2b5b1 add an outline of the structure of the node 2020-06-16 12:04:45 -07:00
Jane Lusby fc96a41b18 copy connect command into start command 2020-06-16 12:04:45 -07:00
dependabot[bot] 42fc386bb9 Bump thiserror from 1.0.19 to 1.0.20
Bumps [thiserror](https://github.com/dtolnay/thiserror) from 1.0.19 to 1.0.20.
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/1.0.19...1.0.20)

Signed-off-by: dependabot[bot] <support@github.com>
2020-06-16 09:51:05 -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
Jane Lusby bb0553fab6
implement initial persistent state backend based on `sled` (#473) 2020-06-15 14:41:26 -07:00
dependabot[bot] 5afea58fe2 Bump serde from 1.0.111 to 1.0.112
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.111 to 1.0.112.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.111...v1.0.112)

Signed-off-by: dependabot[bot] <support@github.com>
2020-06-15 14:11:11 -04: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
dependabot[bot] 7710ee20dc Bump pin-project from 0.4.20 to 0.4.22
Bumps [pin-project](https://github.com/taiki-e/pin-project) from 0.4.20 to 0.4.22.
- [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.20...v0.4.22)

Signed-off-by: dependabot[bot] <support@github.com>
2020-06-15 10:57:19 -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
Deirdre Connolly a577303329 Create zbot.yml 2020-06-13 06:15:20 -04:00
Jane Lusby 4b9e4520ce
cleanup API for arc based error type (#469)
Co-authored-by: Jane Lusby <jane@zfnd.org>
2020-06-12 11:29:42 -07:00
teor 334329f38a state: Move block header hashing to block_index
Only hash block headers in the lowest-level block index code.

This design has a few benefits:
  - failures are obvious, because the hash is not available,
  - get_tip() returns a smaller object,
  - we avoid re-hashing block headers multiple times.

These efficiency changes may be needed to support chain reorganisations,
multiple tips, and heavy query loads.
2020-06-12 09:46:18 -07: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 8072d5b7e8 state: Add an Error type alias to ZebraState 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 ba61498a7f Ignore emacs temp files 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
teor 603e243c18 design: Add validation to the design doc
Add validation for:
  - blocks in the chain, and
  - transactions in the chain and mempool.

Also:
  - Note that zebra-script may do some script validation.
  - Describe the zebra-consensus dependencies.

Part of #428.
2020-06-12 09:46:18 -07:00
teor 088d0dc94b design: Make parsing explicit in the design doc 2020-06-12 09:46:18 -07:00
Jane Lusby df656a8bf0
Reorganize `connect` subcommand for readibility (#450) 2020-06-12 09:20:58 -07:00
George Tankersley d8b3db5679 Use new seeder address for yolo.money 2020-06-10 21:49:25 -04:00
George Tankersley 6606bcaa62 Update list of DNS seeders
This adds the Foundation's new seeders and removes Simon's defunct one.
2020-06-10 20:56:31 -04:00
dependabot[bot] 32d1b9c4f9 Bump codecov/codecov-action from v1 to v1.0.7
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from v1 to v1.0.7.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Commits](https://github.com/codecov/codecov-action/compare/v1...f532c3a1452359a7f96c37efc741537b80555c74)

Signed-off-by: dependabot[bot] <support@github.com>
2020-06-09 17:47:18 -04:00
dependabot[bot] 3666db7a42 Bump w9jds/firebase-action from v1.1.0 to v1.3.1
Bumps [w9jds/firebase-action](https://github.com/w9jds/firebase-action) from v1.1.0 to v1.3.1.
- [Release notes](https://github.com/w9jds/firebase-action/releases)
- [Commits](https://github.com/w9jds/firebase-action/compare/v1.1.0...92e616d7667df9bd5c7d9c6a1ff50e9f79861a65)

Signed-off-by: dependabot[bot] <support@github.com>
2020-06-09 17:47:00 -04:00
Deirdre Connolly 1f28e535ec Label github action updates as 'infrastructure' 2020-06-09 17:46:33 -04:00
dependabot-preview[bot] 78f09c5360 Create Dependabot config file 2020-06-09 17:00:32 -04:00
Jane Lusby 431f194c0f
propagate errors out of zebra_network::init (#435)
Prior to this change, the service returned by `zebra_network::init` would spawn background tasks that could silently fail, causing unexpected errors in the zebra_network service.

This change modifies the `PeerSet` that backs `zebra_network::init` to store all of the `JoinHandle`s for each background task it depends on. The `PeerSet` then checks this set of futures to see if any of them have exited with an error or a panic, and if they have it returns the error as part of `poll_ready`.
2020-06-09 12:24:28 -07:00
Deirdre Connolly d61cf27d74
Turn off the project workflow, reorg some CI jobs (#451)
* Remove 'assign to project' workflow

Doesn't work with external PRs.

* Reorg CI jobs a bit

* Also upgrade gcloud sdk to version 295.0.0
2020-06-08 21:03:51 -04:00
Deirdre Connolly 42cc55b0bb Remove testing tokio task
That fires 'GetPeers' requests at our running 'zebra seed'.
2020-06-08 19:26:23 -04:00
Deirdre Connolly 43b77b080e Fix 'dos' feature for seed command, and Buffer the seed service 2020-06-08 19:26:23 -04:00
Deirdre Connolly 8f5e7c268b Request::Peers not GetPeers 2020-06-08 19:26:23 -04:00
dependabot-preview[bot] 97aceae461 Bump pin-project from 0.4.19 to 0.4.20
Bumps [pin-project](https://github.com/taiki-e/pin-project) from 0.4.19 to 0.4.20.
- [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.19...v0.4.20)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-06-06 19:03:48 -04: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