Transaction factory (#2481)

* Fix typos

* Add transaction factory

`cargo run -- purge-chain -y --chain dev && cargo run -- --dev --transaction-factory 10`

* Fix comment and remove build deps

* Move crate to test-utils

* Switch from flag to subcommand

`cargo run -- factory --dev --num 5`

* Decouple factory from node specifics

* Introduce different manufacturing modes

* Remove unrelated changes

* Update Cargo.lock

* Use SelectChain to fetch best block

* Improve expect proof

* Panic if factory executed with unsupported chain spec

* Link ToDo comments to follow-up ticket

* Address comments and improve style

* Remove unused dependencies

* Fix indent level

* Replace naked unwrap

* Update node/cli/src/factory_impl.rs

* Fix typo

* Use inherent_extrinsics instead of timestamp

* Generalize factory and remove saturated conversions

* Format imports

* Make it clearer that database needs to be empty

* Ensure factory settings

* Apply suggestions from code review

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

* Update test-utils/transaction-factory/src/lib.rs

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

* Fix match guard syntax

* Simplify import, remove empty line

* Update node/cli/Cargo.toml

* Update lockfile
This commit is contained in:
Michael Müller
2019-05-28 17:01:43 +02:00
committed by Gavin Wood
parent 811124234d
commit a706d994cb
14 changed files with 898 additions and 12 deletions
+5 -4
View File
@@ -49,10 +49,10 @@ use structopt::{StructOpt, clap::AppSettings};
pub use structopt::clap::App;
use params::{
RunCmd, PurgeChainCmd, RevertCmd, ImportBlocksCmd, ExportBlocksCmd, BuildSpecCmd,
NetworkConfigurationParams, SharedParams, MergeParameters, TransactionPoolParams,
NetworkConfigurationParams, MergeParameters, TransactionPoolParams,
NodeKeyParams, NodeKeyType
};
pub use params::{NoCustom, CoreParams};
pub use params::{NoCustom, CoreParams, SharedParams};
pub use traits::{GetLogFilter, AugmentClap};
use app_dirs::{AppInfo, AppDataType};
use log::info;
@@ -178,7 +178,7 @@ fn is_node_name_valid(_name: &str) -> Result<(), &str> {
///
/// `CC` is a custom subcommand. This needs to be an `enum`! If no custom subcommand is required,
/// `NoCustom` can be used as type here.
/// `RP` is are custom parameters for the run command. This needs to be a `struct`! The custom
/// `RP` are custom parameters for the run command. This needs to be a `struct`! The custom
/// parameters are visible to the user as if they were normal run command parameters. If no custom
/// parameters are required, `NoCustom` can be used as type here.
pub fn parse_and_execute<'a, F, CC, RP, S, RS, E, I, T>(
@@ -582,7 +582,8 @@ where
Ok(())
}
fn create_config_with_db_path<F, S>(
/// Creates a configuration including the database path.
pub fn create_config_with_db_path<F, S>(
spec_factory: S, cli: &SharedParams, version: &VersionInfo,
) -> error::Result<FactoryFullConfiguration<F>>
where
+1 -1
View File
@@ -16,7 +16,7 @@
use structopt::{StructOpt, clap::App};
/// Something that can augment a clapp app with further parameters.
/// Something that can augment a clap app with further parameters.
/// `derive(StructOpt)` is implementing this function by default, so a macro `impl_augment_clap!`
/// is provided to simplify the implementation of this trait.
pub trait AugmentClap: StructOpt {