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

feat: FRAME umbrella crate. #14137

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
188a57b
new doc/api package:
kianenigma May 13, 2023
1b203a2
adding stuff for runtime
kianenigma May 23, 2023
da3c1d6
new features
kianenigma May 24, 2023
c5ad834
a lot of changes
kianenigma May 30, 2023
6d5286b
Master.into()
kianenigma May 30, 2023
5543456
everything works again
kianenigma May 30, 2023
54c4901
remove expanded file
kianenigma May 30, 2023
02908ab
Merge branch 'master' of github.com:paritytech/substrate into kiz-fra…
kianenigma May 30, 2023
901a8d0
checkpoint
kianenigma May 30, 2023
433fbf1
some updates
kianenigma Jun 3, 2023
837c78a
Merge branch 'master' of github.com:paritytech/substrate into kiz-fra…
kianenigma Jun 3, 2023
4a3ce15
some chanes
kianenigma Jun 13, 2023
fcfdee6
merge master again
kianenigma Jun 13, 2023
b278a05
update
kianenigma Jun 16, 2023
43824f8
Merge branch 'master' of github.com:paritytech/substrate into kiz-fra…
kianenigma Jun 16, 2023
ebb6c5e
update with master
kianenigma Jun 16, 2023
658d84f
compiles without support and system
kianenigma Jun 16, 2023
6cd251f
minimal-node and runtime, with frame, with sudo and timestamp
kianenigma Jun 21, 2023
be42459
works with tx-fee payment
kianenigma Jun 21, 2023
010d906
works without timestamp for now
kianenigma Jun 21, 2023
289f18e
Merge branch 'master' of github.com:paritytech/substrate into kiz-fra…
kianenigma Jun 21, 2023
5934bcc
add dual consensus modes
kianenigma Jun 21, 2023
6b7e50a
remove unused deps and all
kianenigma Jun 21, 2023
679bcea
Update frame/src/lib.rs
kianenigma Jun 21, 2023
aee26b9
Update frame/src/lib.rs
kianenigma Jun 21, 2023
bfda7d8
Update frame/src/lib.rs
kianenigma Jun 21, 2023
7d912d0
make impl_runtime_api work without sp-api
kianenigma Jun 24, 2023
07128f5
Merge branch 'kiz-frame-api' of github.com:paritytech/substrate into …
kianenigma Jun 24, 2023
c96624b
use docify for example
kianenigma Jul 11, 2023
dac888e
clone for identity
kianenigma Jul 12, 2023
81202d1
single tuple is also a signed extension
kianenigma Jul 14, 2023
247582e
update to master
kianenigma Jul 16, 2023
554bd2e
cleanup
kianenigma Jul 16, 2023
7c9ed07
fix how we handel return macro in tt stuff
kianenigma Jul 17, 2023
787eff7
bring back example pallet
kianenigma Jul 17, 2023
dfaa2af
fix warning
kianenigma Jul 17, 2023
37ff8a8
Update bin/minimal/node/src/service.rs
kianenigma Jul 17, 2023
377f148
Update bin/minimal/node/src/service.rs
kianenigma Jul 17, 2023
7284b50
make the node WASM-only
kianenigma Jul 17, 2023
c04418c
Master.into()
kianenigma Jul 20, 2023
1cf4cec
Empty-Commit
kianenigma Jul 20, 2023
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
85 changes: 85 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ path = "bin/node/cli/bin/main.rs"
resolver = "2"

members = [
"bin/minimal/node",
"bin/minimal/runtime",
"bin/node-template/node",
"bin/node-template/pallets/template",
"bin/node-template/runtime",
Expand Down Expand Up @@ -111,6 +113,7 @@ members = [
"client/transaction-pool",
"client/transaction-pool/api",
"client/utils",
"frame",
"frame/alliance",
"frame/asset-conversion",
"frame/assets",
Expand Down
56 changes: 56 additions & 0 deletions bin/minimal/node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[package]
name = "minimal-node"
version = "4.0.0-dev"
description = "A fresh FRAME-based Substrate node, ready for hacking."
authors = ["Substrate DevHub <https://github.com/substrate-developer-hub>"]
homepage = "https://substrate.io/"
edition = "2021"
license = "MIT-0"
publish = false
repository = "https://github.com/substrate-developer-hub/substrate-node-template/"
build = "build.rs"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

[[bin]]
name = "minimal-node"

[dependencies]
clap = { version = "4.0.9", features = ["derive"] }
futures = { version = "0.3.21", features = ["thread-pool"] }
futures-timer = "3.0.1"
jsonrpsee = { version = "0.16.2", features = ["server"] }

sc-cli = { path = "../../../client/cli" }
sc-executor = { path = "../../../client/executor" }
sc-network = { path = "../../../client/network" }
sc-service = { path = "../../../client/service" }
sc-telemetry = { path = "../../../client/telemetry" }
sc-transaction-pool = { path = "../../../client/transaction-pool" }
sc-transaction-pool-api = { path = "../../../client/transaction-pool/api" }
sc-consensus = { path = "../../../client/consensus/common" }
Comment on lines +25 to +32
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just thinking if there should be actual substrate::client and/or substrate::primitives namespaces?
Re-exporting everything from the substrate crate could work, but not sure if its a good or horrible idea 😆

sc-consensus-manual-seal = { path = "../../../client/consensus/manual-seal" }
sc-rpc-api = { path = "../../../client/rpc-api" }
sc-basic-authorship = { path = "../../../client/basic-authorship" }
sc-offchain = { path = "../../../client/offchain" }
sc-client-api = { path = "../../../client/api" }

sp-timestamp = { path = "../../../primitives/timestamp" }
sp-keyring = { path = "../../../primitives/keyring" }
sp-api = { path = "../../../primitives/api" }
sp-blockchain = { path = "../../../primitives/blockchain" }
sp-block-builder = { path = "../../../primitives/block-builder" }
sp-io = { path = "../../../primitives/io" }


substrate-frame-rpc-system = { path = "../../../utils/frame/rpc/system" }

frame = { path = "../../../frame" }
runtime = { package = "minimal-runtime", path = "../runtime" }

[build-dependencies]
substrate-build-script-utils = { version = "3.0.0", path = "../../../utils/build-script-utils" }

[features]
default = []
6 changes: 6 additions & 0 deletions bin/minimal/node/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
use substrate_build_script_utils::{generate_cargo_keys, rerun_if_git_head_changed};

fn main() {
generate_cargo_keys();
rerun_if_git_head_changed();
}
66 changes: 66 additions & 0 deletions bin/minimal/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
use runtime::{BalancesConfig, RuntimeGenesisConfig, SudoConfig, SystemConfig, WASM_BINARY};
use sc_service::{ChainType, Properties};
use sp_keyring::AccountKeyring;

/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
pub type ChainSpec = sc_service::GenericChainSpec<RuntimeGenesisConfig>;

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

pub fn development_config() -> Result<ChainSpec, String> {
let wasm_binary = WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?;
Ok(ChainSpec::from_genesis(
"Development",
"dev",
ChainType::Development,
move || testnet_genesis(wasm_binary),
vec![],
None,
None,
None,
Some(props()),
None,
))
}

pub fn local_testnet_config() -> Result<ChainSpec, String> {
let wasm_binary = WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?;

Ok(ChainSpec::from_genesis(
"Local Testnet",
"local_testnet",
ChainType::Local,
move || testnet_genesis(wasm_binary),
vec![],
None,
None,
None,
Some(props()),
None,
))
}

/// Configure initial storage state for FRAME modules.
fn testnet_genesis(wasm_binary: &[u8]) -> RuntimeGenesisConfig {
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<_>>();
RuntimeGenesisConfig {
system: SystemConfig {
// Add Wasm runtime to storage.
code: wasm_binary.to_vec(),
_config: Default::default(),
},
balances: BalancesConfig { balances },
sudo: SudoConfig { key: Some(AccountKeyring::Alice.to_account_id()) },
..Default::default()
}
}
64 changes: 64 additions & 0 deletions bin/minimal/node/src/cli.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
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),
}
Loading
Loading