Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rococo #320

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
1,934 changes: 1,544 additions & 390 deletions Cargo.lock

Large diffs are not rendered by default.

73 changes: 73 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,79 @@ runtime-benchmarks = [
"laminar-cli/runtime-benchmarks",
]

[patch.crates-io]
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
frame-executive = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
frame-system = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
pallet-authorship = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
pallet-babe = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
pallet-collective = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
pallet-grandpa = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
pallet-indices = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
pallet-membership = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
pallet-multisig = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
pallet-offences = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
pallet-recovery = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
pallet-scheduler = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
pallet-session = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
pallet-staking = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
pallet-staking-reward-curve = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
pallet-sudo = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
pallet-transaction-payment-rpc = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
pallet-treasury = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
pallet-utility = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-authority-discovery = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-client-db = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-consensus-babe-rpc = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-consensus-epochs = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-finality-grandpa-rpc = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-informant = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-offchain = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-rpc-api = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sp-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sp-runtime-interface = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sp-session = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sp-staking = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sp-std = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
sp-version = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }
substrate-frame-rpc-system = { git = "https://github.com/paritytech/substrate", branch = "rococo-branch" }

[workspace]
members = [
"cli",
Expand Down
11 changes: 11 additions & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,25 @@ authors = ["Laminar Developers <hello@laminar.one>"]
edition = "2018"

[dependencies]
log = '0.4.8'
codec = { package = "parity-scale-codec", version = "1.3.0" }
structopt = "0.3.8"
sp-core = { version = "2.0.0-rc5", optional = true }
sc-cli = { version = "0.8.0-rc5", optional = true }
sc-service = { version = "0.8.0-rc5", optional = true }
sp-runtime = { version = "2.0.0-rc5", optional = true }
frame-benchmarking-cli = { version = "2.0.0-rc5", optional = true }

inspect = { package = "laminar-inspect", path = "../inspect" }
service = { package = "laminar-service", path = "../service", default-features = false, optional = true }

dev-runtime = { path = "../runtime/dev" }

cumulus-primitives = { git = "https://github.com/paritytech/cumulus" }
polkadot-cli = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
polkadot-parachain = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", branch = "rococo-branch" }

[build-dependencies]
substrate-build-script-utils = { version = "2.0.0-rc5", default-features = false }

Expand All @@ -25,6 +35,7 @@ cli = [
"sp-core",
"sc-cli",
"sc-service",
"sp-runtime",
"frame-benchmarking-cli",
]
runtime-benchmarks = [ "service/runtime-benchmarks" ]
97 changes: 93 additions & 4 deletions cli/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use sc_cli::RunCmd;
use std::path::PathBuf;

use sc_cli;
use structopt::StructOpt;

/// Possible subcommands of the main binary.
Expand All @@ -18,16 +20,103 @@ pub enum Subcommand {
/// The custom benchmark subcommmand benchmarking runtime modules.
#[structopt(name = "benchmark", about = "Benchmark runtime modules.")]
Benchmark(frame_benchmarking_cli::BenchmarkCmd),

/// Export the genesis state of the parachain.
#[structopt(name = "export-genesis-state")]
ExportGenesisState(ExportGenesisStateCommand),

/// Export the genesis wasm of the parachain.
#[structopt(name = "export-genesis-wasm")]
ExportGenesisWasm(ExportGenesisWasmCommand),
}

/// Command for exporting the genesis state of the parachain
#[derive(Debug, StructOpt)]
pub struct ExportGenesisStateCommand {
/// Output file name or stdout if unspecified.
#[structopt(parse(from_os_str))]
pub output: Option<PathBuf>,

/// Id of the parachain this state is for.
#[structopt(long, default_value = "100")]
pub parachain_id: u32,

/// The name of the chain for that the genesis state should be exported.
#[structopt(long)]
pub chain: Option<String>,
}

/// An overarching CLI command definition.
/// Command for exporting the genesis wasm file.
#[derive(Debug, StructOpt)]
pub struct ExportGenesisWasmCommand {
/// Output file name or stdout if unspecified.
#[structopt(parse(from_os_str))]
pub output: Option<PathBuf>,

/// The name of the chain for that the genesis wasm file should be exported.
#[structopt(long)]
pub chain: Option<String>,
}

#[derive(Debug, StructOpt)]
pub struct RunCmd {
#[structopt(flatten)]
pub base: sc_cli::RunCmd,

/// Id of the parachain this collator collates for.
#[structopt(long)]
pub parachain_id: Option<u32>,
}

impl std::ops::Deref for RunCmd {
type Target = sc_cli::RunCmd;

fn deref(&self) -> &Self::Target {
&self.base
}
}

#[derive(Debug, StructOpt)]
#[structopt(settings = &[
structopt::clap::AppSettings::GlobalVersion,
structopt::clap::AppSettings::ArgsNegateSubcommands,
structopt::clap::AppSettings::SubcommandsNegateReqs,
])]
pub struct Cli {
/// Possible subcommand with parameters.
#[structopt(subcommand)]
pub subcommand: Option<Subcommand>,

#[allow(missing_docs)]
#[structopt(flatten)]
pub run: RunCmd,

/// Relaychain arguments
#[structopt(raw = true)]
pub relaychain_args: Vec<String>,
}

#[derive(Debug)]
pub struct RelayChainCli {
/// The actual relay chain cli object.
pub base: polkadot_cli::RunCmd,

/// Optional chain id that should be passed to the relay chain.
pub chain_id: Option<String>,

/// The base path that should be used by the relay chain.
pub base_path: Option<PathBuf>,
}

impl RelayChainCli {
/// Create a new instance of `Self`.
pub fn new<'a>(
base_path: Option<PathBuf>,
chain_id: Option<String>,
relay_chain_args: impl Iterator<Item = &'a String>,
) -> Self {
Self {
base_path,
chain_id,
base: polkadot_cli::RunCmd::from_iter(relay_chain_args),
}
}
}
Loading