Commit Graph

76 Commits

Author SHA1 Message Date
Niklas Adolfsson 91933d857d perf(ethcore): `micro-opt` (#10405)
Mostly fixes that changes `eagerly eval` to `lazy eval`
2019-03-06 15:30:35 +01:00
Andrew Jones 97cb010df8 Silence Error::cause deprecations (#10438) 2019-03-02 13:18:18 +01:00
Afri Schoedon 7c335e8764
misc: bump license header to 2019 (#10135)
* misc: bump license header to 2019

* misc: remove_duplicate_empty_lines.sh

* misc: run license header script

* commit cargo lock
2019-01-07 11:33:07 +01:00
Andronik Ordian dc3b1ecdd0 light(on_demand): decrease default time window to 10 secs (#10016)
* light(on_demand): decrease default time window to 10 secs

* light(on_demand): use secs units for cli options
2018-12-05 19:17:26 +08:00
Niklas Adolfsson 7fb33796b1 light client : failsafe crate (circuit breaker) (#9790)
* refactor(light) : N/W calls with `circuit breaker`

* fix(nits) : forgot to commit new files

* Add tests and change CLI args

* Address grumbles

* fix(failsafe-rs) : Santize input to prevent panics

* chore(failsafe) : bump failsafe, (parking_lot)

Bump failsafe to v0.3.0 to enable `parking_lot::Mutex` instead
`spin::Mutex`

* Remove `success_rate`

* feat(circuit_breaker logger)

* feat(CLI): separate CLI args request and response

* Fix tests

* Error response provide request kind

When a reponse `times-out` provide the actual request or requests that failed

* Update ethcore/light/src/on_demand/mod.rs

Co-Authored-By: niklasad1 <niklasadolfsson1@gmail.com>

* Update ethcore/light/src/on_demand/mod.rs

Co-Authored-By: niklasad1 <niklasadolfsson1@gmail.com>

* fix(grumbles): formatting nit

* fix(grumbles)

* Use second resolution on CLI args
* Use `consecutive failure policy` instead of `timeOverWindow`
* Add a couple of tests for `request_guard`

* fix(request_guard): off-by-one error, update tests
2018-12-05 10:36:53 +01:00
cheme 61f4534e2a Allow dropping light client RPC query with no results (#9318)
* OnDemand no longer loop until there is a query.
All peer known at the time will be queried, and the query fail if all
return no reply.
Returning the failure is done through an empty Vec of reply (the type
of the oneshot channel remains unchanged).
Before this commit the query were send randomly to any peer until there
is a reply (for a query that got no result it was an issue, for other
queries it was quering multiple times the same peers).
After this commit the first query is random but next queries
follows hashmap iterator order.

Test no_capability was broken by this commit (the pending query was
removed).

* OnDemand no longer loop until there is a query.
All peer known at the time will be queried, and the query fail if all
return no reply.
Returning the failure is done through an empty Vec of reply (the type
of the oneshot channel remains unchanged).
Before this commit the query were send randomly to any peer until there
is a reply (for a query that got no result it was an issue, for other
queries it was quering multiple times the same peers).
After this commit the first query is random but next queries
follows hashmap iterator order.

Test no_capability was broken by this commit (the pending query was
removed). If adding some kind of timeout mechanism it could be restored.

* Comment plus better field names.

* No panick on dropped oneshot channel.

* Use Set to avoid counter heuristic

* Cli option `on_demand_nb_retry` for maximum number of retry when doing
on demand query in light client.

* Missing test update for previous commit

* Add a timeout (only when there is no peer to query), that way we do not
set number of query to minimum current number peer or configured number
of query : that way capability test was restored.

* Adding an error type for on_demand, it helps having variant of error
reported at rpc level : choice of rpc error code error might not be
right.

* Duration as constant is nice

* Switch to duration in main too

* Fix indentation (sorry for that).

* Fix error management (bad merge in previous commit)

* Lots of english corrections, major change on the new command parameters :
 - use standard '-' instead of '_'
 - renaming nb_retry params to 'on-demand-retry-count'
2018-09-12 11:47:01 +02:00
Niklas Adolfsson 6888a968f9 Light `clippy(fy)` (#9473)
* wasm tests

* `clippyfy` light-client

* Revert inefficient change `collect_ready()`
2018-09-06 15:44:40 +02:00
Jim Posen 9ed43230ca Better support for eth_getLogs in light mode (#9186)
* Light client on-demand request for headers range.

* Cache headers in HeaderWithAncestors response.

Also fulfills request locally if all headers are in cache.

* LightFetch::logs fetches missing headers on demand.

* LightFetch::logs limit the number of headers requested at a time.

* LightFetch::logs refactor header fetching logic.

* Enforce limit on header range length in light client logs request.

* Fix light request tests after struct change.

* Respond to review comments.
2018-08-25 23:06:01 +02:00
Niklas Adolfsson b2cf5d2958 Make `Capabilities struct` Copy (#9372) 2018-08-20 13:53:47 +03:00
Niklas Adolfsson 98b7c07171 Update `license header` and `scripts` (#8666)
* Update `add_license` script

* run script

* add `remove duplicate lines script` and run it

* Revert changes `English spaces`

* strip whitespaces

* Revert `GPL` in files with `apache/mit license`

* don't append `gpl license` in files with other lic

* Don't append `gpl header` in files with other lic.

* re-ran script

* include c and cpp files too

* remove duplicate header

* rebase nit
2018-06-04 10:19:50 +02:00
Pierre Krieger 364a1fa5a8 Fix a division by zero in light client RPC handler (#7917) 2018-02-17 21:54:39 +01:00
Pierre Krieger 2c60a53fef Randomize the peer we dispatch to (#7844) 2018-02-08 21:36:46 +01:00
Robert Habermeier 2c426defd9
remove check_hangup hack now that is_canceled exists (#7620) 2018-01-18 18:19:04 +01:00
Robert Habermeier c7aed335ce update back-references more aggressively after answering from cache (#7578) 2018-01-17 09:45:36 +01:00
Robert Habermeier b010fb5004 Light Client: fetch transactions/receipts by transaction hash (#6641)
* rpc: transaction/receipt requests made async

* rpc: light client fetches transaction and uncle by hash/index

* on_demand: request type for transaction index

* serve transaction index requests in light protocol

* add a test for transaction index serving

* fetch transaction and receipts by hash on light client

* fix decoding tests

* light: more lenient cost table parsing (backwards compatible)

* fix tests and warnings

* LES -> PIP

* Update provider.rs

* proper doc comments for public functions
2017-10-08 18:19:27 +02:00
Lorenzo Manacorda 5f025cc1b8
Rename Requests to Batch 2017-09-24 20:09:30 +02:00
Robert Habermeier ad39446e87 Revert "fixed master (#6465)"
This reverts commit 899538ae25.
2017-09-05 17:54:05 +02:00
Marek Kotewicz 899538ae25 fixed master (#6465)
* fixed master

* Revert "Merge pull request #6370 from paritytech/light-poa"

This reverts commit 3c60f99def, reversing
changes made to b731ccea18.
2017-09-05 14:53:09 +02:00
Robert Habermeier 372779915f Merge branch 'master' into light-poa 2017-09-04 12:30:37 +02:00
Hawstein 7b8af30590 remove re-export of parking_lot in util (#6435) 2017-09-02 20:09:13 +02:00
Robert Habermeier 2ff3dff6ea serve epoch signals over network and check them 2017-08-23 15:37:35 +02:00
Robert Habermeier 70ef33f6fe Light client improvements (#6156)
* no seal checking

* import command and --no-seal-check for light client

* fix eth_call

* tweak registry dapps lookup

* ignore failed requests to non-server peers
2017-07-27 13:50:12 +02:00
Vurich 17de29e69a Prevent disconnect from within handler (and style cleanup) 2017-06-30 12:10:12 +02:00
Vurich 5eba9078fc Report whether a peer was kept from `Handler::on_connect` 2017-06-30 11:00:32 +02:00
Robert Habermeier 386cdb830d Back-references for the on-demand service (#5573)
* header back-references for on demand

* initial back-reference implementation for on demand requests

* answer requests from cache

* answer requests from cache, add tests

* strongly typed responses for vectors of homogeneous requests

* fix fallout in RPC without optimizing
2017-05-23 12:39:25 +02:00
Robert Habermeier 2a6f38c587 removing slienced warning 2017-05-12 17:53:10 +02:00
Robert Habermeier 909f3d76d8 optimize back-reference filling 2017-05-12 17:25:02 +02:00
Robert Habermeier 68ec7ae41e tests for on_demand 2017-04-07 19:35:39 +02:00
Robert Habermeier 5793bb8fac typestrong API 2017-04-06 20:01:09 +02:00
Robert Habermeier d19232a848 use cache in on-demand again 2017-04-06 17:22:05 +02:00
Robert Habermeier 574cfae470 dispatch batched requests 2017-04-06 15:34:48 +02:00
Robert Habermeier 08d8709ef6 checked request for OnDemand 2017-04-05 18:56:01 +02:00
Robert Habermeier 35740456a4 generalize RequestBuilder 2017-04-05 15:02:44 +02:00
Robert Habermeier 1b0a369889 return default accounts from on_demand 2017-03-28 18:55:23 +02:00
Robert Habermeier 45c0a97142 fix body encoding 2017-03-23 18:52:54 +01:00
Robert Habermeier 5700f4ac81 fix block response decoding 2017-03-23 18:31:16 +01:00
Robert Habermeier 10a470a5fa better bookkeeping of requests in light sync 2017-03-23 15:44:16 +01:00
Robert Habermeier ec52a4a235 more tracing in on-demand 2017-03-23 13:24:04 +01:00
Robert Habermeier 77f036ee21 fix capabilities-interpreting error in on_demand 2017-03-23 04:38:08 +01:00
Robert Habermeier a55001ad1d fix deadlock in on_demand 2017-03-23 02:55:25 +01:00
Robert Habermeier 219eddf33e Merge branch 'master' into pip-msg 2017-03-22 13:14:28 +01:00
Tomasz Drwięga 7e87e9e8ad Updating JSON-RPC crates (#4934)
* New version of jsonrpc.

* Better invalid encoding messages

* Fixing deprecated methods of tokio_core

* Using dedicated branch for jsonrpc

* Bump
2017-03-22 07:02:14 +01:00
Robert Habermeier 7ad36ee36c Merge remote-tracking branch 'upstream/new-jsonrpc' into pip-msg 2017-03-21 21:15:06 +01:00
Robert Habermeier fe52e969b6 Merge branch 'master' into pip-msg 2017-03-21 15:24:47 +01:00
Tomasz Drwięga 958a8f66a0
Merge branch 'master' into new-jsonrpc 2017-03-21 09:35:50 +01:00
Marek Kotewicz a555686bcd rlp serialization refactor (#4873)
* fixed naming of rlp modules

* RlpStream cleanup

* appending short rlp lists (0...55 bytes) is 25% faster

* RlpStream does not use bytes module, nor trait Stream

* removed unused code from rlp module

* compiling ethcore-util with new rlp serialization

* compiling parity with new rlp serialization

* fixed compiling ethcore-light with new rlp serialization

* fixed compiling ethsync with new rlp serialization

* removed redundant comment, print

* removed redundant double-space

* replace usage of WriteBytesExt with ByteOrder
2017-03-20 19:14:29 +01:00
Robert Habermeier b5527415d6 get on_demand tests to compile 2017-03-16 20:33:45 +01:00
Robert Habermeier 04f106aad8 migrate oneshot::complete to send in on_demand 2017-03-16 20:29:06 +01:00
Robert Habermeier cbb9314531 use PIP messages in on_demand, old API 2017-03-16 20:23:59 +01:00
Tomasz Drwięga 579cff478d
Fixing deprecated methods of tokio_core 2017-03-16 15:48:08 +01:00