From 2ed4d7a1859ae4473ed66df67d0bcaa7c75ae3a2 Mon Sep 17 00:00:00 2001 From: AlexD10S Date: Fri, 16 Aug 2024 13:25:21 +0200 Subject: [PATCH 01/17] refactor: move extract_template_files into common crate --- crates/pop-common/src/lib.rs | 1 + crates/pop-common/src/templates/extractor.rs | 96 ++++++++++++++++ .../src/{templates.rs => templates/mod.rs} | 2 + crates/pop-contracts/src/new.rs | 108 ++---------------- crates/pop-contracts/src/utils/helpers.rs | 24 ---- 5 files changed, 109 insertions(+), 122 deletions(-) create mode 100644 crates/pop-common/src/templates/extractor.rs rename crates/pop-common/src/{templates.rs => templates/mod.rs} (99%) diff --git a/crates/pop-common/src/lib.rs b/crates/pop-common/src/lib.rs index f4a08bf7..cf375654 100644 --- a/crates/pop-common/src/lib.rs +++ b/crates/pop-common/src/lib.rs @@ -10,6 +10,7 @@ pub use build::Profile; pub use errors::Error; pub use git::{Git, GitHub, Release}; pub use helpers::{get_project_name_from_path, replace_in_file}; +pub use templates::extractor::extract_template_files; static APP_USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION")); diff --git a/crates/pop-common/src/templates/extractor.rs b/crates/pop-common/src/templates/extractor.rs new file mode 100644 index 00000000..dba09122 --- /dev/null +++ b/crates/pop-common/src/templates/extractor.rs @@ -0,0 +1,96 @@ +// SPDX-License-Identifier: GPL-3.0 + +use anyhow::Result; +use std::{fs, io, path::Path}; + +/// Extracts the specified template files from the repository folder to the target folder. +/// +/// # Arguments +/// * `template_name` - The name of the template to extract. +/// * `repo_folder` - The path to the repository folder containing the template. +/// * `target_folder` - The destination path where the template files should be copied. +/// * `ignore_folders` - A vector of folder names to ignore during the extraction. If empty, no folders are ignored. +/// +pub fn extract_template_files( + template_name: String, + repo_folder: &Path, + target_folder: &Path, + ignore_folders: Option>, +) -> Result<()> { + let template_folder = repo_folder.join(template_name); + // Recursively copy all folders and files within. Ignores the specified ones. + copy_dir_all(&template_folder, target_folder, &ignore_folders.unwrap_or_else(|| vec![]))?; + Ok(()) +} + +/// Recursively copy a directory and its files. +/// +/// # Arguments +/// * `src`: - The source path of the directory to be copied. +/// * `dst`: - The destination path where the directory and its contents will be copied. +/// * `ignore_folders` - Folders to ignore during the copy process. +/// +fn copy_dir_all( + src: impl AsRef, + dst: impl AsRef, + ignore_folders: &Vec, +) -> io::Result<()> { + fs::create_dir_all(&dst)?; + for entry in fs::read_dir(src)? { + let entry = entry?; + let ty = entry.file_type()?; + if ty.is_dir() && ignore_folders.contains(&entry.file_name().to_string_lossy().to_string()) + { + continue; + } else if ty.is_dir() { + copy_dir_all(entry.path(), dst.as_ref().join(entry.file_name()), ignore_folders)?; + } else { + fs::copy(entry.path(), dst.as_ref().join(entry.file_name()))?; + } + } + Ok(()) +} + +#[cfg(test)] +mod tests { + use super::*; + use anyhow::{Error, Result}; + use std::fs; + + fn generate_testing_contract(template: &str) -> Result { + let temp_dir = tempfile::tempdir()?; + let template_folder = temp_dir.path().join(template.to_string()); + fs::create_dir(&template_folder)?; + fs::File::create(&template_folder.join("lib.rs"))?; + fs::File::create(&template_folder.join("Cargo.toml"))?; + fs::create_dir(&temp_dir.path().join("noise_folder"))?; + fs::create_dir(&template_folder.join("frontend"))?; + Ok(temp_dir) + } + #[test] + fn extract_template_files_works() -> Result<(), Error> { + // Contract + let mut temp_dir = generate_testing_contract("erc20")?; + let mut output_dir = tempfile::tempdir()?; + extract_template_files("erc20".to_string(), temp_dir.path(), output_dir.path(), None)?; + assert!(output_dir.path().join("lib.rs").exists()); + assert!(output_dir.path().join("Cargo.toml").exists()); + assert!(output_dir.path().join("frontend").exists()); + assert!(!output_dir.path().join("noise_folder").exists()); + // ignore the frontend folder + temp_dir = generate_testing_contract("erc721")?; + output_dir = tempfile::tempdir()?; + extract_template_files( + "erc721".to_string(), + temp_dir.path(), + output_dir.path(), + Some(vec!["frontend".to_string()]), + )?; + assert!(output_dir.path().join("lib.rs").exists()); + assert!(output_dir.path().join("Cargo.toml").exists()); + assert!(!output_dir.path().join("frontend").exists()); + assert!(!output_dir.path().join("noise_folder").exists()); + + Ok(()) + } +} diff --git a/crates/pop-common/src/templates.rs b/crates/pop-common/src/templates/mod.rs similarity index 99% rename from crates/pop-common/src/templates.rs rename to crates/pop-common/src/templates/mod.rs index f3cd14e8..e4f7604a 100644 --- a/crates/pop-common/src/templates.rs +++ b/crates/pop-common/src/templates/mod.rs @@ -3,6 +3,8 @@ use strum::{EnumMessage, EnumProperty, VariantArray}; pub use thiserror::Error; +pub mod extractor; + #[derive(Error, Debug)] pub enum Error { #[error("The `Repository` property is missing from the template variant")] diff --git a/crates/pop-contracts/src/new.rs b/crates/pop-contracts/src/new.rs index 13232a74..e1a05b0f 100644 --- a/crates/pop-contracts/src/new.rs +++ b/crates/pop-contracts/src/new.rs @@ -1,14 +1,10 @@ // SPDX-License-Identifier: GPL-3.0 -use crate::{ - errors::Error, - utils::helpers::{canonicalized_path, copy_dir_all}, - Contract, -}; +use crate::{errors::Error, utils::helpers::canonicalized_path, Contract}; use anyhow::Result; use contract_build::new_contract_project; use heck::ToUpperCamelCase; -use pop_common::{replace_in_file, templates::Template, Git}; +use pop_common::{extract_template_files, replace_in_file, templates::Template, Git}; use std::collections::HashMap; use std::path::{Path, PathBuf}; use url::Url; @@ -67,12 +63,18 @@ fn create_template_contract( // Retrieve only the template contract files. if template == &Contract::PSP22 || template == &Contract::PSP34 { // Different template structure requires extracting different path - extract_contract_files(String::from(""), temp_dir.path(), canonicalized_path.as_path())?; + extract_template_files( + String::from(""), + temp_dir.path(), + canonicalized_path.as_path(), + None, + )?; } else { - extract_contract_files( + extract_template_files( template.to_string(), temp_dir.path(), canonicalized_path.as_path(), + Some(vec!["frontend".to_string()]), )?; } @@ -81,17 +83,6 @@ fn create_template_contract( Ok(()) } -fn extract_contract_files( - contract_name: String, - repo_folder: &Path, - target_folder: &Path, -) -> Result<()> { - let contract_folder = repo_folder.join(contract_name); - // Recursively copy all folders and files within. Ignores frontend folders. - copy_dir_all(&contract_folder, target_folder)?; - Ok(()) -} - pub fn rename_contract(name: &str, path: PathBuf, template: &Contract) -> Result<()> { let template_name = template.to_string().to_lowercase(); // Replace name in the Cargo.toml file. @@ -170,85 +161,6 @@ mod tests { Ok(()) } - fn generate_testing_files_and_folders(template: Contract) -> Result { - let temp_dir = tempfile::tempdir()?; - let contract_folder = temp_dir.path().join(template.to_string()); - fs::create_dir(&contract_folder)?; - fs::File::create(&contract_folder.join("lib.rs"))?; - fs::File::create(&contract_folder.join("Cargo.toml"))?; - fs::create_dir(&temp_dir.path().join("noise_folder"))?; - Ok(temp_dir) - } - - #[test] - fn test_extract_contract_files() -> Result<(), Error> { - // ERC-20 - let mut temp_dir = generate_testing_files_and_folders(Contract::ERC20)?; - let mut output_dir = tempfile::tempdir()?; - extract_contract_files(Contract::ERC20.to_string(), temp_dir.path(), output_dir.path())?; - assert!(output_dir.path().join("lib.rs").exists()); - assert!(output_dir.path().join("Cargo.toml").exists()); - assert!(!output_dir.path().join("noise_folder").exists()); - assert!(!output_dir.path().join("frontend").exists()); - // ERC-721 - temp_dir = generate_testing_files_and_folders(Contract::ERC721)?; - output_dir = tempfile::tempdir()?; - extract_contract_files(Contract::ERC721.to_string(), temp_dir.path(), output_dir.path())?; - assert!(output_dir.path().join("lib.rs").exists()); - assert!(output_dir.path().join("Cargo.toml").exists()); - assert!(!output_dir.path().join("noise_folder").exists()); - assert!(!output_dir.path().join("frontend").exists()); - // ERC-1155 - temp_dir = generate_testing_files_and_folders(Contract::ERC1155)?; - output_dir = tempfile::tempdir()?; - extract_contract_files(Contract::ERC1155.to_string(), temp_dir.path(), output_dir.path())?; - assert!(output_dir.path().join("lib.rs").exists()); - assert!(output_dir.path().join("Cargo.toml").exists()); - assert!(!output_dir.path().join("noise_folder").exists()); - assert!(!output_dir.path().join("frontend").exists()); - // PSP22 - temp_dir = generate_testing_files_and_folders(Contract::PSP22)?; - output_dir = tempfile::tempdir()?; - extract_contract_files(Contract::PSP22.to_string(), temp_dir.path(), output_dir.path())?; - assert!(output_dir.path().join("lib.rs").exists()); - assert!(output_dir.path().join("Cargo.toml").exists()); - assert!(!output_dir.path().join("noise_folder").exists()); - // PSP34 - temp_dir = generate_testing_files_and_folders(Contract::PSP34)?; - output_dir = tempfile::tempdir()?; - extract_contract_files(Contract::PSP34.to_string(), temp_dir.path(), output_dir.path())?; - assert!(output_dir.path().join("lib.rs").exists()); - assert!(output_dir.path().join("Cargo.toml").exists()); - assert!(!output_dir.path().join("noise_folder").exists()); - // DNS - temp_dir = generate_testing_files_and_folders(Contract::DNS)?; - output_dir = tempfile::tempdir()?; - extract_contract_files(Contract::DNS.to_string(), temp_dir.path(), output_dir.path())?; - assert!(output_dir.path().join("lib.rs").exists()); - assert!(output_dir.path().join("Cargo.toml").exists()); - assert!(!output_dir.path().join("noise_folder").exists()); - // CrossContract - temp_dir = generate_testing_files_and_folders(Contract::CrossContract)?; - output_dir = tempfile::tempdir()?; - extract_contract_files( - Contract::CrossContract.to_string(), - temp_dir.path(), - output_dir.path(), - )?; - assert!(output_dir.path().join("lib.rs").exists()); - assert!(output_dir.path().join("Cargo.toml").exists()); - assert!(!output_dir.path().join("noise_folder").exists()); - // Multisig - temp_dir = generate_testing_files_and_folders(Contract::Multisig)?; - output_dir = tempfile::tempdir()?; - extract_contract_files(Contract::Multisig.to_string(), temp_dir.path(), output_dir.path())?; - assert!(output_dir.path().join("lib.rs").exists()); - assert!(output_dir.path().join("Cargo.toml").exists()); - assert!(!output_dir.path().join("noise_folder").exists()); - - Ok(()) - } - fn generate_contract_folder() -> Result { let temp_dir = tempfile::tempdir()?; let config = temp_dir.path().join("Cargo.toml"); diff --git a/crates/pop-contracts/src/utils/helpers.rs b/crates/pop-contracts/src/utils/helpers.rs index e89a80a8..ca94aa34 100644 --- a/crates/pop-contracts/src/utils/helpers.rs +++ b/crates/pop-contracts/src/utils/helpers.rs @@ -5,7 +5,6 @@ use contract_build::ManifestPath; use contract_extrinsics::BalanceVariant; use ink_env::{DefaultEnvironment, Environment}; use std::{ - fs, io, path::{Path, PathBuf}, str::FromStr, }; @@ -46,29 +45,6 @@ pub fn canonicalized_path(target: &Path) -> Result { // If an I/O error occurs during canonicalization, convert it into an Error enum variant. .map_err(|e| Error::IO(e)) } -/// Recursively copy a directory and its files. -/// -/// # Arguments -/// -/// * `src`: - Path to copy from -/// * `dst`: - Path to copy to -/// -pub fn copy_dir_all(src: impl AsRef, dst: impl AsRef) -> io::Result<()> { - fs::create_dir_all(&dst)?; - for entry in fs::read_dir(src)? { - let entry = entry?; - let ty = entry.file_type()?; - // Ignore frontend folder in templates - if ty.is_dir() && entry.file_name() == "frontend" { - continue; - } else if ty.is_dir() { - copy_dir_all(entry.path(), dst.as_ref().join(entry.file_name()))?; - } else { - fs::copy(entry.path(), dst.as_ref().join(entry.file_name()))?; - } - } - Ok(()) -} #[cfg(test)] mod tests { From de2dcb9abe0b6a4c1e140a4fe52288ebe149deaa Mon Sep 17 00:00:00 2001 From: AlexD10S Date: Fri, 16 Aug 2024 13:30:46 +0200 Subject: [PATCH 02/17] fix: unnnecesary API query --- Cargo.lock | 1130 +----------------- crates/pop-cli/src/commands/new/parachain.rs | 1 - 2 files changed, 45 insertions(+), 1086 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2349e616..78df5b22 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -164,29 +164,6 @@ version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" -[[package]] -name = "approx" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" -dependencies = [ - "num-traits", -] - -[[package]] -name = "aquamarine" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21cc1548309245035eb18aa7f0967da6bc65587005170c56e6ef2788a4cf3f4e" -dependencies = [ - "include_dir", - "itertools 0.10.5", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.66", -] - [[package]] name = "ark-bls12-377" version = "0.4.0" @@ -940,12 +917,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "bytemuck" -version = "1.16.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "102087e286b4677862ea56cf8fc58bb2cdfa8725c40ffb80fe3a008eb7f2fc83" - [[package]] name = "byteorder" version = "1.5.0" @@ -1017,15 +988,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" -[[package]] -name = "cfg-expr" -version = "0.15.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" -dependencies = [ - "smallvec", -] - [[package]] name = "cfg-if" version = "1.0.0" @@ -1196,26 +1158,6 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" -[[package]] -name = "const-random" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359" -dependencies = [ - "const-random-macro", -] - -[[package]] -name = "const-random-macro" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" -dependencies = [ - "getrandom", - "once_cell", - "tiny-keccak", -] - [[package]] name = "const_env" version = "0.1.2" @@ -1318,9 +1260,9 @@ dependencies = [ "scale-info", "serde", "serde_json", - "sp-core 31.0.0", - "sp-runtime 34.0.0", - "sp-weights 30.0.0", + "sp-core", + "sp-runtime", + "sp-weights", "subxt 0.35.3", "tokio", "tracing", @@ -2156,22 +2098,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "finality-grandpa" -version = "0.16.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36530797b9bf31cd4ff126dcfee8170f86b00cfdcea3269d73133cc0415945c3" -dependencies = [ - "either", - "futures", - "futures-timer", - "log", - "num-traits", - "parity-scale-codec", - "parking_lot", - "scale-info", -] - [[package]] name = "finito" version = "0.1.0" @@ -2243,52 +2169,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "frame-benchmarking" -version = "34.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "130b79108bca3d8850e850c276f1012058593d6a2a8774132e72766245bbcacc" -dependencies = [ - "frame-support", - "frame-support-procedural", - "frame-system", - "linregress", - "log", - "parity-scale-codec", - "paste", - "scale-info", - "serde", - "sp-api", - "sp-application-crypto 36.0.0", - "sp-core 33.0.1", - "sp-io 36.0.0", - "sp-runtime 37.0.0", - "sp-runtime-interface 27.0.0", - "sp-std", - "sp-storage 21.0.0", - "static_assertions", -] - -[[package]] -name = "frame-executive" -version = "34.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5ab937cea917f5875b0e08d55ed941f9c82c2b08628d6bf47b90c63c48ef607" -dependencies = [ - "aquamarine", - "frame-support", - "frame-system", - "frame-try-runtime", - "log", - "parity-scale-codec", - "scale-info", - "sp-core 33.0.1", - "sp-io 36.0.0", - "sp-runtime 37.0.0", - "sp-std", - "sp-tracing 17.0.0", -] - [[package]] name = "frame-metadata" version = "15.1.0" @@ -2312,152 +2192,6 @@ dependencies = [ "serde", ] -[[package]] -name = "frame-support" -version = "34.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c177377726d7bb598dd942e38168c1eb6872d53810a6bf810f0a428f9a46be8" -dependencies = [ - "aquamarine", - "array-bytes", - "bitflags 1.3.2", - "docify", - "environmental", - "frame-metadata 16.0.0", - "frame-support-procedural", - "impl-trait-for-tuples", - "k256", - "log", - "macro_magic", - "parity-scale-codec", - "paste", - "scale-info", - "serde", - "serde_json", - "smallvec", - "sp-api", - "sp-arithmetic 26.0.0", - "sp-core 33.0.1", - "sp-crypto-hashing-proc-macro", - "sp-debug-derive", - "sp-genesis-builder", - "sp-inherents", - "sp-io 36.0.0", - "sp-metadata-ir", - "sp-runtime 37.0.0", - "sp-staking", - "sp-state-machine 0.41.0", - "sp-std", - "sp-tracing 17.0.0", - "sp-weights 31.0.0", - "static_assertions", - "tt-call", -] - -[[package]] -name = "frame-support-procedural" -version = "29.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f822826825d810d0e096e70493cbc1032ff3ccf1324d861040865635112b6aa" -dependencies = [ - "Inflector", - "cfg-expr", - "derive-syn-parse", - "expander", - "frame-support-procedural-tools", - "itertools 0.11.0", - "macro_magic", - "proc-macro-warning", - "proc-macro2", - "quote", - "sp-crypto-hashing", - "syn 2.0.66", -] - -[[package]] -name = "frame-support-procedural-tools" -version = "12.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a40b5cc8526c9aad01cdf46dcee6cbefd6f6c78e022607ff4cf76094919b6462" -dependencies = [ - "frame-support-procedural-tools-derive", - "proc-macro-crate 3.1.0", - "proc-macro2", - "quote", - "syn 2.0.66", -] - -[[package]] -name = "frame-support-procedural-tools-derive" -version = "12.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed971c6435503a099bdac99fe4c5bea08981709e5b5a0a8535a1856f48561191" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", -] - -[[package]] -name = "frame-system" -version = "34.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85777d5cb78d8f244aa4e92a06d13c234f7980dd7095b1baeefc23a5945cad6c" -dependencies = [ - "cfg-if", - "docify", - "frame-support", - "log", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core 33.0.1", - "sp-io 36.0.0", - "sp-runtime 37.0.0", - "sp-std", - "sp-version", - "sp-weights 31.0.0", -] - -[[package]] -name = "frame-system-benchmarking" -version = "34.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2df1ebcb669ae29aec03f6f87b232f2446942fb79fad72434d8d0a0fd7df917" -dependencies = [ - "frame-benchmarking", - "frame-support", - "frame-system", - "parity-scale-codec", - "scale-info", - "sp-core 33.0.1", - "sp-runtime 37.0.0", - "sp-std", -] - -[[package]] -name = "frame-system-rpc-runtime-api" -version = "32.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd92e3fe18b93d456efdabbd98070a1d720be5b6affe589379db9b7d9272eba5" -dependencies = [ - "parity-scale-codec", - "sp-api", -] - -[[package]] -name = "frame-try-runtime" -version = "0.40.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "748a6c8286447388ff7a35d88fc2e0be3b26238c609c88b7774615c274452413" -dependencies = [ - "frame-support", - "parity-scale-codec", - "sp-api", - "sp-runtime 37.0.0", - "sp-std", -] - [[package]] name = "fs-err" version = "2.11.0" @@ -3174,25 +2908,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "include_dir" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "923d117408f1e49d914f1a379a309cffe4f18c05cf4e3d12e613a15fc81bd0dd" -dependencies = [ - "include_dir_macros", -] - -[[package]] -name = "include_dir_macros" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cab85a7ed0bd5f0e76d93846e0147172bed2e2d3f859bcc33a8d9699cad1a75" -dependencies = [ - "proc-macro2", - "quote", -] - [[package]] name = "indent_write" version = "2.2.0" @@ -3408,15 +3123,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.12.1" @@ -4060,15 +3766,6 @@ dependencies = [ "syn 2.0.66", ] -[[package]] -name = "linregress" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4de04dcecc58d366391f9920245b85ffa684558a5ef6e7736e754347c3aea9c2" -dependencies = [ - "nalgebra", -] - [[package]] name = "linux-raw-sys" version = "0.1.4" @@ -4115,54 +3812,6 @@ dependencies = [ "libc", ] -[[package]] -name = "macro_magic" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc33f9f0351468d26fbc53d9ce00a096c8522ecb42f19b50f34f2c422f76d21d" -dependencies = [ - "macro_magic_core", - "macro_magic_macros", - "quote", - "syn 2.0.66", -] - -[[package]] -name = "macro_magic_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1687dc887e42f352865a393acae7cf79d98fab6351cde1f58e9e057da89bf150" -dependencies = [ - "const-random", - "derive-syn-parse", - "macro_magic_core_macros", - "proc-macro2", - "quote", - "syn 2.0.66", -] - -[[package]] -name = "macro_magic_core_macros" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b02abfe41815b5bd98dbd4260173db2c116dda171dc0fe7838cb206333b83308" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", -] - -[[package]] -name = "macro_magic_macros" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73ea28ee64b88876bf45277ed9a5817c1817df061a74f2b988971a12570e5869" -dependencies = [ - "macro_magic_core", - "quote", - "syn 2.0.66", -] - [[package]] name = "matchers" version = "0.0.1" @@ -4172,16 +3821,6 @@ dependencies = [ "regex-automata 0.1.10", ] -[[package]] -name = "matrixmultiply" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9380b911e3e96d10c1f415da0876389aaf1b56759054eeb0de7df940c456ba1a" -dependencies = [ - "autocfg", - "rawpointer", -] - [[package]] name = "memchr" version = "2.7.4" @@ -4343,33 +3982,6 @@ dependencies = [ "unsigned-varint", ] -[[package]] -name = "nalgebra" -version = "0.32.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5c17de023a86f59ed79891b2e5d5a94c705dbe904a5b5c9c952ea6221b03e4" -dependencies = [ - "approx", - "matrixmultiply", - "nalgebra-macros", - "num-complex", - "num-rational", - "num-traits", - "simba", - "typenum", -] - -[[package]] -name = "nalgebra-macros" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "254a5372af8fc138e36684761d3c0cdb758a4410e938babcff1c860ce14ddbfc" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", -] - [[package]] name = "native-tls" version = "0.2.12" @@ -4456,17 +4068,8 @@ dependencies = [ ] [[package]] -name = "num-complex" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-conv" -version = "0.1.0" +name = "num-conv" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" @@ -4660,19 +4263,6 @@ dependencies = [ "scale-info", ] -[[package]] -name = "pallet-pallet_template" -version = "0.1.0" -dependencies = [ - "parity-scale-codec", - "polkadot-sdk-frame", - "scale-info", - "sp-core 33.0.1", - "sp-io 36.0.0", - "sp-runtime 37.0.0", - "sp-std", -] - [[package]] name = "parity-bip39" version = "2.0.1" @@ -4895,40 +4485,6 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" -[[package]] -name = "polkadot-sdk-frame" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ec0dde5d78825364c0e574ef18578cb9ca909363f595344115d006379b13f73" -dependencies = [ - "docify", - "frame-benchmarking", - "frame-executive", - "frame-support", - "frame-system", - "frame-system-benchmarking", - "frame-system-rpc-runtime-api", - "frame-try-runtime", - "log", - "parity-scale-codec", - "scale-info", - "sp-api", - "sp-arithmetic 26.0.0", - "sp-block-builder", - "sp-consensus-aura", - "sp-consensus-grandpa", - "sp-core 33.0.1", - "sp-inherents", - "sp-io 36.0.0", - "sp-offchain", - "sp-runtime 37.0.0", - "sp-session", - "sp-std", - "sp-storage 21.0.0", - "sp-transaction-pool", - "sp-version", -] - [[package]] name = "polkavm-common" version = "0.5.0" @@ -5078,8 +4634,8 @@ dependencies = [ "predicates", "reqwest 0.12.5", "serde_json", - "sp-core 31.0.0", - "sp-weights 30.0.0", + "sp-core", + "sp-weights", "strum 0.26.2", "strum_macros 0.26.4", "tempfile", @@ -5127,8 +4683,8 @@ dependencies = [ "mockito", "pop-common", "reqwest 0.12.5", - "sp-core 31.0.0", - "sp-weights 30.0.0", + "sp-core", + "sp-weights", "strum 0.26.2", "strum_macros 0.26.4", "subxt 0.35.3", @@ -5300,17 +4856,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "proc-macro-warning" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "834da187cfe638ae8abb0203f0b33e5ccdb02a28e7199f2f47b3e2754f50edca" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.66", -] - [[package]] name = "proc-macro2" version = "1.0.85" @@ -5409,12 +4954,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "rawpointer" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" - [[package]] name = "reconnecting-jsonrpsee-ws-client" version = "0.4.3" @@ -5919,15 +5458,6 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" -[[package]] -name = "safe_arch" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3460605018fdc9612bce72735cba0d27efbcd9904780d44c7e3a9948f96148a" -dependencies = [ - "bytemuck", -] - [[package]] name = "same-file" version = "1.0.6" @@ -6673,19 +6203,6 @@ dependencies = [ "rand_core 0.6.4", ] -[[package]] -name = "simba" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "061507c94fc6ab4ba1c9a0305018408e312e17c041eb63bef8aa726fa33aceae" -dependencies = [ - "approx", - "num-complex", - "num-traits", - "paste", - "wide", -] - [[package]] name = "simdutf8" version = "0.1.4" @@ -6879,44 +6396,6 @@ dependencies = [ "sha1", ] -[[package]] -name = "sp-api" -version = "32.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f84f09c4b928e814e07dede0ece91f1f6eae1bff946a0e5e4a76bed19a095f1" -dependencies = [ - "hash-db", - "log", - "parity-scale-codec", - "scale-info", - "sp-api-proc-macro", - "sp-core 33.0.1", - "sp-externalities 0.28.0", - "sp-metadata-ir", - "sp-runtime 37.0.0", - "sp-runtime-interface 27.0.0", - "sp-state-machine 0.41.0", - "sp-std", - "sp-trie 35.0.0", - "sp-version", - "thiserror", -] - -[[package]] -name = "sp-api-proc-macro" -version = "19.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213a4bec1b18bd0750e7b81d11d8276c24f68b53cde83950b00b178ecc9ab24a" -dependencies = [ - "Inflector", - "blake2", - "expander", - "proc-macro-crate 3.1.0", - "proc-macro2", - "quote", - "syn 2.0.66", -] - [[package]] name = "sp-application-crypto" version = "33.0.0" @@ -6926,22 +6405,8 @@ dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-core 31.0.0", - "sp-io 33.0.0", - "sp-std", -] - -[[package]] -name = "sp-application-crypto" -version = "36.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "296282f718f15d4d812664415942665302a484d3495cf8d2e2ab3192b32d2c73" -dependencies = [ - "parity-scale-codec", - "scale-info", - "serde", - "sp-core 33.0.1", - "sp-io 36.0.0", + "sp-core", + "sp-io", "sp-std", ] @@ -6960,80 +6425,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "sp-arithmetic" -version = "26.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46d0d0a4c591c421d3231ddd5e27d828618c24456d51445d21a1f79fcee97c23" -dependencies = [ - "docify", - "integer-sqrt", - "num-traits", - "parity-scale-codec", - "scale-info", - "serde", - "sp-std", - "static_assertions", -] - -[[package]] -name = "sp-block-builder" -version = "32.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "329e1cfb98f113d91d0db80a6e984cbb7e990f03ef599a8dc356723a47d40509" -dependencies = [ - "sp-api", - "sp-inherents", - "sp-runtime 37.0.0", -] - -[[package]] -name = "sp-consensus-aura" -version = "0.38.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "464c5ec1ffcf83739b8ff7c8ecffdb95766d6be0c30e324cd76b22180d3d6f11" -dependencies = [ - "async-trait", - "parity-scale-codec", - "scale-info", - "sp-api", - "sp-application-crypto 36.0.0", - "sp-consensus-slots", - "sp-inherents", - "sp-runtime 37.0.0", - "sp-timestamp", -] - -[[package]] -name = "sp-consensus-grandpa" -version = "19.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7deefa0a09cb191c0cb7a7aa8603414283f9aaa3a0fbc94fb68ff9a858f6fab2" -dependencies = [ - "finality-grandpa", - "log", - "parity-scale-codec", - "scale-info", - "serde", - "sp-api", - "sp-application-crypto 36.0.0", - "sp-core 33.0.1", - "sp-keystore 0.39.0", - "sp-runtime 37.0.0", -] - -[[package]] -name = "sp-consensus-slots" -version = "0.38.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063ccdb38545602e45205e6b186e3d47508912c9b785321f907201564697f1c0" -dependencies = [ - "parity-scale-codec", - "scale-info", - "serde", - "sp-timestamp", -] - [[package]] name = "sp-core" version = "31.0.0" @@ -7069,59 +6460,12 @@ dependencies = [ "serde", "sp-crypto-hashing", "sp-debug-derive", - "sp-externalities 0.27.0", - "sp-runtime-interface 26.0.0", - "sp-std", - "sp-storage 20.0.0", - "ss58-registry", - "substrate-bip39 0.5.0", - "thiserror", - "tracing", - "w3f-bls", - "zeroize", -] - -[[package]] -name = "sp-core" -version = "33.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3368e32f6fda6e20b8af51f94308d033ab70a021e87f6abbd3fed5aca942b745" -dependencies = [ - "array-bytes", - "bitflags 1.3.2", - "blake2", - "bounded-collections", - "bs58", - "dyn-clonable", - "ed25519-zebra 4.0.3", - "futures", - "hash-db", - "hash256-std-hasher", - "impl-serde", - "itertools 0.11.0", - "k256", - "libsecp256k1", - "log", - "merlin", - "parity-bip39", - "parity-scale-codec", - "parking_lot", - "paste", - "primitive-types", - "rand", - "scale-info", - "schnorrkel", - "secp256k1", - "secrecy", - "serde", - "sp-crypto-hashing", - "sp-debug-derive", - "sp-externalities 0.28.0", - "sp-runtime-interface 27.0.0", + "sp-externalities", + "sp-runtime-interface", "sp-std", - "sp-storage 21.0.0", + "sp-storage", "ss58-registry", - "substrate-bip39 0.6.0", + "substrate-bip39", "thiserror", "tracing", "w3f-bls", @@ -7142,17 +6486,6 @@ dependencies = [ "twox-hash", ] -[[package]] -name = "sp-crypto-hashing-proc-macro" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b85d0f1f1e44bd8617eb2a48203ee854981229e3e79e6f468c7175d5fd37489b" -dependencies = [ - "quote", - "sp-crypto-hashing", - "syn 2.0.66", -] - [[package]] name = "sp-debug-derive" version = "14.0.0" @@ -7173,45 +6506,7 @@ dependencies = [ "environmental", "parity-scale-codec", "sp-std", - "sp-storage 20.0.0", -] - -[[package]] -name = "sp-externalities" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33abaec4be69b1613796bbf430decbbcaaf978756379e2016e683a4d6379cd02" -dependencies = [ - "environmental", - "parity-scale-codec", - "sp-storage 21.0.0", -] - -[[package]] -name = "sp-genesis-builder" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eb26e3653f6a2feac2bcb2749b5fb080e4211b882cafbdba86e4304c03c72c8" -dependencies = [ - "parity-scale-codec", - "scale-info", - "serde_json", - "sp-api", - "sp-runtime 37.0.0", -] - -[[package]] -name = "sp-inherents" -version = "32.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6766db70e0c371d43bfbf7a8950d2cb10cff6b76c8a2c5bd1336e7566b46a0cf" -dependencies = [ - "async-trait", - "impl-trait-for-tuples", - "parity-scale-codec", - "scale-info", - "sp-runtime 37.0.0", - "thiserror", + "sp-storage", ] [[package]] @@ -7228,42 +6523,15 @@ dependencies = [ "polkavm-derive 0.9.1", "rustversion", "secp256k1", - "sp-core 31.0.0", - "sp-crypto-hashing", - "sp-externalities 0.27.0", - "sp-keystore 0.37.0", - "sp-runtime-interface 26.0.0", - "sp-state-machine 0.38.0", - "sp-std", - "sp-tracing 16.0.0", - "sp-trie 32.0.0", - "tracing", - "tracing-core", -] - -[[package]] -name = "sp-io" -version = "36.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7a31ce27358b73656a09b4933f09a700019d63afa15ede966f7c9893c1d4db5" -dependencies = [ - "bytes", - "ed25519-dalek", - "libsecp256k1", - "log", - "parity-scale-codec", - "polkavm-derive 0.9.1", - "rustversion", - "secp256k1", - "sp-core 33.0.1", + "sp-core", "sp-crypto-hashing", - "sp-externalities 0.28.0", - "sp-keystore 0.39.0", - "sp-runtime-interface 27.0.0", - "sp-state-machine 0.41.0", + "sp-externalities", + "sp-keystore", + "sp-runtime-interface", + "sp-state-machine", "sp-std", - "sp-tracing 17.0.0", - "sp-trie 35.0.0", + "sp-tracing", + "sp-trie", "tracing", "tracing-core", ] @@ -7276,42 +6544,8 @@ checksum = "bdbab8b61bd61d5f8625a0c75753b5d5a23be55d3445419acd42caf59cf6236b" dependencies = [ "parity-scale-codec", "parking_lot", - "sp-core 31.0.0", - "sp-externalities 0.27.0", -] - -[[package]] -name = "sp-keystore" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92a909528663a80829b95d582a20dd4c9acd6e575650dee2bcaf56f4740b305e" -dependencies = [ - "parity-scale-codec", - "parking_lot", - "sp-core 33.0.1", - "sp-externalities 0.28.0", -] - -[[package]] -name = "sp-metadata-ir" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a616fa51350b35326682a472ee8e6ba742fdacb18babac38ecd46b3e05ead869" -dependencies = [ - "frame-metadata 16.0.0", - "parity-scale-codec", - "scale-info", -] - -[[package]] -name = "sp-offchain" -version = "32.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9e7bdda614cb69c087d89d598ac4850e567be09f3de8d510b57147c111d5ce1" -dependencies = [ - "sp-api", - "sp-core 33.0.1", - "sp-runtime 37.0.0", + "sp-core", + "sp-externalities", ] [[package]] @@ -7342,38 +6576,12 @@ dependencies = [ "scale-info", "serde", "simple-mermaid", - "sp-application-crypto 33.0.0", - "sp-arithmetic 25.0.0", - "sp-core 31.0.0", - "sp-io 33.0.0", + "sp-application-crypto", + "sp-arithmetic", + "sp-core", + "sp-io", "sp-std", - "sp-weights 30.0.0", -] - -[[package]] -name = "sp-runtime" -version = "37.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c2a6148bf0ba74999ecfea9b4c1ade544f0663e0baba19630bb7761b2142b19" -dependencies = [ - "docify", - "either", - "hash256-std-hasher", - "impl-trait-for-tuples", - "log", - "num-traits", - "parity-scale-codec", - "paste", - "rand", - "scale-info", - "serde", - "simple-mermaid", - "sp-application-crypto 36.0.0", - "sp-arithmetic 26.0.0", - "sp-core 33.0.1", - "sp-io 36.0.0", - "sp-std", - "sp-weights 31.0.0", + "sp-weights", ] [[package]] @@ -7387,32 +6595,12 @@ dependencies = [ "parity-scale-codec", "polkavm-derive 0.8.0", "primitive-types", - "sp-externalities 0.27.0", - "sp-runtime-interface-proc-macro", - "sp-std", - "sp-storage 20.0.0", - "sp-tracing 16.0.0", - "sp-wasm-interface 20.0.0", - "static_assertions", -] - -[[package]] -name = "sp-runtime-interface" -version = "27.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "647db5e1dc481686628b41554e832df6ab400c4b43a6a54e54d3b0a71ca404aa" -dependencies = [ - "bytes", - "impl-trait-for-tuples", - "parity-scale-codec", - "polkavm-derive 0.9.1", - "primitive-types", - "sp-externalities 0.28.0", + "sp-externalities", "sp-runtime-interface-proc-macro", "sp-std", - "sp-storage 21.0.0", - "sp-tracing 17.0.0", - "sp-wasm-interface 21.0.0", + "sp-storage", + "sp-tracing", + "sp-wasm-interface", "static_assertions", ] @@ -7430,35 +6618,6 @@ dependencies = [ "syn 2.0.66", ] -[[package]] -name = "sp-session" -version = "33.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601e0203c52ac7c1122ad316ae4e5cc355fdf1d69ef5b6c4aa30f7a17921fad9" -dependencies = [ - "parity-scale-codec", - "scale-info", - "sp-api", - "sp-core 33.0.1", - "sp-keystore 0.39.0", - "sp-runtime 37.0.0", - "sp-staking", -] - -[[package]] -name = "sp-staking" -version = "32.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "817c02b55a84c0fac32fdd8b3f0b959888bad0726009ed62433f4046f4b4b752" -dependencies = [ - "impl-trait-for-tuples", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core 33.0.1", - "sp-runtime 37.0.0", -] - [[package]] name = "sp-state-machine" version = "0.38.0" @@ -7471,35 +6630,14 @@ dependencies = [ "parking_lot", "rand", "smallvec", - "sp-core 31.0.0", - "sp-externalities 0.27.0", + "sp-core", + "sp-externalities", "sp-panic-handler", "sp-std", - "sp-trie 32.0.0", + "sp-trie", "thiserror", "tracing", - "trie-db 0.28.0", -] - -[[package]] -name = "sp-state-machine" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f6ac196ea92c4d0613c071e1a050765dbfa30107a990224a4aba02c7dbcd063" -dependencies = [ - "hash-db", - "log", - "parity-scale-codec", - "parking_lot", - "rand", - "smallvec", - "sp-core 33.0.1", - "sp-externalities 0.28.0", - "sp-panic-handler", - "sp-trie 35.0.0", - "thiserror", - "tracing", - "trie-db 0.29.1", + "trie-db", ] [[package]] @@ -7522,32 +6660,6 @@ dependencies = [ "sp-std", ] -[[package]] -name = "sp-storage" -version = "21.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99c82989b3a4979a7e1ad848aad9f5d0b4388f1f454cc131766526601ab9e8f8" -dependencies = [ - "impl-serde", - "parity-scale-codec", - "ref-cast", - "serde", - "sp-debug-derive", -] - -[[package]] -name = "sp-timestamp" -version = "32.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d48d9246310340b11dc4f4c119fe93975c7c0c325637693da8c755d028fce19" -dependencies = [ - "async-trait", - "parity-scale-codec", - "sp-inherents", - "sp-runtime 37.0.0", - "thiserror", -] - [[package]] name = "sp-tracing" version = "16.0.0" @@ -7561,28 +6673,6 @@ dependencies = [ "tracing-subscriber", ] -[[package]] -name = "sp-tracing" -version = "17.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90b3decf116db9f1dfaf1f1597096b043d0e12c952d3bcdc018c6d6b77deec7e" -dependencies = [ - "parity-scale-codec", - "tracing", - "tracing-core", - "tracing-subscriber", -] - -[[package]] -name = "sp-transaction-pool" -version = "32.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14de2a91e5a2bebaf47993644643c92564cafc55d55e1c854f6637ee62c90b4b" -dependencies = [ - "sp-api", - "sp-runtime 37.0.0", -] - [[package]] name = "sp-trie" version = "32.0.0" @@ -7599,69 +6689,15 @@ dependencies = [ "rand", "scale-info", "schnellru", - "sp-core 31.0.0", - "sp-externalities 0.27.0", + "sp-core", + "sp-externalities", "sp-std", "thiserror", "tracing", - "trie-db 0.28.0", + "trie-db", "trie-root", ] -[[package]] -name = "sp-trie" -version = "35.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a61ab0c3e003f457203702e4753aa5fe9e762380543fada44650b1217e4aa5a5" -dependencies = [ - "ahash 0.8.11", - "hash-db", - "lazy_static", - "memory-db", - "nohash-hasher", - "parity-scale-codec", - "parking_lot", - "rand", - "scale-info", - "schnellru", - "sp-core 33.0.1", - "sp-externalities 0.28.0", - "thiserror", - "tracing", - "trie-db 0.29.1", - "trie-root", -] - -[[package]] -name = "sp-version" -version = "35.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff74bf12b4f7d29387eb1caeec5553209a505f90a2511d2831143b970f89659" -dependencies = [ - "impl-serde", - "parity-scale-codec", - "parity-wasm", - "scale-info", - "serde", - "sp-crypto-hashing-proc-macro", - "sp-runtime 37.0.0", - "sp-std", - "sp-version-proc-macro", - "thiserror", -] - -[[package]] -name = "sp-version-proc-macro" -version = "14.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aee8f6730641a65fcf0c8f9b1e448af4b3bb083d08058b47528188bccc7b7a7" -dependencies = [ - "parity-scale-codec", - "proc-macro2", - "quote", - "syn 2.0.66", -] - [[package]] name = "sp-wasm-interface" version = "20.0.0" @@ -7676,17 +6712,6 @@ dependencies = [ "wasmtime", ] -[[package]] -name = "sp-wasm-interface" -version = "21.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b04b919e150b4736d85089d49327eab65507deb1485eec929af69daa2278eb3" -dependencies = [ - "impl-trait-for-tuples", - "log", - "parity-scale-codec", -] - [[package]] name = "sp-weights" version = "30.0.0" @@ -7698,26 +6723,11 @@ dependencies = [ "scale-info", "serde", "smallvec", - "sp-arithmetic 25.0.0", + "sp-arithmetic", "sp-debug-derive", "sp-std", ] -[[package]] -name = "sp-weights" -version = "31.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93cdaf72a1dad537bbb130ba4d47307ebe5170405280ed1aa31fa712718a400e" -dependencies = [ - "bounded-collections", - "parity-scale-codec", - "scale-info", - "serde", - "smallvec", - "sp-arithmetic 26.0.0", - "sp-debug-derive", -] - [[package]] name = "spin" version = "0.9.8" @@ -7827,19 +6837,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "substrate-bip39" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca58ffd742f693dc13d69bdbb2e642ae239e0053f6aab3b104252892f856700a" -dependencies = [ - "hmac 0.12.1", - "pbkdf2", - "schnorrkel", - "sha2 0.10.8", - "zeroize", -] - [[package]] name = "subtle" version = "2.6.1" @@ -7982,9 +6979,9 @@ dependencies = [ "scale-value 0.16.1", "serde", "serde_json", - "sp-core 31.0.0", + "sp-core", "sp-crypto-hashing", - "sp-runtime 34.0.0", + "sp-runtime", "subxt-metadata 0.37.0", "tracing", ] @@ -8330,15 +7327,6 @@ dependencies = [ "time-core", ] -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - [[package]] name = "tinyvec" version = "1.6.0" @@ -8696,18 +7684,6 @@ dependencies = [ "smallvec", ] -[[package]] -name = "trie-db" -version = "0.29.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c992b4f40c234a074d48a757efeabb1a6be88af84c0c23f7ca158950cb0ae7f" -dependencies = [ - "hash-db", - "log", - "rustc-hex", - "smallvec", -] - [[package]] name = "trie-root" version = "0.18.0" @@ -8723,12 +7699,6 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" -[[package]] -name = "tt-call" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f195fd851901624eee5a58c4bb2b4f06399148fcd0ed336e6f1cb60a9881df" - [[package]] name = "tungstenite" version = "0.20.1" @@ -9304,16 +8274,6 @@ dependencies = [ "winsafe", ] -[[package]] -name = "wide" -version = "0.7.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901e8597c777fa042e9e245bd56c0dc4418c5db3f845b6ff94fbac732c6a0692" -dependencies = [ - "bytemuck", - "safe_arch", -] - [[package]] name = "winapi" version = "0.3.9" @@ -9735,7 +8695,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.8", - "sp-core 31.0.0", + "sp-core", "subxt 0.37.0", "subxt-signer 0.37.0", "thiserror", diff --git a/crates/pop-cli/src/commands/new/parachain.rs b/crates/pop-cli/src/commands/new/parachain.rs index ef3ae0f1..6c6c4626 100644 --- a/crates/pop-cli/src/commands/new/parachain.rs +++ b/crates/pop-cli/src/commands/new/parachain.rs @@ -313,7 +313,6 @@ async fn choose_release(template: &Parachain) -> Result> { async fn get_latest_3_releases(repo: &GitHub) -> Result> { let mut latest_3_releases: Vec = repo.releases().await?.into_iter().filter(|r| !r.prerelease).take(3).collect(); - repo.get_repo_license().await?; // Get the commit sha for the releases for release in latest_3_releases.iter_mut() { let commit = repo.get_commit_sha_from_release(&release.tag_name).await?; From 9965d1663da641eb3a978a38958f0035da761491 Mon Sep 17 00:00:00 2001 From: AlexD10S Date: Fri, 16 Aug 2024 13:36:29 +0200 Subject: [PATCH 03/17] feat: include OpenZeppelinEVM template --- crates/pop-cli/src/commands/new/parachain.rs | 2 +- crates/pop-parachains/src/templates.rs | 29 ++++++++++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/crates/pop-cli/src/commands/new/parachain.rs b/crates/pop-cli/src/commands/new/parachain.rs index 6c6c4626..69b3d4cc 100644 --- a/crates/pop-cli/src/commands/new/parachain.rs +++ b/crates/pop-cli/src/commands/new/parachain.rs @@ -191,7 +191,7 @@ fn generate_parachain_from_template( // add next steps let mut next_steps = vec![ format!("cd into \"{name_template}\" and enjoy hacking! 🚀"), - "Use `pop build` to build your parachain.".into(), + "Use `pop build --release` to build your parachain.".into(), ]; if let Some(network_config) = template.network_config() { next_steps.push(format!( diff --git a/crates/pop-parachains/src/templates.rs b/crates/pop-parachains/src/templates.rs index 242ef7a2..5918697e 100644 --- a/crates/pop-parachains/src/templates.rs +++ b/crates/pop-parachains/src/templates.rs @@ -118,18 +118,31 @@ pub enum Parachain { EVM, // OpenZeppelin #[strum( - serialize = "polkadot-generic-runtime-template", + serialize = "generic-template", message = "Generic Runtime Template", - detailed_message = "A generic template for Substrate Runtime", + detailed_message = "A generic template for Substrate Runtime.", props( Provider = "OpenZeppelin", Repository = "https://github.com/OpenZeppelin/polkadot-runtime-templates", Network = "./zombienet-config/devnet.toml", - SupportedVersions = "v1.0.0", IsAudited = "true" ) )] OpenZeppelinGeneric, + // OpenZeppelin EVM + #[strum( + serialize = "evm-template", + message = "EVM Template", + detailed_message = "Parachain with EVM compatibility out of the box.", + props( + Provider = "OpenZeppelin", + Repository = "https://github.com/OpenZeppelin/polkadot-runtime-templates", + Network = "./zombienet-config/devnet.toml", + SupportedVersions = "v2.0.0", + IsAudited = "true" + ) + )] + OpenZeppelinEVM, /// Minimal Substrate node configured for smart contracts via pallet-contracts. #[strum( serialize = "cpt", @@ -218,7 +231,8 @@ mod tests { ("contracts".to_string(), Contracts), ("evm".to_string(), EVM), // openzeppelin - ("polkadot-generic-runtime-template".to_string(), OpenZeppelinGeneric), + ("generic-template".to_string(), OpenZeppelinGeneric), + ("evm-template".to_string(), OpenZeppelinEVM), ("cpt".to_string(), ParityContracts), ("fpt".to_string(), ParityFPT), ("test_01".to_string(), TestTemplate01), @@ -234,7 +248,11 @@ mod tests { ("evm".to_string(), "https://github.com/r0gue-io/evm-parachain"), // openzeppelin ( - "polkadot-generic-runtime-template".to_string(), + "generic-template".to_string(), + "https://github.com/OpenZeppelin/polkadot-runtime-templates", + ), + ( + "evm-template".to_string(), "https://github.com/OpenZeppelin/polkadot-runtime-templates", ), ("cpt".to_string(), "https://github.com/paritytech/substrate-contracts-node"), @@ -251,6 +269,7 @@ mod tests { (Contracts, Some("./network.toml")), (EVM, Some("./network.toml")), (OpenZeppelinGeneric, Some("./zombienet-config/devnet.toml")), + (OpenZeppelinEVM, Some("./zombienet-config/devnet.toml")), (ParityContracts, Some("./zombienet.toml")), (ParityFPT, Some("./zombienet-config.toml")), (TestTemplate01, Some("")), From df3cfd057de45adc50e5fd997f74afeec6a11794 Mon Sep 17 00:00:00 2001 From: AlexD10S Date: Fri, 16 Aug 2024 13:50:47 +0200 Subject: [PATCH 04/17] feat: instantiate_openzeppelin_template --- crates/pop-parachains/src/new_parachain.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/crates/pop-parachains/src/new_parachain.rs b/crates/pop-parachains/src/new_parachain.rs index adfe82e9..3d3b15c9 100644 --- a/crates/pop-parachains/src/new_parachain.rs +++ b/crates/pop-parachains/src/new_parachain.rs @@ -8,7 +8,7 @@ use crate::{ use anyhow::Result; use pop_common::{ git::Git, - templates::{Template, Type}, + templates::{extractor::extract_template_files, Template, Type}, }; use std::{fs, path::Path}; use walkdir::WalkDir; @@ -32,6 +32,9 @@ pub fn instantiate_template_dir( if Provider::Pop.provides(&template) { return instantiate_standard_template(template, target, config, tag_version); } + if Provider::OpenZeppelin.provides(&template) { + return instantiate_openzeppelin_template(template, target, tag_version); + } let tag = Git::clone_and_degit(template.repository_url()?, target, tag_version)?; Ok(tag) } @@ -75,6 +78,20 @@ pub fn instantiate_standard_template( Ok(tag) } +pub fn instantiate_openzeppelin_template( + template: &Parachain, + target: &Path, + tag_version: Option, +) -> Result> { + let temp_dir = ::tempfile::TempDir::new_in(std::env::temp_dir())?; + let source = temp_dir.path(); + + let tag = Git::clone_and_degit(template.repository_url()?, source, tag_version)?; + + extract_template_files(template.to_string(), temp_dir.path(), target, None)?; + Ok(tag) +} + #[cfg(test)] mod tests { use super::*; From 2e0f00859735006fe2f748159a4361f4cd661b9c Mon Sep 17 00:00:00 2001 From: AlexD10S Date: Thu, 12 Sep 2024 09:12:05 +0200 Subject: [PATCH 05/17] fix: bump zombienet and insert evm_based --- Cargo.lock | 19 +++++++------------ Cargo.toml | 4 ++-- crates/pop-cli/src/commands/new/parachain.rs | 4 ++-- crates/pop-common/src/lib.rs | 10 ++++------ crates/pop-common/src/templates/extractor.rs | 4 ++-- crates/pop-parachains/src/up/mod.rs | 5 +++++ 6 files changed, 22 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 83cc7f1d..18dc1131 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8549,8 +8549,7 @@ dependencies = [ [[package]] name = "zombienet-configuration" version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eff597aad815b5978a110c5ae96007395ba3227088cf85d0e1d1f6280fd0e73" +source = "git+https://github.com/paritytech/zombienet-sdk?branch=fix-stash-gen-key#64d68884c83168d5c82d115333387184f255f4d7" dependencies = [ "anyhow", "lazy_static", @@ -8567,8 +8566,7 @@ dependencies = [ [[package]] name = "zombienet-orchestrator" version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e67d87e2c2ab3644e38a3140d94ba55d27a2d1726095f97f30f0f1b0b1a77e20" +source = "git+https://github.com/paritytech/zombienet-sdk?branch=fix-stash-gen-key#64d68884c83168d5c82d115333387184f255f4d7" dependencies = [ "anyhow", "async-trait", @@ -8576,6 +8574,7 @@ dependencies = [ "glob-match", "hex", "libp2p", + "libsecp256k1", "multiaddr", "rand", "regex", @@ -8599,8 +8598,7 @@ dependencies = [ [[package]] name = "zombienet-prom-metrics-parser" version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a6f4923a71aa7290ece0a1abe8b5e4b9242ef669bea717a76ba15bcedf705f4" +source = "git+https://github.com/paritytech/zombienet-sdk?branch=fix-stash-gen-key#64d68884c83168d5c82d115333387184f255f4d7" dependencies = [ "pest", "pest_derive", @@ -8610,8 +8608,7 @@ dependencies = [ [[package]] name = "zombienet-provider" version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da181e16812afc675f1563f6c1853ce0a3afe81f0fcc762acc766c08ca8c16a0" +source = "git+https://github.com/paritytech/zombienet-sdk?branch=fix-stash-gen-key#64d68884c83168d5c82d115333387184f255f4d7" dependencies = [ "anyhow", "async-trait", @@ -8641,8 +8638,7 @@ dependencies = [ [[package]] name = "zombienet-sdk" version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f64c5d7db3d6c80cde872abf2bd4161c01da4dacf988f4a28c5847653693eaf" +source = "git+https://github.com/paritytech/zombienet-sdk?branch=fix-stash-gen-key#64d68884c83168d5c82d115333387184f255f4d7" dependencies = [ "async-trait", "futures", @@ -8658,8 +8654,7 @@ dependencies = [ [[package]] name = "zombienet-support" version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cd2a2ab982cd205ffd18ad733d5a64a7e170e9adca9028a82025a626460fd9a" +source = "git+https://github.com/paritytech/zombienet-sdk?branch=fix-stash-gen-key#64d68884c83168d5c82d115333387184f255f4d7" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index 8ca9fa23..624d26cf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,8 +60,8 @@ toml_edit = { version = "0.22", features = ["serde"] } symlink = "0.1" serde_json = { version = "1.0", features = ["preserve_order"] } serde = { version = "1.0", features = ["derive"] } -zombienet-sdk = "0.2.7" -zombienet-support = "0.2.7" +zombienet-sdk = { git = "https://github.com/paritytech/zombienet-sdk", branch = "fix-stash-gen-key"} +zombienet-support = { git = "https://github.com/paritytech/zombienet-sdk", branch = "fix-stash-gen-key"} git2_credentials = "0.13.0" # pop-cli diff --git a/crates/pop-cli/src/commands/new/parachain.rs b/crates/pop-cli/src/commands/new/parachain.rs index 6ee729ba..13801dbf 100644 --- a/crates/pop-cli/src/commands/new/parachain.rs +++ b/crates/pop-cli/src/commands/new/parachain.rs @@ -264,8 +264,8 @@ fn get_customization_value( decimals: Option, initial_endowment: Option, ) -> Result { - if !matches!(template, Parachain::Standard) - && (symbol.is_some() || decimals.is_some() || initial_endowment.is_some()) + if !matches!(template, Parachain::Standard) && + (symbol.is_some() || decimals.is_some() || initial_endowment.is_some()) { log::warning("Customization options are not available for this template")?; sleep(Duration::from_secs(3)) diff --git a/crates/pop-common/src/lib.rs b/crates/pop-common/src/lib.rs index d10e792e..7206bc7e 100644 --- a/crates/pop-common/src/lib.rs +++ b/crates/pop-common/src/lib.rs @@ -35,18 +35,16 @@ pub fn target() -> Result<&'static str, Error> { } match ARCH { - "aarch64" => { + "aarch64" => return match OS { "macos" => Ok("aarch64-apple-darwin"), _ => Ok("aarch64-unknown-linux-gnu"), - } - }, - "x86_64" | "x86" => { + }, + "x86_64" | "x86" => return match OS { "macos" => Ok("x86_64-apple-darwin"), _ => Ok("x86_64-unknown-linux-gnu"), - } - }, + }, &_ => {}, } Err(Error::UnsupportedPlatform { arch: ARCH, os: OS }) diff --git a/crates/pop-common/src/templates/extractor.rs b/crates/pop-common/src/templates/extractor.rs index b0d1f47f..5f801999 100644 --- a/crates/pop-common/src/templates/extractor.rs +++ b/crates/pop-common/src/templates/extractor.rs @@ -42,8 +42,8 @@ fn copy_dir_all( for entry in fs::read_dir(src)? { let entry = entry?; let ty = entry.file_type()?; - if ty.is_dir() - && ignore_directories.contains(&entry.file_name().to_string_lossy().to_string()) + if ty.is_dir() && + ignore_directories.contains(&entry.file_name().to_string_lossy().to_string()) { continue; } else if ty.is_dir() { diff --git a/crates/pop-parachains/src/up/mod.rs b/crates/pop-parachains/src/up/mod.rs index 192da7ff..30b0bac5 100644 --- a/crates/pop-parachains/src/up/mod.rs +++ b/crates/pop-parachains/src/up/mod.rs @@ -443,6 +443,11 @@ impl NetworkConfiguration { let command = format!("{} {}", Self::resolve_path(&path)?, "{{chainName}}"); *table.entry("chain_spec_command").or_insert(value(&command)) = value(&command); } + // Check if EVM based parachain and insert evm_based for zombienet-sdk + let force_decorator = table.get("force_decorator").and_then(|i| i.as_str()); + if force_decorator.is_some() && force_decorator.unwrap() == "generic-evm" { + table.insert("evm_based", value(true)); + } // Resolve individual collator command to binary if let Some(collators) = From 4f14fa904ccf9ba930ee5a4204ae0148ad5d2274 Mon Sep 17 00:00:00 2001 From: AlexD10S Date: Thu, 12 Sep 2024 13:51:38 +0200 Subject: [PATCH 06/17] chore: bump zombienet-sdk version --- Cargo.lock | 31 +++++++++++++++++------------ Cargo.toml | 3 +-- crates/pop-parachains/Cargo.toml | 1 - crates/pop-parachains/src/up/mod.rs | 3 +-- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 18dc1131..c61b38f8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4776,7 +4776,6 @@ dependencies = [ "url", "walkdir", "zombienet-sdk", - "zombienet-support", ] [[package]] @@ -8548,8 +8547,9 @@ dependencies = [ [[package]] name = "zombienet-configuration" -version = "0.2.9" -source = "git+https://github.com/paritytech/zombienet-sdk?branch=fix-stash-gen-key#64d68884c83168d5c82d115333387184f255f4d7" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23322e411b8d19b41b5c20ab8e88c10822189a4fcfd069c7fcd1542b8d3035aa" dependencies = [ "anyhow", "lazy_static", @@ -8565,8 +8565,9 @@ dependencies = [ [[package]] name = "zombienet-orchestrator" -version = "0.2.9" -source = "git+https://github.com/paritytech/zombienet-sdk?branch=fix-stash-gen-key#64d68884c83168d5c82d115333387184f255f4d7" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "381f701565b3918a909132743b3674569ce3da25b5c3a6493883abaf1046577a" dependencies = [ "anyhow", "async-trait", @@ -8597,8 +8598,9 @@ dependencies = [ [[package]] name = "zombienet-prom-metrics-parser" -version = "0.2.9" -source = "git+https://github.com/paritytech/zombienet-sdk?branch=fix-stash-gen-key#64d68884c83168d5c82d115333387184f255f4d7" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dab79fa58bcfecbcd41485c6f13052853ccde8b09f173b601f78747d7abc2b7f" dependencies = [ "pest", "pest_derive", @@ -8607,8 +8609,9 @@ dependencies = [ [[package]] name = "zombienet-provider" -version = "0.2.9" -source = "git+https://github.com/paritytech/zombienet-sdk?branch=fix-stash-gen-key#64d68884c83168d5c82d115333387184f255f4d7" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6af0264938da61b25da89f17ee0630393a4ba793582a4a8a1650eb15b47fc1ef" dependencies = [ "anyhow", "async-trait", @@ -8637,8 +8640,9 @@ dependencies = [ [[package]] name = "zombienet-sdk" -version = "0.2.9" -source = "git+https://github.com/paritytech/zombienet-sdk?branch=fix-stash-gen-key#64d68884c83168d5c82d115333387184f255f4d7" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bc5b7ebfba4ab62486c8cb5bcd7345c4376487487cfe3481476cb4d4accc75e" dependencies = [ "async-trait", "futures", @@ -8653,8 +8657,9 @@ dependencies = [ [[package]] name = "zombienet-support" -version = "0.2.9" -source = "git+https://github.com/paritytech/zombienet-sdk?branch=fix-stash-gen-key#64d68884c83168d5c82d115333387184f255f4d7" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f5b80d34a0eecca69dd84c2e13f84f1fae0cc378baf4f15f769027af068418b" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index 624d26cf..3a2e1904 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,8 +60,7 @@ toml_edit = { version = "0.22", features = ["serde"] } symlink = "0.1" serde_json = { version = "1.0", features = ["preserve_order"] } serde = { version = "1.0", features = ["derive"] } -zombienet-sdk = { git = "https://github.com/paritytech/zombienet-sdk", branch = "fix-stash-gen-key"} -zombienet-support = { git = "https://github.com/paritytech/zombienet-sdk", branch = "fix-stash-gen-key"} +zombienet-sdk = "0.2.10" git2_credentials = "0.13.0" # pop-cli diff --git a/crates/pop-parachains/Cargo.toml b/crates/pop-parachains/Cargo.toml index 1ac8166b..4b135c8f 100644 --- a/crates/pop-parachains/Cargo.toml +++ b/crates/pop-parachains/Cargo.toml @@ -31,7 +31,6 @@ toml_edit.workspace = true walkdir.workspace = true # Zombienet zombienet-sdk.workspace = true -zombienet-support.workspace = true # Pop pop-common = { path = "../pop-common", version = "0.3.0" } diff --git a/crates/pop-parachains/src/up/mod.rs b/crates/pop-parachains/src/up/mod.rs index 30b0bac5..1b4bc9ef 100644 --- a/crates/pop-parachains/src/up/mod.rs +++ b/crates/pop-parachains/src/up/mod.rs @@ -16,8 +16,7 @@ use std::{ use symlink::{remove_symlink_file, symlink_file}; use tempfile::{Builder, NamedTempFile}; use toml_edit::{value, ArrayOfTables, DocumentMut, Formatted, Item, Table, Value}; -use zombienet_sdk::{Network, NetworkConfig, NetworkConfigExt}; -use zombienet_support::fs::local::LocalFileSystem; +use zombienet_sdk::{LocalFileSystem, Network, NetworkConfig, NetworkConfigExt}; mod chain_specs; mod parachains; From 1635439126fb410cf7a6019e50d4e479e199f752 Mon Sep 17 00:00:00 2001 From: AlexD10S Date: Fri, 13 Sep 2024 12:25:46 +0200 Subject: [PATCH 07/17] chore: bump supported version for template and add a test --- crates/pop-parachains/src/new_parachain.rs | 27 ++++++++++++++++++++++ crates/pop-parachains/src/templates.rs | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/crates/pop-parachains/src/new_parachain.rs b/crates/pop-parachains/src/new_parachain.rs index 3d3b15c9..47a5ff32 100644 --- a/crates/pop-parachains/src/new_parachain.rs +++ b/crates/pop-parachains/src/new_parachain.rs @@ -137,4 +137,31 @@ mod tests { Ok(()) } + + #[test] + fn test_parachain_instantiate_openzeppelin_template() -> Result<()> { + let temp_dir = tempfile::tempdir().expect("Failed to create temp dir"); + instantiate_openzeppelin_template(&Parachain::OpenZeppelinEVM, temp_dir.path(), None)?; + + // Verify that the generated chain_spec.rs file contains the expected content + let generated_file_content = + fs::read_to_string(temp_dir.path().join("node/src/chain_spec.rs")) + .expect("Failed to read file"); + assert!(generated_file_content + .contains("properties.insert(\"tokenSymbol\".into(), \"UNIT\".into());")); + assert!(generated_file_content + .contains("properties.insert(\"tokenDecimals\".into(), 12.into());")); + + let node_manifest = + pop_common::manifest::from_path(Some(&temp_dir.path().join("node/Cargo.toml"))) + .expect("Failed to read file"); + assert_eq!("evm-template-node", node_manifest.package().name()); + + let runtime_manifest = + pop_common::manifest::from_path(Some(&temp_dir.path().join("runtime/Cargo.toml"))) + .expect("Failed to read file"); + assert_eq!("evm-runtime-template", runtime_manifest.package().name()); + + Ok(()) + } } diff --git a/crates/pop-parachains/src/templates.rs b/crates/pop-parachains/src/templates.rs index 62c32c92..b5843fbf 100644 --- a/crates/pop-parachains/src/templates.rs +++ b/crates/pop-parachains/src/templates.rs @@ -145,7 +145,7 @@ pub enum Parachain { Provider = "OpenZeppelin", Repository = "https://github.com/OpenZeppelin/polkadot-runtime-templates", Network = "./zombienet-config/devnet.toml", - SupportedVersions = "v2.0.0", + SupportedVersions = "v2.0.1", IsAudited = "true", License = "GPL-3.0" ) From 52da6669558ec03165b86b754eaf4610100b86e8 Mon Sep 17 00:00:00 2001 From: AlexD10S Date: Fri, 13 Sep 2024 17:52:04 +0200 Subject: [PATCH 08/17] fix: include support for v2.0.1 in generic template --- crates/pop-parachains/src/new_parachain.rs | 9 --------- crates/pop-parachains/src/templates.rs | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/crates/pop-parachains/src/new_parachain.rs b/crates/pop-parachains/src/new_parachain.rs index 47a5ff32..c9c9bf4b 100644 --- a/crates/pop-parachains/src/new_parachain.rs +++ b/crates/pop-parachains/src/new_parachain.rs @@ -143,15 +143,6 @@ mod tests { let temp_dir = tempfile::tempdir().expect("Failed to create temp dir"); instantiate_openzeppelin_template(&Parachain::OpenZeppelinEVM, temp_dir.path(), None)?; - // Verify that the generated chain_spec.rs file contains the expected content - let generated_file_content = - fs::read_to_string(temp_dir.path().join("node/src/chain_spec.rs")) - .expect("Failed to read file"); - assert!(generated_file_content - .contains("properties.insert(\"tokenSymbol\".into(), \"UNIT\".into());")); - assert!(generated_file_content - .contains("properties.insert(\"tokenDecimals\".into(), 12.into());")); - let node_manifest = pop_common::manifest::from_path(Some(&temp_dir.path().join("node/Cargo.toml"))) .expect("Failed to read file"); diff --git a/crates/pop-parachains/src/templates.rs b/crates/pop-parachains/src/templates.rs index b5843fbf..d7551c56 100644 --- a/crates/pop-parachains/src/templates.rs +++ b/crates/pop-parachains/src/templates.rs @@ -130,7 +130,7 @@ pub enum Parachain { Provider = "OpenZeppelin", Repository = "https://github.com/OpenZeppelin/polkadot-runtime-templates", Network = "./zombienet-config/devnet.toml", - SupportedVersions = "v1.0.0", + SupportedVersions = "v1.0.0,v2.0.1", IsAudited = "true", License = "GPL-3.0" ) From 25bd65587eefbdd14a4ac4f205329cc4af38dc4b Mon Sep 17 00:00:00 2001 From: AlexD10S Date: Wed, 18 Sep 2024 19:44:34 +0200 Subject: [PATCH 09/17] chore: deprecate command for change of name --- crates/pop-parachains/src/templates.rs | 37 +++++++++++++++++++++----- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/crates/pop-parachains/src/templates.rs b/crates/pop-parachains/src/templates.rs index d7551c56..29901631 100644 --- a/crates/pop-parachains/src/templates.rs +++ b/crates/pop-parachains/src/templates.rs @@ -123,7 +123,7 @@ pub enum Parachain { EVM, // OpenZeppelin #[strum( - serialize = "generic-template", + serialize = "openzeppelin/generic-template", message = "Generic Runtime Template", detailed_message = "A generic template for Substrate Runtime.", props( @@ -138,7 +138,7 @@ pub enum Parachain { OpenZeppelinGeneric, // OpenZeppelin EVM #[strum( - serialize = "evm-template", + serialize = "openzeppelin/evm-template", message = "EVM Template", detailed_message = "Parachain with EVM compatibility out of the box.", props( @@ -177,7 +177,23 @@ pub enum Parachain { ) )] ParityFPT, - + // OpenZeppelin + #[strum( + serialize = "polkadot-generic-runtime-template", + message = "Generic Runtime Template", + detailed_message = "A generic template for Substrate Runtime.", + props( + Provider = "OpenZeppelin", + Repository = "https://github.com/OpenZeppelin/polkadot-runtime-templates", + Network = "./zombienet-config/devnet.toml", + SupportedVersions = "v1.0.0,v2.0.1", + IsAudited = "true", + License = "GPL-3.0", + IsDeprecated = "true", + DeprecatedMessage = "This template is deprecated. Please use openzeppelin/generic-template in the future.", + ) + )] + DeprecatedOpenZeppelinGeneric, // templates for unit tests below #[cfg(test)] #[strum( @@ -247,8 +263,9 @@ mod tests { ("contracts".to_string(), Contracts), ("evm".to_string(), EVM), // openzeppelin - ("generic-template".to_string(), OpenZeppelinGeneric), - ("evm-template".to_string(), OpenZeppelinEVM), + ("openzeppelin/generic-template".to_string(), OpenZeppelinGeneric), + ("openzeppelin/evm-template".to_string(), OpenZeppelinEVM), + ("polkadot-generic-runtime-template".to_string(), DeprecatedOpenZeppelinGeneric), ("cpt".to_string(), ParityContracts), ("fpt".to_string(), ParityFPT), ("test_01".to_string(), TestTemplate01), @@ -264,11 +281,15 @@ mod tests { ("evm".to_string(), "https://github.com/r0gue-io/evm-parachain"), // openzeppelin ( - "generic-template".to_string(), + "openzeppelin/generic-template".to_string(), + "https://github.com/OpenZeppelin/polkadot-runtime-templates", + ), + ( + "openzeppelin/evm-template".to_string(), "https://github.com/OpenZeppelin/polkadot-runtime-templates", ), ( - "evm-template".to_string(), + "polkadot-generic-runtime-template".to_string(), "https://github.com/OpenZeppelin/polkadot-runtime-templates", ), ("cpt".to_string(), "https://github.com/paritytech/substrate-contracts-node"), @@ -286,6 +307,7 @@ mod tests { (EVM, Some("./network.toml")), (OpenZeppelinGeneric, Some("./zombienet-config/devnet.toml")), (OpenZeppelinEVM, Some("./zombienet-config/devnet.toml")), + (DeprecatedOpenZeppelinGeneric, Some("./zombienet-config/devnet.toml")), (ParityContracts, Some("./zombienet.toml")), (ParityFPT, Some("./zombienet-config.toml")), (TestTemplate01, Some("")), @@ -302,6 +324,7 @@ mod tests { (EVM, Some("Unlicense")), (OpenZeppelinGeneric, Some("GPL-3.0")), (OpenZeppelinEVM, Some("GPL-3.0")), + (DeprecatedOpenZeppelinGeneric, Some("GPL-3.0")), (ParityContracts, Some("Unlicense")), (ParityFPT, Some("Unlicense")), (TestTemplate01, Some("Unlicense")), From ec35767891628f72cb5505eef5db5496c6ed6a1c Mon Sep 17 00:00:00 2001 From: AlexD10S Date: Thu, 19 Sep 2024 08:49:15 +0200 Subject: [PATCH 10/17] chore: deprecation logic --- crates/pop-cli/src/commands/new/parachain.rs | 10 +++++--- crates/pop-common/src/templates/mod.rs | 24 ++++++++++++++++++- crates/pop-parachains/src/templates.rs | 25 +++++++++++++++++++- 3 files changed, 54 insertions(+), 5 deletions(-) diff --git a/crates/pop-cli/src/commands/new/parachain.rs b/crates/pop-cli/src/commands/new/parachain.rs index 13801dbf..df273c2e 100644 --- a/crates/pop-cli/src/commands/new/parachain.rs +++ b/crates/pop-cli/src/commands/new/parachain.rs @@ -15,7 +15,7 @@ use cliclack::{ outro, outro_cancel, }; use pop_common::{ - enum_variants, + enum_variants, enum_variants_for_help, templates::{Template, Type}, Git, GitHub, Release, }; @@ -40,8 +40,9 @@ pub struct NewParachainCommand { #[arg( short = 't', long, - help = "Template to use.", - value_parser = enum_variants!(Parachain) + help = format!("Template to use. [possible values: {}]", enum_variants_for_help!(Parachain)), + value_parser = enum_variants!(Parachain), + hide_possible_values = true // Hide the deprecated templates )] pub(crate) template: Option, #[arg( @@ -244,6 +245,9 @@ fn is_template_supported(provider: &Provider, template: &Parachain) -> Result<() provider, template ))); }; + if template.is_deprecated() { + warning(format!("NOTE: this template is deprecated.{}", template.deprecated_message()))?; + } return Ok(()); } diff --git a/crates/pop-common/src/templates/mod.rs b/crates/pop-common/src/templates/mod.rs index e4f7604a..0ccbf45d 100644 --- a/crates/pop-common/src/templates/mod.rs +++ b/crates/pop-common/src/templates/mod.rs @@ -45,6 +45,16 @@ pub trait Template: fn template_type(&self) -> Result<&str, Error> { self.get_str(Self::PROPERTY).ok_or(Error::TypeMissing) } + + /// Get whether the template is deprecated. + fn is_deprecated(&self) -> bool { + self.get_str("IsDeprecated").map_or(false, |s| s == "true") + } + + /// Get the deprecation message for the template + fn deprecated_message(&self) -> &str { + self.get_str("DeprecatedMessage").unwrap_or_default() + } } /// A trait for defining overarching types of specific template variants. @@ -76,7 +86,7 @@ pub trait Type: Clone + Default + EnumMessage + Eq + PartialEq + Va fn templates(&self) -> Vec<&T> { T::VARIANTS .iter() - .filter(|t| t.get_str(T::PROPERTY) == Some(self.name())) + .filter(|t| t.get_str(T::PROPERTY) == Some(self.name()) && !t.is_deprecated()) .collect() } @@ -99,3 +109,15 @@ macro_rules! enum_variants { .try_map(|s| <$e>::from_str(&s).map_err(|e| format!("could not convert from {s} to type"))) }}; } + +#[macro_export] +macro_rules! enum_variants_for_help { + ($e:ty) => {{ + <$e>::VARIANTS + .iter() + .filter(|variant| !variant.is_deprecated()) // Exclude deprecated variants for --help + .map(|v| v.as_ref()) + .collect::>() + .join(", ") + }}; +} diff --git a/crates/pop-parachains/src/templates.rs b/crates/pop-parachains/src/templates.rs index 29901631..08b27f12 100644 --- a/crates/pop-parachains/src/templates.rs +++ b/crates/pop-parachains/src/templates.rs @@ -206,7 +206,9 @@ pub enum Parachain { Network = "", SupportedVersions = "v1.0.0,v2.0.0", IsAudited = "true", - License = "Unlicense" + IsDeprecated = "true", + DeprecatedMessage = "This template is deprecated. Please use test_02 in the future.", + License = "Unlicense", ) )] TestTemplate01, @@ -444,4 +446,25 @@ mod tests { let template = TestTemplate02; assert_eq!(template.is_audited(), false); } + + #[test] + fn test_is_deprecated() { + let template = TestTemplate01; + assert_eq!(template.is_deprecated(), true); + + let template = TestTemplate02; + assert_eq!(template.is_deprecated(), false); + } + + #[test] + fn test_deprecated_message() { + let template = TestTemplate01; + assert_eq!( + template.deprecated_message(), + "This template is deprecated. Please use test_02 in the future." + ); + + let template = TestTemplate02; + assert_eq!(template.deprecated_message(), ""); + } } From a27241a8754e653e824eed5708c2ef57ebe53af2 Mon Sep 17 00:00:00 2001 From: AlexD10S Date: Thu, 19 Sep 2024 09:17:35 +0200 Subject: [PATCH 11/17] chore: template_name_without_provider --- crates/pop-common/src/templates/extractor.rs | 6 ++-- crates/pop-contracts/src/new.rs | 9 ++--- crates/pop-parachains/src/new_parachain.rs | 7 +++- crates/pop-parachains/src/templates.rs | 38 ++++++++++++++++++-- 4 files changed, 47 insertions(+), 13 deletions(-) diff --git a/crates/pop-common/src/templates/extractor.rs b/crates/pop-common/src/templates/extractor.rs index 5f801999..2558a34b 100644 --- a/crates/pop-common/src/templates/extractor.rs +++ b/crates/pop-common/src/templates/extractor.rs @@ -12,7 +12,7 @@ use std::{fs, io, path::Path}; /// * `ignore_directories` - A vector of directory names to ignore during the extraction. If empty, /// no directories are ignored. pub fn extract_template_files( - template_name: String, + template_name: &str, repo_directory: &Path, target_directory: &Path, ignore_directories: Option>, @@ -76,7 +76,7 @@ mod tests { // Contract let mut temp_dir = generate_testing_contract("erc20")?; let mut output_dir = tempfile::tempdir()?; - extract_template_files("erc20".to_string(), temp_dir.path(), output_dir.path(), None)?; + extract_template_files("erc20", temp_dir.path(), output_dir.path(), None)?; assert!(output_dir.path().join("lib.rs").exists()); assert!(output_dir.path().join("Cargo.toml").exists()); assert!(output_dir.path().join("frontend").exists()); @@ -85,7 +85,7 @@ mod tests { temp_dir = generate_testing_contract("erc721")?; output_dir = tempfile::tempdir()?; extract_template_files( - "erc721".to_string(), + "erc721", temp_dir.path(), output_dir.path(), Some(vec!["frontend".to_string()]), diff --git a/crates/pop-contracts/src/new.rs b/crates/pop-contracts/src/new.rs index 0bf4c054..08212706 100644 --- a/crates/pop-contracts/src/new.rs +++ b/crates/pop-contracts/src/new.rs @@ -65,15 +65,10 @@ fn create_template_contract( // Retrieve only the template contract files. if template == &Contract::PSP22 || template == &Contract::PSP34 { // Different template structure requires extracting different path - extract_template_files( - String::from(""), - temp_dir.path(), - canonicalized_path.as_path(), - None, - )?; + extract_template_files("", temp_dir.path(), canonicalized_path.as_path(), None)?; } else { extract_template_files( - template.to_string(), + &template.to_string(), temp_dir.path(), canonicalized_path.as_path(), Some(vec!["frontend".to_string()]), diff --git a/crates/pop-parachains/src/new_parachain.rs b/crates/pop-parachains/src/new_parachain.rs index c9c9bf4b..e2dee8dc 100644 --- a/crates/pop-parachains/src/new_parachain.rs +++ b/crates/pop-parachains/src/new_parachain.rs @@ -88,7 +88,12 @@ pub fn instantiate_openzeppelin_template( let tag = Git::clone_and_degit(template.repository_url()?, source, tag_version)?; - extract_template_files(template.to_string(), temp_dir.path(), target, None)?; + extract_template_files( + template.template_name_without_provider(), + temp_dir.path(), + target, + None, + )?; Ok(tag) } diff --git a/crates/pop-parachains/src/templates.rs b/crates/pop-parachains/src/templates.rs index 08b27f12..ea1e6c3c 100644 --- a/crates/pop-parachains/src/templates.rs +++ b/crates/pop-parachains/src/templates.rs @@ -249,6 +249,12 @@ impl Parachain { pub fn license(&self) -> Option<&str> { self.get_str("License") } + + /// Gets the template name, removing the provider if present. + pub fn template_name_without_provider(&self) -> &str { + let name = self.as_ref(); + name.split_once('/').map_or(name, |(_, template)| template) + } } #[cfg(test)] @@ -275,6 +281,22 @@ mod tests { ]) } + fn templates_names_without_providers() -> HashMap { + HashMap::from([ + (Standard, "standard".to_string()), + (Assets, "assets".to_string()), + (Contracts, "contracts".to_string()), + (EVM, "evm".to_string()), + (OpenZeppelinGeneric, "generic-template".to_string()), + (OpenZeppelinEVM, "evm-template".to_string()), + (DeprecatedOpenZeppelinGeneric, "polkadot-generic-runtime-template".to_string()), + (ParityContracts, "cpt".to_string()), + (ParityFPT, "fpt".to_string()), + (TestTemplate01, "test_01".to_string()), + (TestTemplate02, "test_02".to_string()), + ]) + } + fn templates_urls() -> HashMap { HashMap::from([ ("standard".to_string(), "https://github.com/r0gue-io/base-parachain"), @@ -378,6 +400,7 @@ mod tests { fn test_network_config() { let network_configs = template_network_configs(); for template in Parachain::VARIANTS { + println!("{:?}", template.name()); assert_eq!(template.network_config(), network_configs[template]); } } @@ -448,7 +471,7 @@ mod tests { } #[test] - fn test_is_deprecated() { + fn is_deprecated_works() { let template = TestTemplate01; assert_eq!(template.is_deprecated(), true); @@ -457,7 +480,7 @@ mod tests { } #[test] - fn test_deprecated_message() { + fn deprecated_message_works() { let template = TestTemplate01; assert_eq!( template.deprecated_message(), @@ -467,4 +490,15 @@ mod tests { let template = TestTemplate02; assert_eq!(template.deprecated_message(), ""); } + + #[test] + fn template_name_without_provider() { + let template_names = templates_names_without_providers(); + for template in Parachain::VARIANTS { + assert_eq!( + template.template_name_without_provider(), + template_names.get(template).unwrap() + ); + } + } } From 0126489b7e9cecac1d09fff480f61c52c6f6d286 Mon Sep 17 00:00:00 2001 From: AlexD10S Date: Thu, 19 Sep 2024 12:29:02 +0200 Subject: [PATCH 12/17] fix: deprecate template instantiation --- crates/pop-parachains/src/new_parachain.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/pop-parachains/src/new_parachain.rs b/crates/pop-parachains/src/new_parachain.rs index f554e5cc..0e40079f 100644 --- a/crates/pop-parachains/src/new_parachain.rs +++ b/crates/pop-parachains/src/new_parachain.rs @@ -87,13 +87,13 @@ pub fn instantiate_openzeppelin_template( let source = temp_dir.path(); let tag = Git::clone_and_degit(template.repository_url()?, source, tag_version)?; + let mut template_name = template.template_name_without_provider(); + // Handle deprecated OpenZeppelin template + if matches!(template, Parachain::DeprecatedOpenZeppelinGeneric) { + template_name = Parachain::OpenZeppelinGeneric.template_name_without_provider(); + } - extract_template_files( - template.template_name_without_provider(), - temp_dir.path(), - target, - None, - )?; + extract_template_files(template_name, temp_dir.path(), target, None)?; Ok(tag) } From b73b549cf4b947da44bcbb69bc19b0328794aca7 Mon Sep 17 00:00:00 2001 From: AlexD10S Date: Wed, 30 Oct 2024 15:36:24 +0100 Subject: [PATCH 13/17] chore: upgrade zombienet-sdk --- Cargo.lock | 26 ++++++++++++++------------ Cargo.toml | 2 +- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c61b38f8..d0a559d7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8547,17 +8547,19 @@ dependencies = [ [[package]] name = "zombienet-configuration" -version = "0.2.10" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23322e411b8d19b41b5c20ab8e88c10822189a4fcfd069c7fcd1542b8d3035aa" +checksum = "c8ab4af5d47f03cb8ae0fa96ffbf3881ca050c51e62367685ebdd3e8ae52b220" dependencies = [ "anyhow", "lazy_static", "multiaddr", "regex", + "reqwest 0.11.27", "serde", "serde_json", "thiserror", + "tokio", "toml 0.7.8", "url", "zombienet-support", @@ -8565,9 +8567,9 @@ dependencies = [ [[package]] name = "zombienet-orchestrator" -version = "0.2.10" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "381f701565b3918a909132743b3674569ce3da25b5c3a6493883abaf1046577a" +checksum = "580e01019655a2bd296e42f48876c2e78c94a989147376e025c0e64daf717cf7" dependencies = [ "anyhow", "async-trait", @@ -8598,9 +8600,9 @@ dependencies = [ [[package]] name = "zombienet-prom-metrics-parser" -version = "0.2.10" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dab79fa58bcfecbcd41485c6f13052853ccde8b09f173b601f78747d7abc2b7f" +checksum = "4d026607c1a6e198b653c5979fb07078740861978ddecfd5460f2c32cdc182b1" dependencies = [ "pest", "pest_derive", @@ -8609,9 +8611,9 @@ dependencies = [ [[package]] name = "zombienet-provider" -version = "0.2.10" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6af0264938da61b25da89f17ee0630393a4ba793582a4a8a1650eb15b47fc1ef" +checksum = "55583d8be6b2ca2e679d85ee2e17eb0802fbf8d2ee05c1b326fff81fd6b3b5c3" dependencies = [ "anyhow", "async-trait", @@ -8640,9 +8642,9 @@ dependencies = [ [[package]] name = "zombienet-sdk" -version = "0.2.10" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bc5b7ebfba4ab62486c8cb5bcd7345c4376487487cfe3481476cb4d4accc75e" +checksum = "300f3f07aa72df21a52611a0df1033325a454252e36d964c4308b0a8b7356f77" dependencies = [ "async-trait", "futures", @@ -8657,9 +8659,9 @@ dependencies = [ [[package]] name = "zombienet-support" -version = "0.2.10" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f5b80d34a0eecca69dd84c2e13f84f1fae0cc378baf4f15f769027af068418b" +checksum = "e566ea145dab27c6fbb24b13d4c789efa7e675e1fdaf6d007dfe1154d59317c6" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index 3a2e1904..b0c37014 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -60,7 +60,7 @@ toml_edit = { version = "0.22", features = ["serde"] } symlink = "0.1" serde_json = { version = "1.0", features = ["preserve_order"] } serde = { version = "1.0", features = ["derive"] } -zombienet-sdk = "0.2.10" +zombienet-sdk = "0.2.14" git2_credentials = "0.13.0" # pop-cli From ef7a691e9ce806c2d9fcbd84e937d4d4d5cafbdf Mon Sep 17 00:00:00 2001 From: AlexD10S Date: Fri, 1 Nov 2024 15:18:58 +0100 Subject: [PATCH 14/17] chore: update evm supported version --- crates/pop-parachains/src/templates.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/pop-parachains/src/templates.rs b/crates/pop-parachains/src/templates.rs index ea1e6c3c..0f9ba579 100644 --- a/crates/pop-parachains/src/templates.rs +++ b/crates/pop-parachains/src/templates.rs @@ -130,7 +130,7 @@ pub enum Parachain { Provider = "OpenZeppelin", Repository = "https://github.com/OpenZeppelin/polkadot-runtime-templates", Network = "./zombienet-config/devnet.toml", - SupportedVersions = "v1.0.0,v2.0.1", + SupportedVersions = "v1.0.0,v2.0.1,v2.0.3", IsAudited = "true", License = "GPL-3.0" ) @@ -145,7 +145,7 @@ pub enum Parachain { Provider = "OpenZeppelin", Repository = "https://github.com/OpenZeppelin/polkadot-runtime-templates", Network = "./zombienet-config/devnet.toml", - SupportedVersions = "v2.0.1", + SupportedVersions = "v2.0.3", IsAudited = "true", License = "GPL-3.0" ) From 7e42531dcf609fe0fd7faa552422768fa805cda3 Mon Sep 17 00:00:00 2001 From: AlexD10S Date: Tue, 5 Nov 2024 12:23:42 +0100 Subject: [PATCH 15/17] refactor: rename enum_variants_for_help macro --- crates/pop-cli/src/commands/new/parachain.rs | 8 ++++---- crates/pop-common/src/templates/mod.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/pop-cli/src/commands/new/parachain.rs b/crates/pop-cli/src/commands/new/parachain.rs index 0f8feb95..c33457ad 100644 --- a/crates/pop-cli/src/commands/new/parachain.rs +++ b/crates/pop-cli/src/commands/new/parachain.rs @@ -15,7 +15,7 @@ use cliclack::{ outro, outro_cancel, }; use pop_common::{ - enum_variants, enum_variants_for_help, + enum_variants, enum_variants_without_deprecated, templates::{Template, Type}, Git, GitHub, Release, }; @@ -40,7 +40,7 @@ pub struct NewParachainCommand { #[arg( short = 't', long, - help = format!("Template to use. [possible values: {}]", enum_variants_for_help!(Parachain)), + help = format!("Template to use. [possible values: {}]", enum_variants_without_deprecated!(Parachain)), value_parser = enum_variants!(Parachain), hide_possible_values = true // Hide the deprecated templates )] @@ -268,8 +268,8 @@ fn get_customization_value( decimals: Option, initial_endowment: Option, ) -> Result { - if !matches!(template, Parachain::Standard) && - (symbol.is_some() || decimals.is_some() || initial_endowment.is_some()) + if !matches!(template, Parachain::Standard) + && (symbol.is_some() || decimals.is_some() || initial_endowment.is_some()) { log::warning("Customization options are not available for this template")?; sleep(Duration::from_secs(3)) diff --git a/crates/pop-common/src/templates/mod.rs b/crates/pop-common/src/templates/mod.rs index 0ccbf45d..45edeebf 100644 --- a/crates/pop-common/src/templates/mod.rs +++ b/crates/pop-common/src/templates/mod.rs @@ -111,7 +111,7 @@ macro_rules! enum_variants { } #[macro_export] -macro_rules! enum_variants_for_help { +macro_rules! enum_variants_without_deprecated { ($e:ty) => {{ <$e>::VARIANTS .iter() From e8972f07b9b6577d3df9d8be8daa9092d0702f3e Mon Sep 17 00:00:00 2001 From: AlexD10S Date: Tue, 5 Nov 2024 12:34:39 +0100 Subject: [PATCH 16/17] chore: fmt --- crates/pop-cli/src/commands/new/parachain.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/pop-cli/src/commands/new/parachain.rs b/crates/pop-cli/src/commands/new/parachain.rs index c33457ad..e65035cf 100644 --- a/crates/pop-cli/src/commands/new/parachain.rs +++ b/crates/pop-cli/src/commands/new/parachain.rs @@ -268,8 +268,8 @@ fn get_customization_value( decimals: Option, initial_endowment: Option, ) -> Result { - if !matches!(template, Parachain::Standard) - && (symbol.is_some() || decimals.is_some() || initial_endowment.is_some()) + if !matches!(template, Parachain::Standard) && + (symbol.is_some() || decimals.is_some() || initial_endowment.is_some()) { log::warning("Customization options are not available for this template")?; sleep(Duration::from_secs(3)) From 4890164be137708f1b82bd5bcfcd98a3991ccac9 Mon Sep 17 00:00:00 2001 From: AlexD10S Date: Thu, 7 Nov 2024 23:08:26 +0100 Subject: [PATCH 17/17] fix: clippy --- crates/pop-contracts/src/new.rs | 2 +- crates/pop-parachains/src/new_parachain.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/pop-contracts/src/new.rs b/crates/pop-contracts/src/new.rs index 6c9ab9b8..5e812cb0 100644 --- a/crates/pop-contracts/src/new.rs +++ b/crates/pop-contracts/src/new.rs @@ -68,7 +68,7 @@ fn create_template_contract( extract_template_files("", temp_dir.path(), canonicalized_path.as_path(), None)?; } else { extract_template_files( - &template.to_string(), + template.as_ref(), temp_dir.path(), canonicalized_path.as_path(), Some(vec!["frontend".to_string()]), diff --git a/crates/pop-parachains/src/new_parachain.rs b/crates/pop-parachains/src/new_parachain.rs index 0e40079f..8974cfed 100644 --- a/crates/pop-parachains/src/new_parachain.rs +++ b/crates/pop-parachains/src/new_parachain.rs @@ -32,7 +32,7 @@ pub fn instantiate_template_dir( if Provider::Pop.provides(template) { return instantiate_standard_template(template, target, config, tag_version); } - if Provider::OpenZeppelin.provides(&template) { + if Provider::OpenZeppelin.provides(template) { return instantiate_openzeppelin_template(template, target, tag_version); } let tag = Git::clone_and_degit(template.repository_url()?, target, tag_version)?;