* 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