* Removal of light client from substrate
* add missing import
* These tests relate to there being light and non light clients.
* removing lightnodes from test
* cargo fmt
* not needed
* LightDataChecker not needed any longer
* cargo fmt
* Update client/service/test/src/lib.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Update client/service/test/src/lib.rs
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* cargo fmt
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* Use tokio runtime handle instead of TaskExecutor abstraction
Before this pr we had the `TaskExecutor` abstraction which theoretically
allowed that any futures executor could have been used. However, this
was never tested and is currently not really required. Anyone running a
node currently only used tokio and nothing else (because this was hard
coded in CLI). So, this pr removes the `TaskExecutor` abstraction and
relies directly on the tokio runtime handle.
Besides this changes, this pr also makes sure that the http and ws rpc
server use the same tokio runtime. This fixes a panic that occurred when
you drop the rpc servers inside an async function (tokio doesn't like
that a tokio runtime is dropped in the async context of another tokio
runtime).
As we don't use any custom runtime in the http rpc server anymore, this
pr also removes the `rpc-http-threads` cli argument. If external parties
complain that there aren't enough threads for the rpc server, we could
bring support for increasing the thread count of the tokio runtime.
* FMT
* Fix try runtime
* Fix integration tests and some other optimizations
* Remove warnings
* Store the database in a role specific subdirectory
This is a cleaned up version of #8658 fixing #6880
polkadot companion: paritytech/polkadot#2923
* Disable prometheus in tests
* Also change p2p port
* Fix migration logic
* Use different identification file for rocks and parity db
Add tests for paritydb migration
Remove unneeded dependencies and dev-dependencies.
Made self_destruct test not dependent on wasm bin size.
Updated code related to deprecated warning on tracing-subscriber `scope()`
( See https://github.com/tokio-rs/tracing/issues/1429 )
* Run cargo fmt on the whole code base
* Second run
* Add CI check
* Fix compilation
* More unnecessary braces
* Handle weights
* Use --all
* Use correct attributes...
* Fix UI tests
* AHHHHHHHHH
* 🤦
* Docs
* Fix compilation
* 🤷
* Please stop
* 🤦 x 2
* More
* make rustfmt.toml consistent with polkadot
Co-authored-by: André Silva <andrerfosilva@gmail.com>
* Fix tracing tests (#8022)
* Fix tracing tests
The tests were not working properly.
1. Some test was setting a global subscriber, this could lead to racy
conditions with other tests.
2. A logging test called `process::exit` which is completly wrong.
* Update client/tracing/src/lib.rs
Co-authored-by: David <dvdplm@gmail.com>
* Review comments
Co-authored-by: David <dvdplm@gmail.com>
* Fix tracing spans are not being forwarded to spawned task (#8009)
* Fix tracing spans are not being forwarded to spawned task
There is a bug that tracing spans are not forwarded to spawned task. The
problem was that only the telemetry span was forwarded. The solution to
this is to use the tracing provided `in_current_span` to capture the
current active span and pass the telemetry span explictely. We will now
always enter the span when the future is polled. This is essentially the
same strategy as tracing is doing with its `Instrumented`, but now
extended for our use case with having multiple spans active.
* More tests
* Proper test for telemetry and prefix span
* WIP
* Fix test (need to create & enter the span at the same time)
* WIP
* Remove telemtry_span from sc_service config
* CLEANUP
* Update comment
* Incorrect indent
* More meaningful name
* Dedent
* Naming XD
* Attempt to make a more complete test
* lint
* Missing licenses
* Remove user data
* CLEANUP
* Apply suggestions from code review
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
* CLEANUP
* Apply suggestion
* Update bin/node/cli/tests/telemetry.rs
Co-authored-by: David <dvdplm@gmail.com>
* Wrapping lines
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: David <dvdplm@gmail.com>
* 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>
* Initial commit
Forked at: ad90ab7ec9
Parent branch: origin/master
* Increase killing grace period of CLI tests and display more info
* Use --dev everywhere possible
* Put pruning mode to its own params struct
* Add pruning params to export-blocks command
* Added missing file
* Removed not-dev mode in tests
* Add pruning mode to the revert command
* Decrease killing grace period again
* Move back unsafe_pruning to import_params
* Applied proposed changes
Related to #4776
Related to https://github.com/paritytech/polkadot/pull/832
To summarize the changes:
1. I did not manage to validate with types the service's Configuration. But I did reduce the possibility of errors by moving all the "fill" functions to their respective structopts
2. I split params.rs to multiple modules: one module params for just CLI parameters and one module commands for CLI subcommands (and RunCmd). Every command and params are in their own file so things are grouped better together and easier to remove
3. I removed the run and run_subcommand helpers as they are not helping much anymore. Running a command is always a set of 3 commands: 1. init 2. update config 3. run. This still allow the user to change the config before arguments get parsed or right after.
4. I added tests for all subcommands.
5. [deleted]
Overall the aim is to improve the situation with the Configuration and the optional parameters, add tests, make the API more consistent and simpler.
* Fix CLI setup again
We need to set `config_dir` and `database_path` for almost every
command.
This fixes `purge-chain` and also adds a test to make sure we don't
break it again.
* Adds missing test files
* Split methods
These are a few changes I missed during the refactoring.
1. Initialization issue and boilerplate
Most importantly: part of the `Configuration` initialization was done in `sc_cli::init`. This means the user can not benefit from this initialization boilerplate if they have multiple `Configuration` since `sc_cli::init` can only be called once.
2. Boilerplate for `VersionInfo` and `Configuration`
I'm also answering to the critic of @bkchr on the initialization using version: https://github.com/paritytech/substrate/pull/4692/files/bea809d4c14a2ede953227ac885e3b3f9771c548#r372047238 This will allow initializing a `Configuration` and provide the version by default.
3. Loading the `chain_spec` explicitly
In the past it was done automatically but in some cases we want to delay this. I moved the code to `Configuration.load_spec()` so it can be called later on. `chain_spec` can also be written directly to the `Configuration` without using this `load_spec` helper.
4. [deleted]
5. Fixing issue that prevents the user to override the port
In the refactoring I introduced a bug by mistake that could potentially prevent the CLI user to override the ports if defaults where provided for these ports (only on cumulus).
6. Change task_executor from Box to Arc
This is useful for cumulus where we have 2 nodes with 2 separate Configuration that need to spawn tasks to the same runtime.
7. Renamed TasksExecutorRequired to TaskExecutor
For consistency.
This is related to https://github.com/paritytech/cumulus/issues/24
This is the continuation (and hopefully the end of) #4692