-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update template triggered by workflow_dispatch
- Loading branch information
1 parent
f8eaad8
commit b218abb
Showing
17 changed files
with
10,880 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
[workspace.package] | ||
license = "MIT-0" | ||
authors = ["Parity Technologies <[email protected]>"] | ||
homepage = "https://substrate.io" | ||
repository = "https://github.com/paritytech/polkadot-sdk-minimal-template.git" | ||
edition = "2021" | ||
|
||
[workspace] | ||
members = [ | ||
"node", | ||
"pallets/template", | ||
"runtime", | ||
] | ||
resolver = "2" | ||
|
||
[workspace.lints.rust] | ||
suspicious_double_ref_op = { level = "allow", priority = 2 } | ||
|
||
[workspace.lints.clippy] | ||
all = { level = "allow", priority = 0 } | ||
correctness = { level = "warn", priority = 1 } | ||
complexity = { level = "warn", priority = 1 } | ||
if-same-then-else = { level = "allow", priority = 2 } | ||
zero-prefixed-literal = { level = "allow", priority = 2 } # 00_1000_000 | ||
type_complexity = { level = "allow", priority = 2 } # raison d'etre | ||
nonminimal-bool = { level = "allow", priority = 2 } # maybe | ||
borrowed-box = { level = "allow", priority = 2 } # Reasonable to fix this one | ||
too-many-arguments = { level = "allow", priority = 2 } # (Turning this on would lead to) | ||
needless-lifetimes = { level = "allow", priority = 2 } # generated code | ||
unnecessary_cast = { level = "allow", priority = 2 } # Types may change | ||
identity-op = { level = "allow", priority = 2 } # One case where we do 0 + | ||
useless_conversion = { level = "allow", priority = 2 } # Types may change | ||
unit_arg = { level = "allow", priority = 2 } # stylistic | ||
option-map-unit-fn = { level = "allow", priority = 2 } # stylistic | ||
bind_instead_of_map = { level = "allow", priority = 2 } # stylistic | ||
erasing_op = { level = "allow", priority = 2 } # E.g. 0 * DOLLARS | ||
eq_op = { level = "allow", priority = 2 } # In tests we test equality. | ||
while_immutable_condition = { level = "allow", priority = 2 } # false positives | ||
needless_option_as_deref = { level = "allow", priority = 2 } # false positives | ||
derivable_impls = { level = "allow", priority = 2 } # false positives | ||
stable_sort_primitive = { level = "allow", priority = 2 } # prefer stable sort | ||
extra-unused-type-parameters = { level = "allow", priority = 2 } # stylistic | ||
default_constructed_unit_structs = { level = "allow", priority = 2 } # stylistic | ||
|
||
[workspace.dependencies] | ||
polkavm = "0.9.3" | ||
polkavm-linker = "0.9.2" | ||
polkavm-derive = "0.9.1" | ||
log = { version = "0.4.20", default-features = false } | ||
quote = { version = "1.0.33" } | ||
serde = { version = "1.0.197", default-features = false } | ||
serde-big-array = { version = "0.3.2" } | ||
serde_derive = { version = "1.0.117" } | ||
serde_json = { version = "1.0.114", default-features = false } | ||
serde_yaml = { version = "0.9" } | ||
syn = { version = "2.0.50" } | ||
thiserror = { version = "1.0.48" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
[package] | ||
name = "minimal-template-node" | ||
description = "A miniaml Substrate-based Substrate node, ready for hacking. (polkadot v1.9.0)" | ||
version = "0.1.0" | ||
license = "MIT-0" | ||
authors.workspace = true | ||
homepage.workspace = true | ||
repository.workspace = true | ||
edition.workspace = true | ||
publish = false | ||
build = "build.rs" | ||
|
||
[lints] | ||
workspace = true | ||
|
||
[package.metadata.docs.rs] | ||
targets = ["x86_64-unknown-linux-gnu"] | ||
|
||
[dependencies] | ||
clap = { version = "4.5.1", features = ["derive"] } | ||
futures = { version = "0.3.21", features = ["thread-pool"] } | ||
futures-timer = "3.0.1" | ||
jsonrpsee = { version = "0.22", features = ["server"] } | ||
serde_json = { workspace = true, default-features = true } | ||
sc-cli = { version = "0.39.0" } | ||
sc-executor = { version = "0.35.0" } | ||
sc-network = { version = "0.37.0" } | ||
sc-service = { version = "0.38.0" } | ||
sc-telemetry = { version = "17.0.0" } | ||
sc-transaction-pool = { version = "31.0.0" } | ||
sc-transaction-pool-api = { version = "31.0.0" } | ||
sc-consensus = { version = "0.36.0" } | ||
sc-consensus-manual-seal = { version = "0.38.0" } | ||
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. | ||
frame = { version = "0.1.1", package = "polkadot-sdk-frame", features = ["experimental", "runtime"] } | ||
runtime = { package = "minimal-template-runtime", path = "../runtime", version = "0.1.0" } | ||
|
||
[build-dependencies] | ||
substrate-build-script-utils = { version = "11.0.0" } | ||
|
||
[features] | ||
default = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// This file is part of Substrate. | ||
|
||
// Copyright (C) Parity Technologies (UK) Ltd. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed}; | ||
|
||
fn main() { | ||
generate_cargo_keys(); | ||
rerun_if_git_head_changed(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// This file is part of Substrate. | ||
|
||
// Copyright (C) Parity Technologies (UK) Ltd. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
use runtime::{BalancesConfig, SudoConfig, WASM_BINARY}; | ||
use sc_service::{ChainType, Properties}; | ||
use serde_json::{json, Value}; | ||
use sp_keyring::AccountKeyring; | ||
|
||
/// This is a specialization of the general Substrate ChainSpec type. | ||
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 | ||
} | ||
|
||
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()) | ||
} | ||
|
||
/// Configure initial storage state for FRAME pallets. | ||
fn testnet_genesis() -> Value { | ||
use 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()) }, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// This file is part of Substrate. | ||
|
||
// Copyright (C) Parity Technologies (UK) Ltd. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
use sc_cli::RunCmd; | ||
|
||
#[derive(Debug, Clone)] | ||
pub enum Consensus { | ||
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()) | ||
}) | ||
} | ||
} | ||
|
||
#[derive(Debug, clap::Parser)] | ||
pub struct Cli { | ||
#[command(subcommand)] | ||
pub subcommand: Option<Subcommand>, | ||
|
||
#[clap(long, default_value = "manual-seal-3000")] | ||
pub consensus: Consensus, | ||
|
||
#[clap(flatten)] | ||
pub run: RunCmd, | ||
} | ||
|
||
#[derive(Debug, clap::Subcommand)] | ||
pub enum Subcommand { | ||
/// Key management cli utilities | ||
#[command(subcommand)] | ||
Key(sc_cli::KeySubcommand), | ||
|
||
/// 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), | ||
|
||
/// Db meta columns information. | ||
ChainInfo(sc_cli::ChainInfoCmd), | ||
} |
Oops, something went wrong.