Commit Graph

151 Commits

Author SHA1 Message Date
pscott 540ae1c161 Update SubstrateCli to return String (#6550)
* Update SubstrateCli to return String

* Add default implementation for executable_name()

* Use display instead of PathBuf

* Get file_name in default impl of executable_name

* Remove String::from and use .into()

* Use default impl for executable_name()

* Use .as_str() and remove useless .to_string()

* Update only sp-io when running companion build

* Remove unneeded update of sp-io in CI

Co-authored-by: Cecile Tonglet <cecile@parity.io>
2020-07-02 13:34:56 +02:00
Cecile Tonglet 7b0028d75a Drop the tokio runtime before the task_manager (#6548)
* Initial commit

Forked at: ece0364170
Parent branch: origin/master

* Drop the tokio runtime before the task_manager

The tokio runtime must be dropped before the task_manager. Otherwise the objects the task_manager
keep alive are dropped before the tasks are finished.
2020-07-02 13:02:08 +02:00
Ashley 5f751e4472 Remove ServiceBuilderCommand and implement the chain ops as standalone functions instead. (#6543)
* :)

* Slight tidy

* Remove ServiceBuilderCommand

* Remove whitespace

* Keep task manager alive for check_block/import_blocks

* Pass task_manager to run_until_exit

* Make task_manager in run_until_exit and make subcommands async

* Change the async_run fn to return a future and task manager

* async_run should take a result fn

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Fix spaces in export_raw_state

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-07-02 12:57:56 +02:00
cheme 424d5c722d Restrict Protected to some heap types. (#6471)
* Restrict `Protected` to some heap types.

* Comment abut Protected usage.

* Remove Protected from crypto, use secrecy crate for existing uses.

* use a parse function

* fix error convert

* Rename and move secretY string function.

* std result
2020-07-01 09:59:07 +00:00
Ashley b832e35c5e Remove the service, replacing it with a struct of individual chain components (#6352)
* WIP

* Making progress

* Almost ready

* Get service tests compiling

* Fix node screenshot

* Line widths

* Fix node cli tests

* Fix node cli warning

* ChainComponents -> ServiceComponents, fix tests

* make spawn_handle public

* Remove spawnnamed impl for taskmanager

* Move the keep alive stuff to the task manager

* Move the telemetry, base path, rpc keep_alive to the service builder

* Make the task manager keep alive an internal detail

* Rewrite the browser start_client future

* Remove run_node etc

* Revert my personal changes to browser-demo/build.sh

* use |config|

* Add a runtime_version function to SubstrateCli

* Reexport role and runtime version from sc cli

* Update Cargo.lock

* runtime_version -> native_runtime_version

* Pass chain spec to native_runtime_version for polkadot

* Fix line widths

* Traitify ServiceComponents Client
2020-06-30 11:00:42 +01:00
Pierre Krieger 505540a2a0 Increase the limit for the maximum size of the telemetry name (#6523)
* Increase the limit for the maximum size of the telemetry name

* Fix test
2020-06-26 14:48:11 +00:00
Pierre Krieger 39c3d1c026 Fix an extra semi-colon yielding a wrong error (#6520)
* Fix an extra semi-colon yielding a wrong error

* Update client/cli/src/commands/run_cmd.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-06-26 08:05:24 +00:00
Benjamin Kampmann f6ebd5f87d Releasing rc4 – Rhinoceros (#6515)
Co-authored-by: Martin Pugh <pugh@s3kr.it>
2020-06-25 23:18:43 +02:00
Ashley d976f712b1 Fix the browser node and ensure it doesn't colour the informant output (#6457)
* Fix browser informant

* Fix documentation

* Add an informant_output_format function to the cli config

* Wrap informant output format in an option

* Revert batch verifier

* Remove wasm-timer from primitives io cargo lock

* Drop informant_output_format function

* derive debug for output format
2020-06-23 16:50:33 +02:00
Cecile Tonglet 63793c8b97 impl Debug for sc_service::Configuration (#6400)
* Initial commit

Forked at: 252416d385
No parent branch.

* Make sc_service::Configuration derive Debug

* Replace task_executor fn's input by proper TaskExecutor type (cleaner)

* impl From<Fn> for TaskExecutor

* Update client/cli/src/runner.rs

* Add some doc, examples and tests

* Replace Deref by fn spawn as suggested

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-06-23 12:47:13 +02:00
Pierre Krieger dd7830d481 Remove --legacy-network-protocol CLI flag (#6411) 2020-06-19 00:23:58 +02:00
Demi Obenour e2f5e4bd74 Add IPC support (#6348)
This is useful for both security and performance reasons. IPC is faster
than TCP, and it is subject to OS access controls.
2020-06-16 13:14:12 +03:00
André Silva 2b59d57c4c client: use appropriate ExecutionContext for initial sync / regular import (#6180)
* client: use appropriate ExecutionContext for sync/import

* client: remove dead code

* client: ExecutionContext: distinguish between own and foreign imports

* client: fix cli parameter doc

* Revert "client: ExecutionContext: distinguish between own and foreign imports"

This reverts commit 0fac11520704c364a82432c5b927e987ba043cdb.

* primitives: add docs for ExecutionContext

* cli: execution strategy docs

* cli: use different execution context for importing block on validator

* cli: remove defaults from execution context flags
2020-06-12 14:22:21 +02:00
Cecile Tonglet e3fc4f7fba Add a feature to create automatically a random temporary directory for base path & remove Clone (#6221)
* Initial commit

Forked at: 4adac40c07
Parent branch: origin/master

* Add a feature to create automatically a temporary directory for base path

* doc fix and todos

* use parking_lot instead

* use refcell instead since we stay in the main thread

* remove Clone derives

* add test

* solving dependency issue

* clarifying doc

* conflict argument with base-path

* WIP

Forked at: 4adac40c07
Parent branch: origin/master

* revert dep deletion

* fixing test and making base_path optional

* hold basepath while the service is running

* fixes

* Update client/cli/src/params/shared_params.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/service/Cargo.toml

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/cli/src/commands/mod.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/service/src/config.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* WIP

Forked at: 4adac40c07
Parent branch: origin/master

* improve doc

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-06-10 13:13:25 +02:00
Cecile Tonglet 8034285da4 Allow adding a prefix to the informant (#6174)
* Initial commit

Forked at: 1d93746b64
Parent branch: origin/master

* Add a Service Configuration's field + adapt informant + provide means to CLI

* CLEANUP

Forked at: 1d93746b64
Parent branch: origin/master

* fix tests

* fixed bad path to object

* Change OutputFormat enum to struct

* Add informant_prefix to builder and service

* Revert "Change OutputFormat enum to struct"

This reverts commit cd86c583c92668426c35cc174401155bf2880c1f.

* Revert "fix tests"

This reverts commit a3c306ebe94720f350c5bc74b9c5fcde2565d340.

* Revert "Add a Service Configuration's field + adapt informant + provide means to CLI"

This reverts commit 9c2e7267423305705916c30d605893524113c8e3.

* Implementation using the ServiceBuilder

* reduce line length

* fix line width again

* WIP

Forked at: 1d93746b64
Parent branch: origin/master

* WIP

Forked at: 1d93746b64
Parent branch: origin/master

* WIP

Forked at: 1d93746b64
Parent branch: origin/master

* use struct instead of enum

* WIP

Forked at: 1d93746b64
Parent branch: origin/master

* Update client/service/src/lib.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* improve doc

* Update client/service/src/builder.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/service/src/builder.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* change code

* Update client/informant/src/lib.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* enable_color

* reorg log

* remove macro

* Removed builder for informant prefix

* fix doc

* Update client/informant/src/lib.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/informant/src/lib.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/informant/src/lib.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/informant/src/lib.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/service/src/builder.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/service/src/builder.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/service/src/builder.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-06-09 14:29:01 +02:00
Benjamin Kampmann 881072e590 Intent to release rc3 (#6290) 2020-06-08 23:29:52 +02:00
Cecile Tonglet 60337aa765 Add run_full_node, run_light_node and print_node_infos to the API (#6233)
* Initial commit

Forked at: e77490714d
Parent branch: origin/master

* Add run_full_node, run_light_node and print_node_infos to the API

* Update runner.rs
2020-06-03 17:50:29 +02:00
Nikolay Volf 28ccad4118 fix millis display (#6227) 2020-06-03 11:18:10 +02:00
Dan Forbes 4b6537fbba Fix Rustdoc Build (#6207) 2020-06-01 22:54:13 +02:00
Bastian Köcher 8a7c2c3142 CLI: Make --dev conflict with --chain (#6146)
If we are running `--dev` chain, we should forbid the `--chain`
argument. The `--dev` chain is always special by only having one
authority etc and some other chain spec is probably not setup for this
correctly. In the end `--dev` is just a shortcut for `--validator --alice`.
2020-05-26 21:25:15 +02:00
Benjamin Kampmann b64f55089d Releasing rc2 (#6136) 2020-05-26 14:32:23 +02:00
Benjamin Kampmann fb32ac8c51 Tagging as rc1 2020-05-25 18:30:48 +02:00
Arkadiy Paronyan 56819a09a4 Fix default base path on windows (#6120)
* Use directories instead of app_dirs

* Use local data dir
2020-05-25 13:25:49 +02:00
pscott 18d4fa10d2 Add JSON format to import blocks and set it as default (#5816)
* Add BlockStream Enum and utility fn

* WIP: Modify import closure to work with BlockStream

* Fix trait bounds

* Working prototype

* Revamp block importing

* Add export_import_flow tests

* Add comments and clean code

* Add more comments in the import fn

* Add link code to import function

* Add condition when returning Ready(Ok(()) to make sure we've imported every block

* Add check for imported blocks in JSON case

* Use rest pattern

* Fix compilation error for undeclared variable

* Add polling and waker before pending

* Print read_block_count instead of count

* Simplify binary cli option with structopt

* Update test to reflect changes in CLI api

* Change Stream to take SignedBlock<B> instead of B

* Add comments to BlockStream

* Move out logic to smaller functions for clearer code

* Remove result over import_blocks return type

* Check for error in command output rather than simply checking command exit status

* Revamp export/import/revert testing

* Fix minor typos and formatting errors

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Remove unnecessary if condition in terminating condition

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Explicit error instead of returning it as a string

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Pass BlockStream to log_importing_status_updates and simplify matching arms for block stream

* Use .contains() instead of regex match

* Line break in match block; return future::ready instead of poll_fn

* Update Cargo.lock

* Add check so that queue doesn't grow too big

* Use Iterator instead of Stream

* Remove allow dead_code

* Remove outdated comments

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Return Errors instead of logging them

* Simplify match arms

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Remove check before terminating block import

* Apply suggestions from code review

* Check that queue is not full BEFORE calling

* Revert "Remove check before terminating block import"

This reverts commit 377823c0a648a3eb2e61185a257a61023067893d.

* Improve unit tests to make sure we actually import blocks

* Remove Unpin implementation for BlockIter

* Add prototype of enum for ImportStates

* Add working prototype for StateMachine

* Add comments for clearer code

* Add sleep before calling Waker when waiting for import queue

* Add Speedometer

* add dbg!(&log) for test debugging

* Fix lines with more than 100 cols

* Fix regex capture for test

* Update regexes to take to capture the whole number

* Rename Cmd to Command

Co-authored-by: Gavin Wood <gavin@parity.io>

* Actually rename Cmd to Command

* Apply suggestions from code review

Co-authored-by: Gavin Wood <gavin@parity.io>

* Fix compilation errors for tests

* Fix compilation errors from code review suggestion

* Update bin/node/cli/tests/export_import_flow.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Gavin Wood <gavin@parity.io>
Co-authored-by: Benjamin Kampmann <ben@gnunicorn.org>
2020-05-22 13:50:25 +02:00
clearloop 3cd546cf80 chore(client): remove the unnecessary clap dep (#6107) 2020-05-22 01:38:31 +02:00
Arkadiy Paronyan 6c47b130e8 Handle piping error for commands that output to stdout (#6098)
* Handle piping error for commands that output to stdout

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-05-21 13:50:37 +02:00
Pierre Krieger 717fa95bc7 Restore the empty line after the license (#6088) 2020-05-20 13:08:27 +00:00
Pierre Krieger 8b9bd9018e Upgrade to libp2p v0.19 - Changes the default PeerId representation (#6064)
* Upgrade to libp2p v0.19

* Listen on IPv6 by default

* Increase channels sizes

* Use spec-compliant noise protocol

* Show legacy PeerId

* Switch order of Noise protocols

* Switch to crates.io version

* Fix subkey's version

* Fix line width and Wasm build

* I think Wasm is fixed for real this time
2020-05-18 19:57:08 +02:00
Nikolay Volf d5411969ac fix whitespace (#6062) 2020-05-18 13:51:28 +02:00
Benjamin Kampmann 7c565085e9 resetting to -dev (#6050) 2020-05-16 19:03:04 +02:00
Benjamin Kampmann d7463d348f Releasing Alpha.8 (#6048) 2020-05-15 21:56:56 +02:00
Benjamin Kampmann be8c96adec Relax substrate licensing scheme (#5947) 2020-05-15 13:21:56 +02:00
Pierre Krieger d169a48dfb Don't log the yamux errors by default (#6034) 2020-05-14 18:21:07 +02:00
Bastian Köcher daf8cf0600 Handle clap errors manually and don't reset SIGPIPE (#6012)
Instead of resetting `SIGPIPE` to the system default handler, we now
handle a clap error manually and ignore any error when writing to
`stdout`/`stderr`. In this way, the node does not silently stops when it
encounters a `SIGPIPE` in normal mode and we still support piping of the
cli output.
2020-05-13 19:43:38 +02:00
Pierre Krieger 9220bdf361 Spawn the network worker with spawn_blocking (#5909)
* Spawn the network worker with spawn_blocking

* Some comment adjustments

* Fix shutdown not working
2020-05-12 17:12:32 +02:00
Pierre Krieger 0690bb51a8 Allow passing multiple --log CLI options (#5982)
* Allow passing multiple --log CLI options

* Comment typo
2020-05-12 11:46:06 +02:00
Bastian Köcher 6a6f2554b4 Make sure config_mut returns a mutable reference (#5942) 2020-05-07 22:07:46 +02:00
Igor Matuszewski 9acf88f58b client: Replace unsafe_rpc_expose with an RpcMethods enum (#5729)
* client: Replace `unsafe_rpc_expose` with an `RpcMethods` enum

which can be either Default, Safe or Unsafe. The idea is to have the
following:
|                       | --rpc-external=false  | --rpc-external=true   |
|---------------------  |-------------------    |-----------------      |
| --rpc-methods=Default |                       | unsafe calls denied   |
| --rpc-methods=Safe    | unsafe calls denied   | unsafe calls denied   |
| --rpc-methods=Unsafe  |                       |                       |
Since the previous `unsafe-rpc-expose` option was confusing.

* client: Only warn against exposing externally unsafe RPC method set

* Apply suggestions from code review

Co-Authored-By: Cecile Tonglet <cecile.tonglet@cecton.com>

* cli: Rephrase doc comment for rpc_methods config

* Improve debuggability of build_spec_works

...by printing to stderr the stderr of the command. This is normally
suppressed for succesful tests but not for failing ones - if that's the
case then it's useful to see the test failure reason inline rather than
having to execute the command separately ourselves.

* Rename RpcMethods::{Default => Auto} variant

* Update bin/node/cli/tests/build_spec_works.rs

Co-authored-by: Benjamin Kampmann <ben.kampmann@googlemail.com>
Co-authored-by: Cecile Tonglet <cecile.tonglet@cecton.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-05-06 11:30:54 +02:00
Benjamin Kampmann 3860999ea3 post release dev reset (#5911) 2020-05-05 22:08:31 +01:00
Benjamin Kampmann 45886bd197 Release of Alpha.7 (#5904) 2020-05-05 20:50:46 +02:00
Bastian Köcher 5b8d3607e9 Adds export-state subcommand (#5842)
* Export state cli

* More work

* Fix tests

* Make it work

* Fix compilation

* Apply suggestions from code review
2020-04-30 15:44:40 +02:00
Arkadiy Paronyan c3a6d8a881 Fix purge-chain and print DB info on startup (#5840)
* purge-chain accepts --db option

* print DB info on startup

* Small refactoring

* Added back &self

* Add DatabaseParams for PurgeChain, ImportParams and ExportBlocks

* Don't force default value

* Remove unused fields

* Update client/cli/src/commands/export_blocks_cmd.rs

* Fix stuff

Co-authored-by: Cecile Tonglet <cecile@parity.io>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-04-30 14:53:04 +02:00
Saqib Rokadia aff24d6fbb Adding optional public addresses for proxying (#5807)
* Adding optional public addresses for use in network configurations to allow for proxies in front of a node.

* Apply suggestions from code review

Co-Authored-By: Cecile Tonglet <cecile.tonglet@cecton.com>

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Cecile Tonglet <cecile.tonglet@cecton.com>
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
2020-04-29 19:08:30 +02:00
pscott 0f401e4699 Move spawning tasks from thread pools to Service's TaskManager for block importing (#5647)
Co-Authored-By: Pierre Krieger <pierre.krieger1708@gmail.com>
2020-04-29 18:46:39 +02:00
Seun Lanlege 4fa5941f44 Move sc-client into sc-service (#5502)
* Drop client from sc-network and sc-client-db, move LongestChain to sc-client-api

* move leaves, cht, in_mem to sc-client-api, drop client from sc-finality-grandpa

* drop sc-service from sc-rpc

* drop sc-service from sc-consensus-aura

* drop sc-client from manual-seal and babe

* drop sc-client from utils/frame/rpc/system and utils/frame/benchmarking-cli

* drop sc-client from bin/node and bin/node-template

* drop sc-client

* fix tests

* remove check -p sc-client from gitlab.yml

* fix warnings

* fixes ui test

* fix light client tests

* adds associated Client type to AbstractService

* adds UsageProvider to Client

* fixed ui test, again

* tried and failed to get node-cli to compile for wasm

* thanks to tomaka for helping me get node-cli to compile for wasmm

* ui test pls pas 🙏🏾

* all tests passing 🪄

* no_run documentation code

* rm -f documentation code

* ClientProvider

* fix mega trait

* move LongestChain to sc-consensus, use adds minimal bounds to AbstractService::Client

* adds license to sc-consensus

Co-authored-by: Benjamin Kampmann <ben@parity.io>
2020-04-28 11:59:31 +00:00
Cecile Tonglet 8ae3ecf3cd Fix remaining issues with unsafe_pruning (#5810)
* Initial commit

Forked at: bf61cece1c
Parent branch: origin/master

* Fix remaining issues with unsafe_pruning

* Revert "Fix remaining issues with unsafe_pruning"

This reverts commit 9c42c2f9b361b13ee19f39b264e52dfaa46cfcbb.

* Just remove is_dev
2020-04-28 11:44:44 +02:00
André Silva 5662501258 cli: fix unused unsafe-pruning flag (#5803) 2020-04-27 22:01:35 +02:00
Bernhard Schuster 72ee7d5797 feat/ocw/bookkeeping (#5200)
Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
Co-Authored-By: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
2020-04-24 16:46:19 +02:00
Pierre Krieger 6a7e86e677 Use new block requests protocol (#5760)
* Use new block requests protocol

* Tweak comment
2020-04-24 13:48:22 +02:00
Toralf Wittner 421ef498f4 network: Only insert global addresses into the DHT. (#5735)
* network: Only insert global addresses into the DHT.

Currently every address reported via libp2p-identify is inserted into
the DHT which thus contains a multitude of unreachable addresses such
as from 127.0.0.0/8 or 10.0.0.0/8.

Issue #5099 suggested a dedicated service over UDP to gauge the
reachability of an address, which would however incur extra I/O costs
and be of limited use.

As an alternative and simpler tactic, this PR only allows global IP
addresses to be inserted into the DHT unless an explicit command-line
flag `--allow-non-global-addresses-in-dht` is given or a node is
started with `--dev`. This opt-in behaviour is meant to allow
site-local networks to still make use of a DHT.

* Enable non-global in more test setups.

* Replace command-line option with different name.

* Another test fix.
2020-04-23 09:52:20 +02:00