From 21d02dbfd836067f6cce12716cf8e818b982c51f Mon Sep 17 00:00:00 2001 From: Frank Bell <60948618+evilrobot-01@users.noreply.github.com> Date: Thu, 19 Dec 2024 09:29:13 +0000 Subject: [PATCH] refactor(up): bump fallback versions (#393) * refactor: bump fallback versions * test: bump versions --- crates/pop-parachains/src/up/chain_specs.rs | 12 ++-- crates/pop-parachains/src/up/mod.rs | 61 ++++++++++----------- crates/pop-parachains/src/up/parachains.rs | 20 +++---- crates/pop-parachains/src/up/relay.rs | 16 +++--- 4 files changed, 52 insertions(+), 57 deletions(-) diff --git a/crates/pop-parachains/src/up/chain_specs.rs b/crates/pop-parachains/src/up/chain_specs.rs index 3513a587e..e81db7ee9 100644 --- a/crates/pop-parachains/src/up/chain_specs.rs +++ b/crates/pop-parachains/src/up/chain_specs.rs @@ -22,7 +22,7 @@ pub(super) enum Runtime { Repository = "https://github.com/r0gue-io/polkadot-runtimes", Binary = "chain-spec-generator", Chain = "kusama-local", - Fallback = "v1.2.7" + Fallback = "v1.3.3" ))] Kusama, /// Paseo. @@ -30,7 +30,7 @@ pub(super) enum Runtime { Repository = "https://github.com/r0gue-io/paseo-runtimes", Binary = "chain-spec-generator", Chain = "paseo-local", - Fallback = "v1.2.6" + Fallback = "v1.3.4" ))] Paseo, /// Polkadot. @@ -38,7 +38,7 @@ pub(super) enum Runtime { Repository = "https://github.com/r0gue-io/polkadot-runtimes", Binary = "chain-spec-generator", Chain = "polkadot-local", - Fallback = "v1.2.7" + Fallback = "v1.3.3" ))] Polkadot, } @@ -111,7 +111,7 @@ mod tests { #[tokio::test] async fn kusama_works() -> anyhow::Result<()> { let expected = Runtime::Kusama; - let version = "v1.2.7"; + let version = "v1.3.3"; let temp_dir = tempdir()?; let binary = chain_spec_generator("kusama-local", Some(version), temp_dir.path()) .await? @@ -135,7 +135,7 @@ mod tests { #[tokio::test] async fn paseo_works() -> anyhow::Result<()> { let expected = Runtime::Paseo; - let version = "v1.2.4"; + let version = "v1.3.4"; let temp_dir = tempdir()?; let binary = chain_spec_generator("paseo-local", Some(version), temp_dir.path()) .await? @@ -159,7 +159,7 @@ mod tests { #[tokio::test] async fn polkadot_works() -> anyhow::Result<()> { let expected = Runtime::Polkadot; - let version = "v1.2.7"; + let version = "v1.3.3"; let temp_dir = tempdir()?; let binary = chain_spec_generator("polkadot-local", Some(version), temp_dir.path()) .await? diff --git a/crates/pop-parachains/src/up/mod.rs b/crates/pop-parachains/src/up/mod.rs index 91c1678af..abefa8051 100644 --- a/crates/pop-parachains/src/up/mod.rs +++ b/crates/pop-parachains/src/up/mod.rs @@ -679,6 +679,8 @@ mod tests { use std::{env::current_dir, fs::File, io::Write}; use tempfile::tempdir; + pub(crate) const VERSION: &str = "stable2409"; + mod zombienet { use super::*; use pop_common::Status; @@ -702,12 +704,11 @@ mod tests { chain = "paseo-local" "# )?; - let version = "v1.12.0"; let zombienet = Zombienet::new( &cache, config.path().to_str().unwrap(), - Some(version), + Some(VERSION), None, None, None, @@ -717,12 +718,12 @@ chain = "paseo-local" let relay_chain = &zombienet.relay_chain.binary; assert_eq!(relay_chain.name(), "polkadot"); - assert_eq!(relay_chain.path(), temp_dir.path().join(format!("polkadot-{version}"))); - assert_eq!(relay_chain.version().unwrap(), version); + assert_eq!(relay_chain.path(), temp_dir.path().join(format!("polkadot-{VERSION}"))); + assert_eq!(relay_chain.version().unwrap(), VERSION); assert!(matches!( relay_chain, Binary::Source { source: Source::GitHub(ReleaseArchive { tag, .. }), .. } - if *tag == Some(version.to_string()) + if *tag == Some(VERSION.to_string()) )); assert!(zombienet.parachains.is_empty()); assert_eq!(zombienet.relay_chain(), "paseo-local"); @@ -742,7 +743,7 @@ chain = "paseo-local" chain = "paseo-local" "# )?; - let version = "v1.2.7"; + let version = "v1.3.3"; let zombienet = Zombienet::new( &cache, @@ -782,15 +783,14 @@ chain = "paseo-local" r#" [relaychain] chain = "paseo-local" -default_command = "./bin-v1.6.0/polkadot" +default_command = "./bin-stable2409/polkadot" "# )?; - let version = "v1.12.0"; let zombienet = Zombienet::new( &cache, config.path().to_str().unwrap(), - Some(version), + Some(VERSION), None, None, None, @@ -800,12 +800,12 @@ default_command = "./bin-v1.6.0/polkadot" let relay_chain = &zombienet.relay_chain.binary; assert_eq!(relay_chain.name(), "polkadot"); - assert_eq!(relay_chain.path(), temp_dir.path().join(format!("polkadot-{version}"))); - assert_eq!(relay_chain.version().unwrap(), version); + assert_eq!(relay_chain.path(), temp_dir.path().join(format!("polkadot-{VERSION}"))); + assert_eq!(relay_chain.version().unwrap(), VERSION); assert!(matches!( relay_chain, Binary::Source { source: Source::GitHub(ReleaseArchive { tag, .. }), .. } - if *tag == Some(version.to_string()) + if *tag == Some(VERSION.to_string()) )); assert!(zombienet.parachains.is_empty()); Ok(()) @@ -828,12 +828,11 @@ validator = true command = "polkadot" "# )?; - let version = "v1.12.0"; let zombienet = Zombienet::new( &cache, config.path().to_str().unwrap(), - Some(version), + Some(VERSION), None, None, None, @@ -843,12 +842,12 @@ command = "polkadot" let relay_chain = &zombienet.relay_chain.binary; assert_eq!(relay_chain.name(), "polkadot"); - assert_eq!(relay_chain.path(), temp_dir.path().join(format!("polkadot-{version}"))); - assert_eq!(relay_chain.version().unwrap(), version); + assert_eq!(relay_chain.path(), temp_dir.path().join(format!("polkadot-{VERSION}"))); + assert_eq!(relay_chain.version().unwrap(), VERSION); assert!(matches!( relay_chain, Binary::Source { source: Source::GitHub(ReleaseArchive { tag, .. }), .. } - if *tag == Some(version.to_string()) + if *tag == Some(VERSION.to_string()) )); assert!(zombienet.parachains.is_empty()); Ok(()) @@ -873,14 +872,14 @@ command = "polkadot" [[relaychain.nodes]] name = "bob" validator = true -command = "polkadot-v1.12.0" +command = "polkadot-stable2409" "# )?; assert!(matches!( Zombienet::new(&cache, config.path().to_str().unwrap(), None, None, None, None, None).await, Err(Error::UnsupportedCommand(error)) - if error == "the relay chain command is unsupported: polkadot-v1.12.0" + if error == "the relay chain command is unsupported: polkadot-stable2409" )); Ok(()) } @@ -900,14 +899,14 @@ default_command = "polkadot" [[relaychain.nodes]] name = "alice" validator = true -command = "polkadot-v1.12.0" +command = "polkadot-stable2409" "# )?; assert!(matches!( Zombienet::new(&cache, config.path().to_str().unwrap(), None, None, None, None, None).await, Err(Error::UnsupportedCommand(error)) - if error == "the relay chain command is unsupported: polkadot-v1.12.0" + if error == "the relay chain command is unsupported: polkadot-stable2409" )); Ok(()) } @@ -928,12 +927,12 @@ id = 1000 chain = "asset-hub-paseo-local" "# )?; - let system_parachain_version = "v1.12.0"; + let system_parachain_version = "stable2407"; let zombienet = Zombienet::new( &cache, config.path().to_str().unwrap(), - Some("v1.11.0"), + Some(VERSION), None, Some(system_parachain_version), None, @@ -973,7 +972,6 @@ id = 1000 chain = "asset-hub-paseo-local" "# )?; - let version = "v1.12.0"; let zombienet = Zombienet::new( &cache, @@ -981,7 +979,7 @@ chain = "asset-hub-paseo-local" None, None, None, - Some(version), + Some(VERSION), None, ) .await?; @@ -993,13 +991,13 @@ chain = "asset-hub-paseo-local" assert_eq!(chain_spec_generator.name(), "paseo-chain-spec-generator"); assert_eq!( chain_spec_generator.path(), - temp_dir.path().join(format!("paseo-chain-spec-generator-{version}")) + temp_dir.path().join(format!("paseo-chain-spec-generator-{VERSION}")) ); - assert_eq!(chain_spec_generator.version().unwrap(), version); + assert_eq!(chain_spec_generator.version().unwrap(), VERSION); assert!(matches!( chain_spec_generator, Binary::Source { source: Source::GitHub(ReleaseArchive { tag, .. }), .. } - if *tag == Some(version.to_string()) + if *tag == Some(VERSION.to_string()) )); Ok(()) } @@ -1447,10 +1445,9 @@ chain = "paseo-local" chain = "paseo-local" "# )?; - let version = "v1.12.0"; - File::create(cache.join(format!("polkadot-{version}")))?; - File::create(cache.join(format!("polkadot-execute-worker-{version}")))?; - File::create(cache.join(format!("polkadot-prepare-worker-{version}")))?; + File::create(cache.join(format!("polkadot-{VERSION}")))?; + File::create(cache.join(format!("polkadot-execute-worker-{VERSION}")))?; + File::create(cache.join(format!("polkadot-prepare-worker-{VERSION}")))?; let mut zombienet = Zombienet::new( &cache, diff --git a/crates/pop-parachains/src/up/parachains.rs b/crates/pop-parachains/src/up/parachains.rs index 06eda16e6..ad6075454 100644 --- a/crates/pop-parachains/src/up/parachains.rs +++ b/crates/pop-parachains/src/up/parachains.rs @@ -22,7 +22,7 @@ pub(super) enum Parachain { Repository = "https://github.com/r0gue-io/polkadot", Binary = "polkadot-parachain", TagFormat = "polkadot-{tag}", - Fallback = "v1.12.0" + Fallback = "stable2409" ))] System, /// Pop Network makes it easy for smart contract developers to use the power of Polkadot. @@ -30,7 +30,7 @@ pub(super) enum Parachain { Repository = "https://github.com/r0gue-io/pop-node", Binary = "pop-node", Prerelease = "false", - Fallback = "testnet-v0.4.1" + Fallback = "testnet-v0.4.2" ))] Pop, } @@ -148,7 +148,7 @@ pub(super) async fn from( #[cfg(test)] mod tests { - use super::*; + use super::{super::tests::VERSION, *}; use std::path::PathBuf; use tempfile::tempdir; @@ -159,7 +159,7 @@ mod tests { "polkadot", None, None, - "v1.12.0", + VERSION, Some("asset-hub-paseo-local"), tempdir()?.path() ) @@ -170,13 +170,12 @@ mod tests { #[tokio::test] async fn system_using_relay_version() -> anyhow::Result<()> { - let version = "v1.12.0"; let expected = Parachain::System; let para_id = 1000; let temp_dir = tempdir()?; let parachain = - system(para_id, expected.binary(), None, None, version, None, temp_dir.path()) + system(para_id, expected.binary(), None, None, VERSION, None, temp_dir.path()) .await? .unwrap(); assert_eq!(para_id, parachain.id); @@ -184,7 +183,7 @@ mod tests { if name == expected.binary() && source == Source::GitHub(ReleaseArchive { owner: "r0gue-io".to_string(), repository: "polkadot".to_string(), - tag: Some(version.to_string()), + tag: Some(VERSION.to_string()), tag_format: Some("polkadot-{tag}".to_string()), archive: format!("{name}-{}.tar.gz", target()?), contents: vec![(expected.binary(), None)], @@ -196,13 +195,12 @@ mod tests { #[tokio::test] async fn system_works() -> anyhow::Result<()> { - let version = "v1.12.0"; let expected = Parachain::System; let para_id = 1000; let temp_dir = tempdir()?; let parachain = - system(para_id, expected.binary(), Some(version), None, version, None, temp_dir.path()) + system(para_id, expected.binary(), Some(VERSION), None, VERSION, None, temp_dir.path()) .await? .unwrap(); assert_eq!(para_id, parachain.id); @@ -210,7 +208,7 @@ mod tests { if name == expected.binary() && source == Source::GitHub(ReleaseArchive { owner: "r0gue-io".to_string(), repository: "polkadot".to_string(), - tag: Some(version.to_string()), + tag: Some(VERSION.to_string()), tag_format: Some("polkadot-{tag}".to_string()), archive: format!("{name}-{}.tar.gz", target()?), contents: vec![(expected.binary(), None)], @@ -223,7 +221,7 @@ mod tests { #[tokio::test] async fn system_with_chain_spec_generator_works() -> anyhow::Result<()> { let expected = Parachain::System; - let runtime_version = "v1.2.7"; + let runtime_version = "v1.3.3"; let para_id = 1000; let temp_dir = tempdir()?; diff --git a/crates/pop-parachains/src/up/relay.rs b/crates/pop-parachains/src/up/relay.rs index 662e639fd..2390e446a 100644 --- a/crates/pop-parachains/src/up/relay.rs +++ b/crates/pop-parachains/src/up/relay.rs @@ -24,7 +24,7 @@ pub(super) enum RelayChain { Repository = "https://github.com/r0gue-io/polkadot", Binary = "polkadot", TagFormat = "polkadot-{tag}", - Fallback = "v1.12.0" + Fallback = "stable2409" ))] Polkadot, } @@ -131,17 +131,18 @@ mod tests { use super::*; use tempfile::tempdir; + const VERSION: &str = "stable2409"; + #[tokio::test] async fn default_works() -> anyhow::Result<()> { let expected = RelayChain::Polkadot; - let version = "v1.12.0"; let temp_dir = tempdir()?; - let relay = default(Some(version), None, None, temp_dir.path()).await?; + let relay = default(Some(VERSION), None, None, temp_dir.path()).await?; assert!(matches!(relay.binary, Binary::Source { name, source, cache } if name == expected.binary() && source == Source::GitHub(ReleaseArchive { owner: "r0gue-io".to_string(), repository: "polkadot".to_string(), - tag: Some(version.to_string()), + tag: Some(VERSION.to_string()), tag_format: Some("polkadot-{tag}".to_string()), archive: format!("{name}-{}.tar.gz", target()?), contents: ["polkadot", "polkadot-execute-worker", "polkadot-prepare-worker"].map(|b| (b, None)).to_vec(), @@ -154,7 +155,7 @@ mod tests { #[tokio::test] async fn default_with_chain_spec_generator_works() -> anyhow::Result<()> { - let runtime_version = "v1.2.7"; + let runtime_version = "v1.3.3"; let temp_dir = tempdir()?; let relay = default(None, Some(runtime_version), Some("paseo-local"), temp_dir.path()).await?; @@ -186,15 +187,14 @@ mod tests { #[tokio::test] async fn from_handles_local_command() -> anyhow::Result<()> { let expected = RelayChain::Polkadot; - let version = "v1.12.0"; let temp_dir = tempdir()?; let relay = - from("./bin-v1.6.0/polkadot", Some(version), None, None, temp_dir.path()).await?; + from("./bin-stable2409/polkadot", Some(VERSION), None, None, temp_dir.path()).await?; assert!(matches!(relay.binary, Binary::Source { name, source, cache } if name == expected.binary() && source == Source::GitHub(ReleaseArchive { owner: "r0gue-io".to_string(), repository: "polkadot".to_string(), - tag: Some(version.to_string()), + tag: Some(VERSION.to_string()), tag_format: Some("polkadot-{tag}".to_string()), archive: format!("{name}-{}.tar.gz", target()?), contents: ["polkadot", "polkadot-execute-worker", "polkadot-prepare-worker"].map(|b| (b, None)).to_vec(),