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 v1 #338

Draft
wants to merge 22 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
4,797 changes: 3,336 additions & 1,461 deletions Cargo.lock

Large diffs are not rendered by default.

386 changes: 250 additions & 136 deletions Cargo.toml

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions bin/laminar-dev/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[package]
name = "laminar-dev"
version = "0.3.1"
authors = ["Laminar Developers <[email protected]>"]
edition = "2018"

[[bin]]
name = "laminar-dev"
path = "src/main.rs"

[[test]]
name = "cucumber"
harness = false # Allows Cucumber to print output instead of libtest

[dependencies]
futures = "0.3.4"
parity-util-mem = { version = "0.9.0", default-features = false, features = ["jemalloc-global"] }
laminar-dev-cli = { path = "cli" }
laminar-dev-service = { path = "service" }

[dev-dependencies]
cucumber = { package = "cucumber_rust", version = "^0.6.0" }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
dev-runtime = { path = "../../runtime/dev" }
margin-protocol = { package = "module-margin-protocol", path = "../../modules/margin-protocol" }
margin-protocol-rpc-runtime-api = { path = "../../modules/margin-protocol/rpc/runtime-api" }
synthetic-protocol-rpc-runtime-api = { path = "../../modules/synthetic-protocol/rpc/runtime-api" }
laminar-primitives = { path = "../../primitives" }

[features]
runtime-benchmarks = [
"laminar-dev-cli/runtime-benchmarks",
]
30 changes: 30 additions & 0 deletions bin/laminar-dev/cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[package]
name = "laminar-dev-cli"
version = "0.3.1"
authors = ["Laminar Developers <[email protected]>"]
edition = "2018"

[dependencies]
structopt = "0.3.8"
sp-core = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1", optional = true }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1", optional = true }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1", optional = true }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1", optional = true }

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

[build-dependencies]
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1", default-features = false }

[features]
default = ["wasmtime", "cli"]
wasmtime = [ "sc-cli/wasmtime" ]
cli = [
"service",
"sp-core",
"sc-cli",
"sc-service",
"frame-benchmarking-cli",
]
runtime-benchmarks = [ "service/runtime-benchmarks" ]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
64 changes: 64 additions & 0 deletions bin/laminar-dev/service/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
[package]
name = "laminar-dev-service"
version = "0.3.1"
authors = ["Laminar Developers <[email protected]>"]
edition = "2018"

[dependencies]
codec = { package = "parity-scale-codec", version = "2.0.0" }
hex-literal = "0.3.1"
serde = { version = "1.0.102", features = ["derive"] }
serde_json = "1.0.41"

frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sc-chain-spec = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sc-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sc-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sp-consensus = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sp-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sc-consensus-slots = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sp-finality-grandpa = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sp-offchain = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sp-session = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sp-trie = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
prometheus-endpoint = { package = "substrate-prometheus-endpoint", git = "https://github.com/paritytech/substrate", branch = "rococo-v1"}

margin-protocol = { package="module-margin-protocol", path = "../../../modules/margin-protocol" }
synthetic-tokens = { package="module-synthetic-tokens", path = "../../../modules/synthetic-tokens" }
margin-protocol-rpc = { path = "../../../modules/margin-protocol/rpc" }
orml-oracle-rpc = { path = "../../../orml/oracle/rpc" }
synthetic-protocol-rpc = { path = "../../../modules/synthetic-protocol/rpc" }

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

laminar-primitives = { path = "../../../primitives" }
laminar-rpc = { path = "../../../rpc" }

[dev-dependencies]
sc-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1", features = ["test-helpers"] }

[features]
default = ["std"]
std = []
runtime-benchmarks = [
"dev-runtime/runtime-benchmarks",
]
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions bin/laminar-dev/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() -> laminar_dev_cli::Result<()> {
laminar_dev_cli::run()
}
File renamed without changes.
35 changes: 35 additions & 0 deletions bin/laminar/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[package]
name = "laminar"
version = "0.3.1"
authors = ["Laminar Developers <[email protected]>"]
edition = "2018"

[[bin]]
name = "laminar"
path = "src/main.rs"

[dependencies]
futures = "0.3.4"
parity-util-mem = { version = "0.9.0", default-features = false, features = ["jemalloc-global"] }
laminar-cli = { path = "cli" }
laminar-service = { path = "service" }

#TODO: This is a workaround for issue https://github.com/bitvecto-rs/bitvec/issues/105. Remove it once fixed.
funty = { version = "=1.1.0" }

[dev-dependencies]
cucumber = { package = "cucumber_rust", version = "^0.6.0" }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sp-io = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
dev-runtime = { path = "../../runtime/dev" }
margin-protocol = { package = "module-margin-protocol", path = "../../modules/margin-protocol" }
margin-protocol-rpc-runtime-api = { path = "../../modules/margin-protocol/rpc/runtime-api" }
synthetic-protocol-rpc-runtime-api = { path = "../../modules/synthetic-protocol/rpc/runtime-api" }
laminar-primitives = { path = "../../primitives" }

[features]
runtime-benchmarks = [
"laminar-cli/runtime-benchmarks",
]
42 changes: 42 additions & 0 deletions bin/laminar/cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[package]
name = "laminar-cli"
version = "0.3.1"
authors = ["Laminar Developers <[email protected]>"]
edition = "2018"

[dependencies]
log = "0.4.8"
structopt = "0.3.8"
codec = { package = "parity-scale-codec", version = "2.0.0" }

sp-core = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1", optional = true }
sc-cli = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1", optional = true }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1", optional = true }
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1" }
frame-benchmarking-cli = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1", optional = true }

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

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

[build-dependencies]
substrate-build-script-utils = { git = "https://github.com/paritytech/substrate", branch = "rococo-v1", default-features = false }

[features]
default = ["wasmtime", "cli"]
wasmtime = [ "sc-cli/wasmtime" ]
cli = [
"service",
"sp-core",
"sc-cli",
"sc-service",
"frame-benchmarking-cli",
]
runtime-benchmarks = [ "service/runtime-benchmarks" ]
3 changes: 3 additions & 0 deletions bin/laminar/cli/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
substrate_build_script_utils::generate_cargo_keys();
}
171 changes: 171 additions & 0 deletions bin/laminar/cli/src/cli.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
use std::path::PathBuf;

use sc_cli::{KeySubcommand, SignCmd, VanityCmd, VerifyCmd};
use structopt::StructOpt;

/// Possible subcommands of the main binary.
#[derive(Debug, StructOpt)]
pub enum Subcommand {
/// 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),

/// Key management cli utilities
Key(KeySubcommand),

/// The custom inspect subcommmand for decoding blocks and extrinsics.
#[structopt(
name = "inspect",
about = "Decode given block or extrinsic using current native runtime."
)]
Inspect(inspect::cli::InspectCmd),

/// The custom benchmark subcommmand benchmarking runtime modules.
#[structopt(name = "benchmark", about = "Benchmark runtime modules.")]
Benchmark(frame_benchmarking_cli::BenchmarkCmd),

/// Verify a signature for a message, provided on STDIN, with a given
/// (public or secret) key.
Verify(VerifyCmd),

/// Generate a seed that provides a vanity address.
Vanity(VanityCmd),

/// Sign a message, with a given (secret) key.
Sign(SignCmd),

/// Build a chain specification.
BuildSpec(sc_cli::BuildSpecCmd),

/// Validate blocks.
CheckBlock(sc_cli::CheckBlockCmd),

/// Export blocks.
ExportBlocks(sc_cli::ExportBlocksCmd),

/// Export the state of a given block into a chain spec.
ExportState(sc_cli::ExportStateCmd),

/// Import blocks.
ImportBlocks(sc_cli::ImportBlocksCmd),

/// Remove the whole chain.
PurgeChain(sc_cli::PurgeChainCmd),

/// Revert the chain to a previous state.
Revert(sc_cli::RevertCmd),
}

/// 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,

/// Write output in binary. Default is to write in hex.
#[structopt(short, long)]
pub raw: bool,

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

/// 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>,

/// Write output in binary. Default is to write in hex.
#[structopt(short, long)]
pub raw: bool,

/// 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 {
/// The base run command.
#[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
}
}

/// An overarching CLI command definition.
#[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,

/// Run node as collator.
///
/// Note that this is the same as running with `--validator`.
#[structopt(long, conflicts_with = "validator")]
pub collator: bool,

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

/// Relay chain CLI.
#[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