Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Merge Subkey into sc-cli #4954

Merged
111 commits merged into from
Aug 20, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
73b899b
draft
seunlanlege Feb 17, 2020
3c6d4fd
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege Mar 4, 2020
742df00
revert
seunlanlege Mar 4, 2020
f118c3a
WIP
seunlanlege Mar 10, 2020
0490b61
Merge branch 'seun-merge-sc-cli-and-subkey' of github.com:paritytech/…
seunlanlege Mar 10, 2020
0a1df9c
all that remains is tests
seunlanlege Mar 11, 2020
fa92dfa
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege Mar 13, 2020
386cfcf
update Cargo.lock
seunlanlege Mar 13, 2020
fccf7ba
tests WIP
seunlanlege Mar 13, 2020
26e21da
WIP refactor node-template-runtime and node-runtime
seunlanlege Mar 16, 2020
aea449b
implments sc_cli::RuntimeAdapter for node_template_runtime::Runtime
seunlanlege Mar 17, 2020
f96d007
final draft
seunlanlege Mar 17, 2020
ddbf1a8
fix update_config for subcommands
seunlanlege Mar 18, 2020
fa4feb1
proper AccountId decoding
seunlanlege Mar 18, 2020
4815f3d
test-runtime tests
seunlanlege Mar 18, 2020
f8a6728
revert
seunlanlege Mar 20, 2020
d186457
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege Mar 20, 2020
70d1dbe
move RuntimeAdapter to cli-utils
seunlanlege Mar 20, 2020
aa71995
use &'static str for TryFrom::<&'a str>::Error for Ss58AddressFormat
seunlanlege Mar 20, 2020
65eeefc
tests
seunlanlege Mar 20, 2020
1ee33bb
add frame-system to sc-cli dev-dependencies
seunlanlege Mar 20, 2020
e5336b6
add frame-system to sc-cli dev-dependencies
seunlanlege Mar 20, 2020
643ba68
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege Apr 14, 2020
cf6f0b9
fix ui test
seunlanlege Apr 15, 2020
428d7aa
merge with master
seunlanlege Apr 30, 2020
6a4d66a
wip
seunlanlege May 5, 2020
8536991
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege May 5, 2020
e23b87b
fixed inspect test
seunlanlege May 6, 2020
62e9e0d
bump impl version
seunlanlege May 6, 2020
03ca897
bump impl version, fixx spaces remove todos
seunlanlege May 6, 2020
cd4cad5
pallet-balances-cli, rustc for some reason cannot resolve pallet_bala…
seunlanlege May 7, 2020
5e351b9
wip
seunlanlege May 8, 2020
07413ef
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege May 8, 2020
de123f2
Subcommand::run takes &self
seunlanlege May 8, 2020
c1a5b31
can't believe i missed that 🤦🏾‍♂️
seunlanlege May 8, 2020
57228de
bump wasm-bindgen for some reason
seunlanlege May 8, 2020
9a49f10
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege May 11, 2020
1c84698
adds key subcommand, rename generate-node-key to generate-node-id
seunlanlege May 11, 2020
66d1494
cargo update and crossed fingers 🤞🏽
seunlanlege May 11, 2020
fa4de23
update ui test
seunlanlege May 11, 2020
000b4ad
update more ui tests
seunlanlege May 11, 2020
1c4048a
should be all good now
seunlanlege May 12, 2020
93c38bf
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege May 12, 2020
fce2b0d
revert subkey change
seunlanlege May 12, 2020
cc46757
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege May 12, 2020
f06ce66
revert subkey change
seunlanlege May 12, 2020
f279e14
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege May 15, 2020
7ac9a2e
adds frame-utilities-cli
seunlanlege May 18, 2020
ce642a2
Apply suggestions from code review
seunlanlege May 18, 2020
de582ee
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege May 18, 2020
2937b8c
removes frame from sc-cli, fix license
seunlanlege May 18, 2020
a9d25a3
my editor and ci disagrees on line width
seunlanlege May 18, 2020
f5d0e46
bump spec version
seunlanlege May 18, 2020
1a556ca
turn off default features for parity-scale-codec
seunlanlege May 18, 2020
5a0616b
enable full_crypto feature for sp-core in cli-utils
seunlanlege May 18, 2020
ec22841
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege May 18, 2020
69ab3ee
merge frame-utilities-cli with pallet-balances-cli
seunlanlege May 18, 2020
5f670a6
remove full_crypto feature from sp_core in cli-utils
seunlanlege May 19, 2020
627aa69
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege May 19, 2020
0ad4d48
bump Cargo.lock
seunlanlege May 19, 2020
7b4cd95
cli-utils -> frame-utils
seunlanlege May 21, 2020
6f12be9
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege May 21, 2020
aa8ecb9
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege May 21, 2020
a0fe47d
rename BlockNumber to GenericNumber, fix spaces
seunlanlege May 25, 2020
1ee5967
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege May 25, 2020
2573c91
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege May 25, 2020
762ed30
fix spaces
seunlanlege May 25, 2020
9130156
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege May 29, 2020
8c19813
construct additional_signed manually
seunlanlege Jun 1, 2020
b0d21d8
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege Jun 2, 2020
753f5eb
sign test
seunlanlege Jun 2, 2020
2a4374b
remove unused vars
seunlanlege Jun 2, 2020
3342d06
implement subkey with frame-utilities-cli and sc_cli
seunlanlege Jun 2, 2020
0590bbf
fix moduleid test
seunlanlege Jun 2, 2020
5ac0694
CI and clion disagree on line widths
seunlanlege Jun 2, 2020
daeed15
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege Jun 8, 2020
aa16d9c
adds associated Params type to SignedExtensionProvider
seunlanlege Jun 9, 2020
83d9487
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege Jun 11, 2020
54277a7
Apply suggestions from code review
seunlanlege Jun 11, 2020
22049d3
move some code around
seunlanlege Jun 11, 2020
c683181
removes unneccesary generic params
seunlanlege Jun 11, 2020
a1535f6
moves module_id back to frame_utilities_cli
seunlanlege Jun 15, 2020
655e53a
Apply suggestions from code review
seunlanlege Jun 15, 2020
974ef0a
remove print_ext
seunlanlege Jun 15, 2020
c78e838
Merge branch 'seun-sc-cli-subkey' of github.com:paritytech/substrate …
seunlanlege Jun 15, 2020
86f149a
remove MaybeDisplay from pallet_balances::Trait::Balance
seunlanlege Jun 15, 2020
e7f732b
a lot of stuff tbh
seunlanlege Jun 15, 2020
2be821f
adds ExtrasParamsBuilder
seunlanlege Jun 15, 2020
a7dd087
remove tests for ModuleIdCmd
seunlanlege Jun 15, 2020
51c35c4
address comments from PR
seunlanlege Jun 16, 2020
cddc46d
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege Jun 16, 2020
20d695a
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege Jun 18, 2020
e5e8b59
bump Cargo.lock
seunlanlege Jun 18, 2020
08d4f24
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege Jun 19, 2020
e7820c7
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege Jun 22, 2020
faab8db
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege Jul 14, 2020
bbb9079
manually insert key into keystore
seunlanlege Jul 14, 2020
cc7542c
remove unnecessary SharedParams
seunlanlege Jul 14, 2020
f4af111
add validation to vanity pattern, remove unused arg
seunlanlege Jul 22, 2020
2553e0e
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege Jul 22, 2020
e24b0c5
Merge remote-tracking branch 'origin/master' into seun-sc-cli-subkey
gnunicorn Aug 10, 2020
cd0f083
remove SharedParams from Sign, Vanity, Verify
seunlanlege Aug 10, 2020
153c346
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege Aug 11, 2020
4dc44e7
remove SharedParams from ModuleIdCmd, remove expect from Verify, new …
seunlanlege Aug 11, 2020
3bb63c0
remove SharedParams from InsertCmd
seunlanlege Aug 11, 2020
30b49fd
🤦🏾‍♂️
seunlanlege Aug 11, 2020
9598c0b
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege Aug 11, 2020
f145c8e
deleted prometheus.yml
seunlanlege Aug 11, 2020
94511ab
move a few things around
seunlanlege Aug 17, 2020
b342028
Merge branch 'master' of github.com:paritytech/substrate into seun-sc…
seunlanlege Aug 17, 2020
0a50728
fix vanity test
seunlanlege Aug 20, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
implments sc_cli::RuntimeAdapter for node_template_runtime::Runtime
  • Loading branch information
seunlanlege committed Mar 17, 2020
commit aea449b006fb4f3f5dcb97f7c117f49819e9d568
26 changes: 25 additions & 1 deletion bin/node-template/node/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use sc_cli::{RunCmd, Subcommand};
use structopt::StructOpt;
use sc_cli::{RunCmd, Subcommand, RuntimeAdapter};
use node_template_runtime::{Runtime, SignedExtra, Index};
use sp_runtime::generic::Era;
use sp_core::sr25519;

#[derive(Debug, StructOpt)]
pub struct Cli {
Expand All @@ -9,3 +12,24 @@ pub struct Cli {
#[structopt(flatten)]
pub run: RunCmd,
}

pub struct Adapter;

impl RuntimeAdapter for Adapter {
type Pair = sr25519::Pair;
type Public = sr25519::Public;
type Signature = sr25519::Signature;
type Runtime = Runtime;
type Extra = SignedExtra;

fn build_extra(index: Index) -> Self::Extra {
(
frame_system::CheckVersion::new(),
frame_system::CheckGenesis::new(),
frame_system::CheckEra::from(Era::Immortal),
seunlanlege marked this conversation as resolved.
Show resolved Hide resolved
frame_system::CheckNonce::from(index),
frame_system::CheckWeight::new(),
pallet_transaction_payment::ChargeTransactionPayment::from(0),
seunlanlege marked this conversation as resolved.
Show resolved Hide resolved
)
}
}
29 changes: 2 additions & 27 deletions bin/node-template/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,8 @@
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.

use sp_consensus_aura::sr25519::{AuthorityPair as AuraPair};
use sc_cli::{VersionInfo, RuntimeAdapter};
use node_template_runtime::{Runtime, SignedExtra, Index, Balance};
use crate::{chain_spec, service, cli::Cli};
use sp_runtime::{MultiSignature, MultiSigner, generic::Era, traits::StaticLookup};
use sp_core::sr25519;

struct Adapter;

impl RuntimeAdapter for Adapter {
type Pair = sr25519::Pair;
type Public = sr25519::Public;
type Signature = MultiSignature;
type Runtime = Runtime;
type Extra = SignedExtra;
type Address = <pallet_indices::Module<Runtime> as StaticLookup>::Source;

fn build_extra(index: Index) -> Self::Extra {
(
frame_system::CheckVersion::new(),
frame_system::CheckGenesis::new(),
frame_system::CheckEra::from(Era::Immortal),
frame_system::CheckNonce::from(index),
frame_system::CheckWeight::new(),
pallet_transaction_payment::ChargeTransactionPayment::from(0),
)
}
}
use sc_cli::VersionInfo;
use crate::{chain_spec, service, cli::{Cli, Adapter}};

/// Parse and run command line arguments
pub fn run(version: VersionInfo) -> sc_cli::Result<()> {
Expand Down
6 changes: 3 additions & 3 deletions bin/node-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));

use sp_std::prelude::*;
use sp_core::OpaqueMetadata;
use sp_core::{OpaqueMetadata, sr25519};
use sp_runtime::{
ApplyExtrinsicResult, transaction_validity::TransactionValidity, generic, create_runtime_str,
impl_opaque_keys, MultiSignature,
impl_opaque_keys,
};
use sp_runtime::traits::{
BlakeTwo256, Block as BlockT, IdentityLookup, Verify, ConvertInto, IdentifyAccount
Expand Down Expand Up @@ -44,7 +44,7 @@ pub use template;
pub type BlockNumber = u32;

/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
pub type Signature = MultiSignature;
pub type Signature = sr25519::Signature;

/// Some way of identifying an account on the chain. We intentionally make it equivalent
/// to the public key of our transaction signing scheme.
Expand Down
106 changes: 53 additions & 53 deletions bin/node/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,68 +42,68 @@ structopt = { version = "0.3.8", optional = true }
tracing = "0.1.10"

# primitives
sp-authority-discovery = { version = "2.0.0-alpha.2", path = "../../../primitives/authority-discovery" }
sp-consensus-babe = { version = "0.8.0-alpha.2", path = "../../../primitives/consensus/babe" }
grandpa-primitives = { version = "2.0.0-alpha.2", package = "sp-finality-grandpa", path = "../../../primitives/finality-grandpa" }
sp-core = { version = "2.0.0-alpha.2", path = "../../../primitives/core" }
sp-runtime = { version = "2.0.0-alpha.2", path = "../../../primitives/runtime" }
sp-timestamp = { version = "2.0.0-alpha.2", default-features = false, path = "../../../primitives/timestamp" }
sp-finality-tracker = { version = "2.0.0-alpha.2", default-features = false, path = "../../../primitives/finality-tracker" }
sp-inherents = { version = "2.0.0-alpha.2", path = "../../../primitives/inherents" }
sp-keyring = { version = "2.0.0-alpha.2", path = "../../../primitives/keyring" }
sp-io = { version = "2.0.0-alpha.2", path = "../../../primitives/io" }
sp-consensus = { version = "0.8.0-alpha.2", path = "../../../primitives/consensus/common" }
sp-authority-discovery = { version = "2.0.0-alpha.3", path = "../../../primitives/authority-discovery" }
sp-consensus-babe = { version = "0.8.0-alpha.3", path = "../../../primitives/consensus/babe" }
grandpa-primitives = { version = "2.0.0-alpha.3", package = "sp-finality-grandpa", path = "../../../primitives/finality-grandpa" }
sp-core = { version = "2.0.0-alpha.3", path = "../../../primitives/core" }
sp-runtime = { version = "2.0.0-alpha.3", path = "../../../primitives/runtime" }
sp-timestamp = { version = "2.0.0-alpha.3", default-features = false, path = "../../../primitives/timestamp" }
sp-finality-tracker = { version = "2.0.0-alpha.3", default-features = false, path = "../../../primitives/finality-tracker" }
sp-inherents = { version = "2.0.0-alpha.3", path = "../../../primitives/inherents" }
sp-keyring = { version = "2.0.0-alpha.3", path = "../../../primitives/keyring" }
sp-io = { version = "2.0.0-alpha.3", path = "../../../primitives/io" }
sp-consensus = { version = "0.8.0-alpha.3", path = "../../../primitives/consensus/common" }

# client dependencies
sc-client-api = { version = "2.0.0-alpha.2", path = "../../../client/api" }
sc-client = { version = "0.8.0-alpha.2", path = "../../../client/" }
sc-chain-spec = { version = "2.0.0-alpha.2", path = "../../../client/chain-spec" }
sc-transaction-pool = { version = "2.0.0-alpha.2", path = "../../../client/transaction-pool" }
sp-transaction-pool = { version = "2.0.0-alpha.2", path = "../../../primitives/transaction-pool" }
sc-network = { version = "0.8.0-alpha.2", path = "../../../client/network" }
sc-consensus-babe = { version = "0.8.0-alpha.2", path = "../../../client/consensus/babe" }
grandpa = { version = "0.8.0-alpha.2", package = "sc-finality-grandpa", path = "../../../client/finality-grandpa" }
sc-client-db = { version = "0.8.0-alpha.2", default-features = false, path = "../../../client/db" }
sc-offchain = { version = "2.0.0-alpha.2", path = "../../../client/offchain" }
sc-rpc = { version = "2.0.0-alpha.2", path = "../../../client/rpc" }
sc-basic-authorship = { version = "0.8.0-alpha.2", path = "../../../client/basic-authorship" }
sc-service = { version = "0.8.0-alpha.2", default-features = false, path = "../../../client/service" }
sc-tracing = { version = "2.0.0-alpha.2", path = "../../../client/tracing" }
sc-telemetry = { version = "2.0.0-alpha.2", path = "../../../client/telemetry" }
sc-authority-discovery = { version = "0.8.0-alpha.2", path = "../../../client/authority-discovery" }
sc-client-api = { version = "2.0.0-alpha.3", path = "../../../client/api" }
sc-client = { version = "0.8.0-alpha.3", path = "../../../client/" }
sc-chain-spec = { version = "2.0.0-alpha.3", path = "../../../client/chain-spec" }
sc-transaction-pool = { version = "2.0.0-alpha.3", path = "../../../client/transaction-pool" }
sp-transaction-pool = { version = "2.0.0-alpha.3", path = "../../../primitives/transaction-pool" }
sc-network = { version = "0.8.0-alpha.3", path = "../../../client/network" }
sc-consensus-babe = { version = "0.8.0-alpha.3", path = "../../../client/consensus/babe" }
grandpa = { version = "0.8.0-alpha.3", package = "sc-finality-grandpa", path = "../../../client/finality-grandpa" }
sc-client-db = { version = "0.8.0-alpha.3", default-features = false, path = "../../../client/db" }
sc-offchain = { version = "2.0.0-alpha.3", path = "../../../client/offchain" }
sc-rpc = { version = "2.0.0-alpha.3", path = "../../../client/rpc" }
sc-basic-authorship = { version = "0.8.0-alpha.3", path = "../../../client/basic-authorship" }
sc-service = { version = "0.8.0-alpha.3", default-features = false, path = "../../../client/service" }
sc-tracing = { version = "2.0.0-alpha.3", path = "../../../client/tracing" }
sc-telemetry = { version = "2.0.0-alpha.3", path = "../../../client/telemetry" }
sc-authority-discovery = { version = "0.8.0-alpha.3", path = "../../../client/authority-discovery" }

# frame dependencies
pallet-indices = { version = "2.0.0-alpha.2", path = "../../../frame/indices" }
pallet-timestamp = { version = "2.0.0-alpha.2", default-features = false, path = "../../../frame/timestamp" }
pallet-contracts = { version = "2.0.0-alpha.2", path = "../../../frame/contracts" }
frame-system = { version = "2.0.0-alpha.2", path = "../../../frame/system" }
pallet-balances = { version = "2.0.0-alpha.2", path = "../../../frame/balances" }
pallet-transaction-payment = { version = "2.0.0-alpha.2", path = "../../../frame/transaction-payment" }
frame-support = { version = "2.0.0-alpha.2", default-features = false, path = "../../../frame/support" }
pallet-im-online = { version = "2.0.0-alpha.2", default-features = false, path = "../../../frame/im-online" }
pallet-authority-discovery = { version = "2.0.0-alpha.2", path = "../../../frame/authority-discovery" }
pallet-indices = { version = "2.0.0-alpha.3", path = "../../../frame/indices" }
pallet-timestamp = { version = "2.0.0-alpha.3", default-features = false, path = "../../../frame/timestamp" }
pallet-contracts = { version = "2.0.0-alpha.3", path = "../../../frame/contracts" }
frame-system = { version = "2.0.0-alpha.3", path = "../../../frame/system" }
pallet-balances = { version = "2.0.0-alpha.3", path = "../../../frame/balances" }
pallet-transaction-payment = { version = "2.0.0-alpha.3", path = "../../../frame/transaction-payment" }
frame-support = { version = "2.0.0-alpha.3", default-features = false, path = "../../../frame/support" }
pallet-im-online = { version = "2.0.0-alpha.3", default-features = false, path = "../../../frame/im-online" }
pallet-authority-discovery = { version = "2.0.0-alpha.3", path = "../../../frame/authority-discovery" }

# node-specific dependencies
node-runtime = { version = "2.0.0-alpha.2", path = "../runtime" }
node-rpc = { version = "2.0.0-alpha.2", path = "../rpc" }
node-primitives = { version = "2.0.0-alpha.2", path = "../primitives" }
node-executor = { version = "2.0.0-alpha.2", path = "../executor" }
node-runtime = { version = "2.0.0-alpha.3", path = "../runtime" }
node-rpc = { version = "2.0.0-alpha.3", path = "../rpc" }
node-primitives = { version = "2.0.0-alpha.3", path = "../primitives" }
node-executor = { version = "2.0.0-alpha.3", path = "../executor" }

# CLI-specific dependencies
sc-cli = { version = "0.8.0-alpha.2", optional = true, path = "../../../client/cli" }
frame-benchmarking-cli = { version = "2.0.0-alpha.2", optional = true, path = "../../../utils/frame/benchmarking-cli" }
node-transaction-factory = { version = "0.8.0-alpha.2", optional = true, path = "../transaction-factory" }
node-inspect = { version = "0.8.0-alpha.2", optional = true, path = "../inspect" }
sc-cli = { version = "0.8.0-alpha.3", optional = true, path = "../../../client/cli" }
frame-benchmarking-cli = { version = "2.0.0-alpha.3", optional = true, path = "../../../utils/frame/benchmarking-cli" }
node-transaction-factory = { version = "0.8.0-alpha.3", optional = true, path = "../transaction-factory" }
node-inspect = { version = "0.8.0-alpha.3", optional = true, path = "../inspect" }

gnunicorn marked this conversation as resolved.
Show resolved Hide resolved
# WASM-specific dependencies
wasm-bindgen = { version = "0.2.57", optional = true }
wasm-bindgen-futures = { version = "0.4.7", optional = true }
browser-utils = { package = "substrate-browser-utils", path = "../../../utils/browser", optional = true, version = "0.8.0-alpha.2" }
browser-utils = { package = "substrate-browser-utils", path = "../../../utils/browser", optional = true, version = "0.8.0-alpha.3" }

[dev-dependencies]
sc-keystore = { version = "2.0.0-alpha.2", path = "../../../client/keystore" }
sc-consensus-babe = { version = "0.8.0-alpha.2", features = ["test-helpers"], path = "../../../client/consensus/babe" }
sc-consensus-epochs = { version = "0.8.0-alpha.2", path = "../../../client/consensus/epochs" }
sc-keystore = { version = "2.0.0-alpha.3", path = "../../../client/keystore" }
sc-consensus-babe = { version = "0.8.0-alpha.3", features = ["test-helpers"], path = "../../../client/consensus/babe" }
sc-consensus-epochs = { version = "0.8.0-alpha.3", path = "../../../client/consensus/epochs" }
sc-service-test = { version = "2.0.0-dev", path = "../../../client/service/test" }
futures = "0.3.1"
tempfile = "3.1.0"
Expand All @@ -112,14 +112,14 @@ nix = "0.17"
serde_json = "1.0"

[build-dependencies]
build-script-utils = { version = "2.0.0-alpha.2", package = "substrate-build-script-utils", path = "../../../utils/build-script-utils" }
build-script-utils = { version = "2.0.0-alpha.3", package = "substrate-build-script-utils", path = "../../../utils/build-script-utils" }
structopt = { version = "0.3.8", optional = true }
node-transaction-factory = { version = "0.8.0-alpha.2", optional = true, path = "../transaction-factory" }
node-inspect = { version = "0.8.0-alpha.2", optional = true, path = "../inspect" }
frame-benchmarking-cli = { version = "2.0.0-alpha.2", optional = true, path = "../../../utils/frame/benchmarking-cli" }
node-transaction-factory = { version = "0.8.0-alpha.3", optional = true, path = "../transaction-factory" }
node-inspect = { version = "0.8.0-alpha.3", optional = true, path = "../inspect" }
frame-benchmarking-cli = { version = "2.0.0-alpha.3", optional = true, path = "../../../utils/frame/benchmarking-cli" }

[build-dependencies.sc-cli]
version = "0.8.0-alpha.2"
version = "0.8.0-alpha.3"
package = "sc-cli"
path = "../../../client/cli"
optional = true
Expand Down
32 changes: 30 additions & 2 deletions bin/node/cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@
use sc_cli::VersionInfo;
use sc_service::{Roles as ServiceRoles};
use node_transaction_factory::RuntimeAdapter;
use crate::{Cli, service, ChainSpec, load_spec, Subcommand, factory_impl::FactoryState};
use crate::{
Cli, service, ChainSpec, load_spec, Subcommand,
factory_impl::FactoryState,
};
use sp_runtime::generic::Era;
use node_primitives::{Signature, AccountId, Index};
use node_runtime::{Runtime, SignedExtra};

/// Parse command line arguments into service configuration.
pub fn run<I, T>(args: I, version: VersionInfo) -> sc_cli::Result<()>
Expand Down Expand Up @@ -106,10 +112,32 @@ where
Some(Subcommand::Base(subcommand)) => {
subcommand.init(&version)?;
subcommand.update_config(&mut config, load_spec, &version)?;
subcommand.run(
subcommand.run::<Adapter, _, _, _>(
config,
|config: sc_service::Configuration| Ok(new_full_start!(config).0),
)
},
}
}

pub struct Adapter;

impl sc_cli::RuntimeAdapter for Adapter {
type Pair = ();
type Public = ();
type Signature = Signature;
type Runtime = Runtime;
type Extra = SignedExtra;

fn build_extra(index: Index) -> Self::Extra {
(
frame_system::CheckVersion::new(),
frame_system::CheckGenesis::new(),
frame_system::CheckEra::from(Era::Immortal),
frame_system::CheckNonce::from(index),
frame_system::CheckWeight::new(),
pallet_transaction_payment::ChargeTransactionPayment::from(0),
pallet_contracts::CheckBlockGasLimit::default(),
)
}
}
1 change: 1 addition & 0 deletions client/cli/src/commands/insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ pub struct InsertCmd {
}

impl InsertCmd {
/// Run the command
pub fn run<RA: RuntimeAdapter>(self) -> error::Result<()>
where
HashFor<RA>: DeserializeOwned + Serialize + Send + Sync,
Expand Down
1 change: 1 addition & 0 deletions client/cli/src/commands/inspect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pub struct InspectCmd {
}

impl InspectCmd {
/// Run the command
pub fn run<RA: RuntimeAdapter>(self) -> error::Result<()>
where
AccountIdFor<RA>: Ss58Codec + Derive,
Expand Down
14 changes: 6 additions & 8 deletions client/cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ mod insert;
pub mod tests;

use std::fmt::{Debug, Display};
use std::str::FromStr;
use structopt::StructOpt;

use sc_service::{ Configuration, ServiceBuilderCommand, ChainSpec };
use sp_runtime::traits::{Block as BlockT, Header as HeaderT, IdentifyAccount};
use sp_core::crypto::{Ss58Codec, Derive};
use parity_scale_codec::Codec;
use sc_service::{Configuration, ServiceBuilderCommand, ChainSpec};
use sp_runtime::traits::{Block as BlockT, Header as HeaderT};

use crate::error;
use crate::VersionInfo;
Expand All @@ -60,9 +62,6 @@ pub use crate::commands::sign_transaction::SignTransactionCmd;
pub use crate::commands::transfer::TransferCmd;
pub use crate::commands::vanity::VanityCmd;
pub use crate::commands::verify::VerifyCmd;
use sp_core::crypto::{Ss58Codec, Derive};
use std::str::FromStr;
use parity_scale_codec::{Codec, WrapperTypeEncode};


/// default sub directory to store network config
Expand Down Expand Up @@ -156,8 +155,7 @@ impl Subcommand {
RA: RuntimeAdapter,
AccountIdFor<RA>: Ss58Codec + Derive,
<IndexFor<RA> as FromStr>::Err: Display,
CallFor<RA>: Codec + WrapperTypeEncode,
RA::Address: From<<RA::Public as IdentifyAccount>::AccountId>,
CallFor<RA>: Codec,
{
match self {
Subcommand::BuildSpec(cmd) => cmd.run(config),
Expand Down
1 change: 1 addition & 0 deletions client/cli/src/commands/sign.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pub struct SignCmd {


impl SignCmd {
/// Run the command
pub fn run<RA: RuntimeAdapter>(self) -> error::Result<()> {
let message = read_message(self.message, self.hex)?;
let suri = read_uri(self.suri)?;
Expand Down
10 changes: 5 additions & 5 deletions client/cli/src/commands/sign_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ use super::{
RuntimeAdapter, IndexFor, CallFor,
};
use structopt::StructOpt;
use parity_scale_codec::{WrapperTypeEncode, Codec, Encode, Decode};
use parity_scale_codec::{Codec, Encode, Decode};
use std::{str::FromStr, fmt::Display};
use sp_runtime::traits::IdentifyAccount;
use sc_service::{Configuration, ChainSpec};

type Call = Vec<u8>;
Expand Down Expand Up @@ -53,11 +52,12 @@ pub struct SignTransactionCmd {
}

impl SignTransactionCmd {
pub fn run<RA: RuntimeAdapter>(self) -> error::Result<()>
/// Run the command
pub fn run<RA>(self) -> error::Result<()>
where
RA: RuntimeAdapter,
<IndexFor<RA> as FromStr>::Err: Display,
CallFor<RA>: Codec + WrapperTypeEncode,
RA::Address: From<<RA::Public as IdentifyAccount>::AccountId>,
CallFor<RA>: Codec,
{
let signer = RA::pair_from_suri(&self.suri, &get_password(&self.shared_params)?);

Expand Down
1 change: 0 additions & 1 deletion client/cli/src/commands/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ impl RuntimeAdapter for Adapter {
frame_system::CheckNonce<Runtime>,
frame_system::CheckWeight<Runtime>,
);
type Address = <pallet_indices::Module<Runtime> as StaticLookup>::Source;

fn build_extra(index: IndexFor<Self>) -> Self::Extra {
(
Expand Down
Loading