Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
4459930
feat(cli): allow build spec command to be non-interactive
moliholy Sep 25, 2025
3826179
feat(cli): allow build spec command to specify the base directory
moliholy Sep 25, 2025
2f2bf02
Merge branch 'main' into feat/build-spec-improvements
moliholy Sep 25, 2025
4a6e5f5
fix(cli): lifecycle test
moliholy Sep 25, 2025
3d107c2
test(cli): display error in conflictive test
moliholy Sep 26, 2025
c1a5a75
refactor: specify default locations at core logic
moliholy Sep 29, 2025
e63db6e
test(cli): avoid hanging node process
moliholy Sep 29, 2025
82637af
fix(cli): compilation issues
moliholy Sep 29, 2025
53bd364
ci: exclude integration tests from coverage
moliholy Sep 29, 2025
586bea6
test(cli): run coverage with nextest
moliholy Sep 29, 2025
3d95488
Merge remote-tracking branch 'origin/main' into feat/build-spec-impro…
moliholy Sep 30, 2025
ab18c5a
Merge branch 'feat/build-spec-improvements' into feat/build-spec-runtime
moliholy Sep 30, 2025
d066624
Merge remote-tracking branch 'origin/main' into feat/build-spec-runtime
moliholy Sep 30, 2025
edbc9ed
fix(cli): path canonicalization
moliholy Sep 30, 2025
bb075ca
Merge remote-tracking branch 'origin/main' into feat/build-spec-runtime
moliholy Sep 30, 2025
7c01a1a
Merge remote-tracking branch 'origin/main' into feat/build-spec-runtime
moliholy Oct 1, 2025
b43754a
refactor(cli): simplify functions
moliholy Oct 1, 2025
d8838ab
feat: adapt the build-spec command to use the runtime
moliholy Oct 2, 2025
6f45f49
Merge remote-tracking branch 'origin/main' into feat/build-spec-runtime
moliholy Oct 2, 2025
59dc443
refactor(common): do not add unnecessary log entries
moliholy Oct 2, 2025
7c38c02
fix: import errors
moliholy Oct 2, 2025
163dcfb
fix: required chainspec parameters
moliholy Oct 2, 2025
f5a1cef
fix(cli): relay_chain field in raw chain specs
moliholy Oct 3, 2025
718a3f6
test(chains): address some chainspec-related errors
moliholy Oct 3, 2025
5b1cb7c
refactor(cli): do not use full path but alias
moliholy Oct 3, 2025
03c212d
feat(cli): use canonical path and display them as info
moliholy Oct 3, 2025
7219f6c
fix(cli): use the correct node binary path
moliholy Oct 3, 2025
d1898f0
fix: documentation tests
moliholy Oct 3, 2025
f214753
feat(cli): allow to generate spec with node/runtime features
moliholy Oct 3, 2025
d24e6d0
refactor: clippy issues
moliholy Oct 3, 2025
4202841
fix: compilation issues
moliholy Oct 3, 2025
021da78
fix(cli): do not make features mandatory
moliholy Oct 3, 2025
a085c03
feat(cli): allow to skip the build
moliholy Oct 3, 2025
ad3a732
fix: clippy issues
moliholy Oct 3, 2025
f271c2c
fix: doc tests
moliholy Oct 3, 2025
a6706dd
test(chain): add tests for ChainSpecBuilder
moliholy Oct 6, 2025
18e593b
feat(cli): get to choose the runtime preset to build
moliholy Oct 6, 2025
120fc99
fix(cli): correctly generate the raw chainspec if using runtime
moliholy Oct 6, 2025
3a645c2
chore: add extra message for fetching presets
moliholy Oct 6, 2025
14d85c1
fix: test for para id replacement
moliholy Oct 6, 2025
7d3ba94
fix: clippy issuefix: clippy issues
moliholy Oct 6, 2025
ae63fa9
fix: misssing import
moliholy Oct 6, 2025
89b3e05
fix: documentation
moliholy Oct 6, 2025
458d4ec
fix: correct fallback version of polkadot-omni-node
moliholy Oct 7, 2025
64a6892
fix: add tag pattern to polkadot-omni-node
moliholy Oct 7, 2025
136a9bc
Merge remote-tracking branch 'origin/main' into feat/build-spec-runtime
moliholy Oct 7, 2025
f690d24
feat: reuse an existing spiner when fetching binaries
moliholy Oct 7, 2025
48e4f25
Merge remote-tracking branch 'origin/main' into feat/build-spec-runtime
moliholy Oct 7, 2025
3d5f5c6
fix: compilation issue
moliholy Oct 7, 2025
7284829
Merge remote-tracking branch 'origin/main' into feat/build-spec-runtime
moliholy Oct 7, 2025
a3dd9c7
Merge remote-tracking branch 'origin/main' into feat/build-spec-runtime
moliholy Oct 8, 2025
3de5f88
Merge branch 'main' into feat/build-spec-runtime
moliholy Oct 8, 2025
2b8f215
test: add tests for the new build-spec command
moliholy Oct 9, 2025
c50b4d0
fix(cli): correctly set the default runtime location
moliholy Oct 9, 2025
a047266
fix: some tests
moliholy Oct 9, 2025
48de844
fix: release version ordering
moliholy Oct 9, 2025
61c0d24
Merge branch 'main' into feat/build-spec-runtime
moliholy Oct 13, 2025
a5f3b1c
fix(cli): remove unused dependency
moliholy Oct 13, 2025
9d0fc58
refactor(chains): update build-spec documentation
moliholy Oct 13, 2025
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
234 changes: 179 additions & 55 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ srtool-lib = { version = "0.13.2", default-features = false }
zombienet-configuration = { version = "0.3.1", default-features = false }
zombienet-sdk = { version = "0.3.1", default-features = false }
git2_credentials = "0.13.0"
cumulus-client-cli = { version = "0.22.0", default-features = false }

# benchmarking
cumulus-primitives-proof-size-hostfunction = "0.12.0"
Expand Down
2 changes: 2 additions & 0 deletions crates/pop-chains/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ srtool-lib.workspace = true
symlink.workspace = true
toml_edit.workspace = true
walkdir.workspace = true
cumulus-client-cli.workspace = true

# Zombienet
zombienet-configuration.workspace = true
zombienet-sdk.workspace = true
Expand Down
34 changes: 17 additions & 17 deletions crates/pop-chains/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,34 +25,34 @@ Build a chain:

```rust,no_run
use pop_common::Profile;
use pop_chains::build_chain;
use pop_chains::ChainSpecBuilder;
use std::path::Path;

let path = Path::new("./");
let package = None; // The optional package to be built.
let binary_path = build_chain(&path, package, &Profile::Release, None, vec![]).unwrap();
let builder = ChainSpecBuilder::Node { node_path: path.join("node"), default_bootnode: false, profile: Profile::Release };
let binary_path = builder.build(&[]).unwrap();
```

Build a chain with `runtime-benchmarks` feature:

```rs
let binary_path = build_chain(&path, package, &Profile::Release, None, vec!["runtime-benchmarks"]).unwrap();
let binary_path = builder.build(&["runtime-benchmarks".to_string()]).unwrap();
```

Generate a plain chain specification file and customize it with your specific chain values:

```rust,no_run
use pop_common::Profile;
use pop_chains::{build_chain, export_wasm_file, generate_plain_chain_spec, generate_raw_chain_spec, generate_genesis_state_file, ChainSpec};
use pop_chains::{ChainSpecBuilder, ChainSpec};
use std::path::Path;

let path = Path::new("./"); // Location of the parachain project.
let package = None; // The optional package to be built.
// The path to the node binary executable.
let binary_path = build_chain(&path, package, &Profile::Release, None, vec![]).unwrap();;
let builder = ChainSpecBuilder::Node { node_path: path.join("node"), default_bootnode: false, profile: Profile::Release };
// Build the node binary first
builder.build(&[]).unwrap();
// Generate a plain chain specification file of a parachain
let plain_chain_spec_path = path.join("plain-parachain-chainspec.json");
generate_plain_chain_spec(&binary_path, &plain_chain_spec_path, true, "dev");
builder.generate_plain_chain_spec("dev", &plain_chain_spec_path).unwrap();
// Customize your chain specification
let mut chain_spec = ChainSpec::from(&plain_chain_spec_path).unwrap();
chain_spec.replace_para_id(2002);
Expand All @@ -67,22 +67,22 @@ Generate a raw chain specification file and export the WASM and genesis state fi

```rust,no_run
use pop_common::Profile;
use pop_chains::{build_chain, export_wasm_file, generate_plain_chain_spec, generate_raw_chain_spec, generate_genesis_state_file};
use pop_chains::{ChainSpecBuilder, generate_genesis_state_file_with_node};
use std::path::Path;

let path = Path::new("./"); // Location of the parachain project.
let package = None; // The optional package to be built.
// The path to the node binary executable.
let binary_path = build_chain(&path, package, &Profile::Release, None, vec![]).unwrap();;
let builder = ChainSpecBuilder::Node { node_path: path.join("node"), default_bootnode: false, profile: Profile::Release };
// Build the node binary first
let binary_path = builder.build(&[]).unwrap();
// Generate a plain chain specification file of a parachain
let plain_chain_spec_path = path.join("plain-parachain-chainspec.json");
generate_plain_chain_spec(&binary_path, &plain_chain_spec_path, true, "dev");
builder.generate_plain_chain_spec("dev", &plain_chain_spec_path).unwrap();
// Generate a raw chain specification file of a parachain
let chain_spec = generate_raw_chain_spec(&binary_path, &plain_chain_spec_path, "raw-parachain-chainspec.json").unwrap();
let chain_spec = builder.generate_raw_chain_spec(&plain_chain_spec_path, "raw-parachain-chainspec.json").unwrap();
// Export the WebAssembly runtime for the parachain.
let wasm_file = export_wasm_file(&binary_path, &chain_spec, "para-2000-wasm").unwrap();
let wasm_file = builder.export_wasm_file(&chain_spec, "para-2000-wasm").unwrap();
// Generate the parachain genesis state.
let genesis_state_file = generate_genesis_state_file(&binary_path, &chain_spec, "para-2000-genesis-state").unwrap();
let genesis_state_file = generate_genesis_state_file_with_node(&binary_path, &chain_spec, "para-2000-genesis-state").unwrap();
```

Run a chain:
Expand Down
22 changes: 2 additions & 20 deletions crates/pop-chains/src/bench/mod.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
// SPDX-License-Identifier: GPL-3.0

use crate::Error;
use crate::{Error, utils::helpers::HostFunctions};
use clap::Parser;
use duct::cmd;
use frame_benchmarking_cli::PalletCmd;
pub use frame_benchmarking_cli::{BlockCmd, MachineCmd, OverheadCmd, StorageCmd};
use sc_chain_spec::GenesisConfigBuilderRuntimeCaller;
use serde::{Deserialize, Serialize};
use sp_runtime::traits::BlakeTwo256;
use std::{
collections::BTreeMap,
fmt::Display,
fs,
io::Read,
path::{Path, PathBuf},
};
Expand All @@ -27,11 +25,6 @@ pub mod binary;
/// (Recommended for testing with a single node, e.g., for benchmarking)
pub const GENESIS_BUILDER_DEV_PRESET: &str = "development";

type HostFunctions = (
sp_statement_store::runtime_api::HostFunctions,
cumulus_primitives_proof_size_hostfunction::storage_proof_size::HostFunctions,
);

/// Type alias for records where the key is the pallet name and the value is an array of its
/// extrinsics.
pub type PalletExtrinsicsRegistry = BTreeMap<String, Vec<String>>;
Expand Down Expand Up @@ -106,18 +99,6 @@ impl TryFrom<String> for GenesisBuilderPolicy {
}
}

/// Get genesis builder preset names of the runtime.
///
/// # Arguments
/// * `binary_path` - Path to the runtime binary.
pub fn get_preset_names(binary_path: &PathBuf) -> Result<Vec<String>, Error> {
let binary = fs::read(binary_path)?;
let genesis_config_builder = GenesisConfigBuilderRuntimeCaller::<HostFunctions>::new(&binary);
genesis_config_builder
.preset_names()
.map_err(|e| Error::GenesisBuilderError(e.to_string()))
}

/// Get the runtime folder path and throws error if it does not exist.
///
/// # Arguments
Expand Down Expand Up @@ -263,6 +244,7 @@ pub fn generate_omni_bencher_benchmarks(
mod tests {
use super::*;
use binary::omni_bencher_generator;
use std::fs;
use tempfile::tempdir;

#[test]
Expand Down
Loading
Loading