Skip to content

Commit

Permalink
Pushed event
Browse files Browse the repository at this point in the history
  • Loading branch information
1 parent b1a1002 commit 9228d89
Show file tree
Hide file tree
Showing 14 changed files with 589 additions and 10,332 deletions.
9,714 changes: 0 additions & 9,714 deletions Cargo.lock

This file was deleted.

18 changes: 12 additions & 6 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "minimal-template-node"
description = "A miniaml Substrate-based Substrate node, ready for hacking. (polkadot v1.9.0)"
version = "0.1.0"
description = "A minimal Substrate-based Substrate node, ready for hacking."
version = "0.0.0"
license = "MIT-0"
edition = "2021"
publish = false
Expand All @@ -13,11 +13,12 @@ build = "build.rs"
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
clap = { version = "4.5.1", features = ["derive"] }
futures = { version = "0.3.21", features = ["thread-pool"] }
clap = { version = "4.5.3", features = ["derive"] }
futures = { version = "0.3.30", features = ["thread-pool"] }
futures-timer = "3.0.1"
jsonrpsee = { version = "0.22", features = ["server"] }
serde_json = { version = "1.0.114", default-features = true }

sc-cli = { version = "0.39.0" }
sc-executor = { version = "0.35.0" }
sc-network = { version = "0.37.0" }
Expand All @@ -31,19 +32,24 @@ sc-rpc-api = { version = "0.36.0" }
sc-basic-authorship = { version = "0.37.0" }
sc-offchain = { version = "32.0.0" }
sc-client-api = { version = "31.0.0" }

sp-timestamp = { version = "29.0.0" }
sp-keyring = { version = "34.0.0" }
sp-api = { version = "29.0.0" }
sp-blockchain = { version = "31.0.0" }
sp-block-builder = { version = "29.0.0" }
sp-io = { version = "33.0.0" }
sp-runtime = { version = "34.0.0" }

substrate-frame-rpc-system = { version = "31.0.0" }

# Once the native runtime is gone, there should be little to no dependency on FRAME here, and
# certainly no dependency on the runtime.
polkadot-sdk-frame = { features = ["experimental", "runtime"], version = "0.1.0" }
runtime = { package = "minimal-template-runtime", path = "../runtime", version = "0.1.0" }
polkadot-sdk-frame = { path = "../../../substrate/frame", features = [
"experimental",
"runtime",
] }
runtime = { package = "minimal-template-runtime", path = "../runtime" }

[build-dependencies]
substrate-build-script-utils = { version = "11.0.0" }
Expand Down
4 changes: 2 additions & 2 deletions node/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed};

fn main() {
generate_cargo_keys();
rerun_if_git_head_changed();
generate_cargo_keys();
rerun_if_git_head_changed();
}
45 changes: 21 additions & 24 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,35 +24,32 @@ use sp_keyring::AccountKeyring;
pub type ChainSpec = sc_service::GenericChainSpec<()>;

fn props() -> Properties {
let mut properties = Properties::new();
properties.insert("tokenDecimals".to_string(), 0.into());
properties.insert("tokenSymbol".to_string(), "MINI".into());
properties
let mut properties = Properties::new();
properties.insert("tokenDecimals".to_string(), 0.into());
properties.insert("tokenSymbol".to_string(), "MINI".into());
properties
}

pub fn development_config() -> Result<ChainSpec, String> {
Ok(ChainSpec::builder(
WASM_BINARY.expect("Development wasm not available"),
Default::default(),
)
.with_name("Development")
.with_id("dev")
.with_chain_type(ChainType::Development)
.with_genesis_config_patch(testnet_genesis())
.with_properties(props())
.build())
Ok(ChainSpec::builder(WASM_BINARY.expect("Development wasm not available"), Default::default())
.with_name("Development")
.with_id("dev")
.with_chain_type(ChainType::Development)
.with_genesis_config_patch(testnet_genesis())
.with_properties(props())
.build())
}

/// Configure initial storage state for FRAME pallets.
fn testnet_genesis() -> Value {
use polkadot_sdk_frame::traits::Get;
use runtime::interface::{Balance, MinimumBalance};
let endowment = <MinimumBalance as Get<Balance>>::get().max(1) * 1000;
let balances = AccountKeyring::iter()
.map(|a| (a.to_account_id(), endowment))
.collect::<Vec<_>>();
json!({
"balances": BalancesConfig { balances },
"sudo": SudoConfig { key: Some(AccountKeyring::Alice.to_account_id()) },
})
use polkadot_sdk_frame::traits::Get;
use runtime::interface::{Balance, MinimumBalance};
let endowment = <MinimumBalance as Get<Balance>>::get().max(1) * 1000;
let balances = AccountKeyring::iter()
.map(|a| (a.to_account_id(), endowment))
.collect::<Vec<_>>();
json!({
"balances": BalancesConfig { balances },
"sudo": SudoConfig { key: Some(AccountKeyring::Alice.to_account_id()) },
})
}
76 changes: 38 additions & 38 deletions node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,63 +19,63 @@ use sc_cli::RunCmd;

#[derive(Debug, Clone)]
pub enum Consensus {
ManualSeal(u64),
InstantSeal,
ManualSeal(u64),
InstantSeal,
}

impl std::str::FromStr for Consensus {
type Err = String;

fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(if s == "instant-seal" {
Consensus::InstantSeal
} else if let Some(block_time) = s.strip_prefix("manual-seal-") {
Consensus::ManualSeal(block_time.parse().map_err(|_| "invalid block time")?)
} else {
return Err("incorrect consensus identifier".into());
})
}
type Err = String;

fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(if s == "instant-seal" {
Consensus::InstantSeal
} else if let Some(block_time) = s.strip_prefix("manual-seal-") {
Consensus::ManualSeal(block_time.parse().map_err(|_| "invalid block time")?)
} else {
return Err("incorrect consensus identifier".into())
})
}
}

#[derive(Debug, clap::Parser)]
pub struct Cli {
#[command(subcommand)]
pub subcommand: Option<Subcommand>,
#[command(subcommand)]
pub subcommand: Option<Subcommand>,

#[clap(long, default_value = "manual-seal-3000")]
pub consensus: Consensus,
#[clap(long, default_value = "manual-seal-3000")]
pub consensus: Consensus,

#[clap(flatten)]
pub run: RunCmd,
#[clap(flatten)]
pub run: RunCmd,
}

#[derive(Debug, clap::Subcommand)]
pub enum Subcommand {
/// Key management cli utilities
#[command(subcommand)]
Key(sc_cli::KeySubcommand),
/// Key management cli utilities
#[command(subcommand)]
Key(sc_cli::KeySubcommand),

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

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

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

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

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

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

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

/// Db meta columns information.
ChainInfo(sc_cli::ChainInfoCmd),
/// Db meta columns information.
ChainInfo(sc_cli::ChainInfoCmd),
}
Loading

0 comments on commit 9228d89

Please sign in to comment.