Fix substrate factory CLI command (#3239)

* CLI execution flag for import-blocks and factory.

* Fix minimum_balance bug with CLI factory.
This commit is contained in:
Jim Posen
2019-07-29 17:06:13 +02:00
committed by Bastian Köcher
parent c9c0ad4756
commit 8aa367c27a
8 changed files with 54 additions and 19 deletions
@@ -83,13 +83,8 @@ where
let seed = factory_state.start_number() + factory_state.block_no();
let to = RA::gen_random_account_id(&seed);
let amount;
if factory_state.round() == RA::Number::zero() {
amount = RA::minimum_balance() * factory_state.rounds();
} else {
let rounds_left = factory_state.rounds() - factory_state.round();
amount = RA::minimum_balance() * rounds_left;
};
let rounds_left = factory_state.rounds() - factory_state.round();
let amount = RA::minimum_balance() * rounds_left.into();
let transfer = factory_state.transfer_extrinsic(
&from.0,
@@ -21,7 +21,6 @@
use std::collections::HashMap;
use std::sync::Arc;
use std::ops::Mul;
use std::cmp::PartialOrd;
use std::fmt::Display;
@@ -51,7 +50,7 @@ mod simple_modes;
pub trait RuntimeAdapter {
type AccountId: Display;
type Balance: Display + Mul;
type Balance: Display + SimpleArithmetic + From<Self::Number>;
type Block: BlockT;
type Index: Copy;
type Number: Display + PartialOrd + SimpleArithmetic + Zero + One;
@@ -77,13 +76,13 @@ pub trait RuntimeAdapter {
sender: &Self::AccountId,
key: &Self::Secret,
destination: &Self::AccountId,
amount: &Self::Number,
amount: &Self::Balance,
prior_block_hash: &<Self::Block as BlockT>::Hash,
) -> <Self::Block as BlockT>::Extrinsic;
fn inherent_extrinsics(&self) -> InherentData;
fn minimum_balance() -> Self::Number;
fn minimum_balance() -> Self::Balance;
fn master_account_id() -> Self::AccountId;
fn master_account_secret() -> Self::Secret;
fn extract_index(&self, account_id: &Self::AccountId, block_hash: &<Self::Block as BlockT>::Hash) -> Self::Index;