add doc-only substrate entry point crate (#14581)

* add doc-only substrate entry point crate

* document a few more things

* add more

* fix width

* Update primitives/io/src/lib.rs

Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com>

* add link

* update cargo toml file

* fix sp-io docs

* improve

* small update

* add license

* satisfy license job

* add a line about FRAME

* CI happy now

* make CI more happy

* Let the check run for the whole workspace

* Forward the substrate node again as default run

* update binary names

* upate verison test

* Fix fix fix

* Fix

* rename to substrate-node in more places

* Revert "rename to substrate-node in more places"

This reverts commit 66960f84a1b6f1f7c638b4040e28e9fbabb8adf5.

* fix

* Fix build pipeline

* Fix properly plus add some docs

---------

Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com>
Co-authored-by: Bastian Köcher <info@kchr.de>
This commit is contained in:
Kian Paimani
2023-07-19 20:36:50 +02:00
committed by GitHub
parent bc84e1b838
commit 817c97d65d
36 changed files with 1084 additions and 52 deletions
+4 -2
View File
@@ -6,7 +6,7 @@ description = "Generic Substrate node implementation in Rust."
build = "build.rs"
edition = "2021"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"
default-run = "substrate"
default-run = "substrate-node"
homepage = "https://substrate.io"
repository = "https://github.com/paritytech/substrate/"
publish = false
@@ -25,8 +25,10 @@ maintenance = { status = "actively-developed" }
is-it-maintained-issue-resolution = { repository = "paritytech/substrate" }
is-it-maintained-open-issues = { repository = "paritytech/substrate" }
# The same node binary as the `substrate` (defined in the workspace `Cargo.toml`) binary,
# but just exposed by this crate here.
[[bin]]
name = "substrate"
name = "substrate-node"
path = "bin/main.rs"
required-features = ["cli"]
@@ -33,7 +33,7 @@ async fn benchmark_block_works() {
common::run_node_for_a_while(base_dir.path(), &["--dev", "--no-hardware-benchmarks"]).await;
// Invoke `benchmark block` with all options to make sure that they are valid.
let status = Command::new(cargo_bin("substrate"))
let status = Command::new(cargo_bin("substrate-node"))
.args(["benchmark", "block", "--dev"])
.arg("-d")
.arg(base_dir.path())
@@ -32,7 +32,7 @@ fn benchmark_extrinsic_works() {
fn benchmark_extrinsic(pallet: &str, extrinsic: &str) {
let base_dir = tempdir().expect("could not create a temp dir");
let status = Command::new(cargo_bin("substrate"))
let status = Command::new(cargo_bin("substrate-node"))
.args(&["benchmark", "extrinsic", "--dev"])
.arg("-d")
.arg(base_dir.path())
@@ -22,7 +22,7 @@ use std::process::Command;
/// Tests that the `benchmark machine` command works for the substrate dev runtime.
#[test]
fn benchmark_machine_works() {
let status = Command::new(cargo_bin("substrate"))
let status = Command::new(cargo_bin("substrate-node"))
.args(["benchmark", "machine", "--dev"])
.args([
"--verify-duration",
@@ -48,7 +48,7 @@ fn benchmark_machine_works() {
#[test]
#[cfg(debug_assertions)]
fn benchmark_machine_fails_with_slow_hardware() {
let output = Command::new(cargo_bin("substrate"))
let output = Command::new(cargo_bin("substrate-node"))
.args(["benchmark", "machine", "--dev"])
.args([
"--verify-duration",
@@ -28,7 +28,7 @@ fn benchmark_overhead_works() {
// Only put 10 extrinsics into the block otherwise it takes forever to build it
// especially for a non-release build.
let status = Command::new(cargo_bin("substrate"))
let status = Command::new(cargo_bin("substrate-node"))
.args(&["benchmark", "overhead", "--dev", "-d"])
.arg(base_path)
.arg("--weight-path")
@@ -34,7 +34,7 @@ fn benchmark_pallet_works() {
}
fn benchmark_pallet(steps: u32, repeat: u32, should_work: bool) {
let status = Command::new(cargo_bin("substrate"))
let status = Command::new(cargo_bin("substrate-node"))
.args(["benchmark", "pallet", "--dev"])
// Use the `addition` benchmark since is the fastest.
.args(["--pallet", "frame-benchmarking", "--extrinsic", "addition"])
@@ -40,7 +40,7 @@ fn benchmark_storage_works() {
}
fn benchmark_storage(db: &str, base_path: &Path) -> ExitStatus {
Command::new(cargo_bin("substrate"))
Command::new(cargo_bin("substrate-node"))
.args(&["benchmark", "storage", "--dev"])
.arg("--db")
.arg(db)
@@ -24,7 +24,7 @@ use tempfile::tempdir;
fn build_spec_works() {
let base_path = tempdir().expect("could not create a temp dir");
let output = Command::new(cargo_bin("substrate"))
let output = Command::new(cargo_bin("substrate-node"))
.args(&["build-spec", "--dev", "-d"])
.arg(base_path.path())
.output()
@@ -30,7 +30,7 @@ async fn check_block_works() {
common::run_node_for_a_while(base_path.path(), &["--dev", "--no-hardware-benchmarks"]).await;
let status = Command::new(cargo_bin("substrate"))
let status = Command::new(cargo_bin("substrate-node"))
.args(&["check-block", "--dev", "-d"])
.arg(base_path.path())
.arg("1")
@@ -96,7 +96,7 @@ impl<'a> ExportImportRevertExecutor<'a> {
};
// Running the command and capturing the output.
let output = Command::new(cargo_bin("substrate"))
let output = Command::new(cargo_bin("substrate-node"))
.args(&arguments)
.arg(&base_path)
.arg(&self.exported_blocks_file)
@@ -160,7 +160,7 @@ impl<'a> ExportImportRevertExecutor<'a> {
/// Runs the `revert` command.
fn run_revert(&self) {
let output = Command::new(cargo_bin("substrate"))
let output = Command::new(cargo_bin("substrate-node"))
.args(&["revert", "--dev", "-d"])
.arg(&self.base_path.path())
.output()
@@ -30,7 +30,7 @@ async fn inspect_works() {
common::run_node_for_a_while(base_path.path(), &["--dev", "--no-hardware-benchmarks"]).await;
let status = Command::new(cargo_bin("substrate"))
let status = Command::new(cargo_bin("substrate-node"))
.args(&["inspect", "--dev", "-d"])
.arg(base_path.path())
.args(&["block", "1"])
@@ -29,7 +29,7 @@ async fn purge_chain_works() {
common::run_node_for_a_while(base_path.path(), &["--dev", "--no-hardware-benchmarks"]).await;
let status = Command::new(cargo_bin("substrate"))
let status = Command::new(cargo_bin("substrate-node"))
.args(&["purge-chain", "--dev", "-d"])
.arg(base_path.path())
.arg("-y")
@@ -33,7 +33,7 @@ async fn running_the_node_works_and_can_be_interrupted() {
async fn run_command_and_kill(signal: Signal) {
let base_path = tempdir().expect("could not create a temp dir");
let mut cmd = common::KillChildOnDrop(
Command::new(cargo_bin("substrate"))
Command::new(cargo_bin("substrate-node"))
.stdout(process::Stdio::piped())
.stderr(process::Stdio::piped())
.args(&["--dev", "-d"])
+1 -1
View File
@@ -67,7 +67,7 @@ async fn telemetry_works() {
}
});
let mut substrate = process::Command::new(cargo_bin("substrate"));
let mut substrate = process::Command::new(cargo_bin("substrate-node"));
let mut substrate = KillChildOnDrop(
substrate
@@ -31,7 +31,7 @@ use substrate_cli_test_utils as common;
//#[tokio::test]
async fn temp_base_path_works() {
common::run_with_timeout(Duration::from_secs(60 * 10), async move {
let mut cmd = Command::new(cargo_bin("substrate"));
let mut cmd = Command::new(cargo_bin("substrate-node"));
let mut child = common::KillChildOnDrop(
cmd.args(&["--dev", "--tmp", "--no-hardware-benchmarks"])
.stdout(Stdio::piped())
+5 -5
View File
@@ -21,17 +21,17 @@ use regex::Regex;
use std::process::Command;
fn expected_regex() -> Regex {
Regex::new(r"^substrate (.+)-([a-f\d]+)$").unwrap()
Regex::new(r"^substrate-node (.+)-([a-f\d]+)$").unwrap()
}
#[test]
fn version_is_full() {
let expected = expected_regex();
let output = Command::new(cargo_bin("substrate")).args(&["--version"]).output().unwrap();
let output = Command::new(cargo_bin("substrate-node")).args(&["--version"]).output().unwrap();
assert!(output.status.success(), "command returned with non-success exit code");
let output = String::from_utf8_lossy(&output.stdout).trim().to_owned();
let output = dbg!(String::from_utf8_lossy(&output.stdout).trim().to_owned());
let captures = expected.captures(output.as_str()).expect("could not parse version in output");
assert_eq!(&captures[1], env!("CARGO_PKG_VERSION"));
@@ -41,11 +41,11 @@ fn version_is_full() {
fn test_regex_matches_properly() {
let expected = expected_regex();
let captures = expected.captures("substrate 2.0.0-da487d19d").unwrap();
let captures = expected.captures("substrate-node 2.0.0-da487d19d").unwrap();
assert_eq!(&captures[1], "2.0.0");
assert_eq!(&captures[2], "da487d19d");
let captures = expected.captures("substrate 2.0.0-alpha.5-da487d19d").unwrap();
let captures = expected.captures("substrate-node 2.0.0-alpha.5-da487d19d").unwrap();
assert_eq!(&captures[1], "2.0.0-alpha.5");
assert_eq!(&captures[2], "da487d19d");
}