Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(up): bump fallback versions #393

Merged
merged 2 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions crates/pop-parachains/src/up/chain_specs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ 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.
#[strum(props(
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.
#[strum(props(
Repository = "https://github.com/r0gue-io/polkadot-runtimes",
Binary = "chain-spec-generator",
Chain = "polkadot-local",
Fallback = "v1.2.7"
Fallback = "v1.3.3"
))]
Polkadot,
}
Expand Down Expand Up @@ -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?
Expand All @@ -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?
Expand All @@ -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?
Expand Down
61 changes: 29 additions & 32 deletions crates/pop-parachains/src/up/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,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;
Expand All @@ -683,12 +685,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,
Expand All @@ -698,12 +699,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());
Ok(())
Expand All @@ -721,7 +722,7 @@ chain = "paseo-local"
chain = "paseo-local"
"#
)?;
let version = "v1.2.7";
let version = "v1.3.3";

let zombienet = Zombienet::new(
&cache,
Expand Down Expand Up @@ -761,15 +762,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,
Expand All @@ -779,12 +779,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(())
Expand All @@ -807,12 +807,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,
Expand All @@ -822,12 +821,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(())
Expand All @@ -852,14 +851,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(())
}
Expand All @@ -879,14 +878,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(())
}
Expand All @@ -907,12 +906,12 @@ id = 1000
chain = "asset-hub-paseo-local"
"#
)?;
let system_parachain_version = "v1.12.0";
let system_parachain_version = "stable2407";
AlexD10S marked this conversation as resolved.
Show resolved Hide resolved

let zombienet = Zombienet::new(
&cache,
config.path().to_str().unwrap(),
Some("v1.11.0"),
Some(VERSION),
None,
Some(system_parachain_version),
None,
Expand Down Expand Up @@ -952,15 +951,14 @@ id = 1000
chain = "asset-hub-paseo-local"
"#
)?;
let version = "v1.12.0";

let zombienet = Zombienet::new(
&cache,
config.path().to_str().unwrap(),
None,
None,
None,
Some(version),
Some(VERSION),
None,
)
.await?;
Expand All @@ -972,13 +970,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(())
}
Expand Down Expand Up @@ -1384,10 +1382,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,
Expand Down
20 changes: 9 additions & 11 deletions crates/pop-parachains/src/up/parachains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ 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.
#[strum(props(
Repository = "https://github.com/r0gue-io/pop-node",
Binary = "pop-node",
Prerelease = "false",
Fallback = "testnet-v0.4.1"
Fallback = "testnet-v0.4.2"
))]
Pop,
}
Expand Down Expand Up @@ -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;

Expand All @@ -159,7 +159,7 @@ mod tests {
"polkadot",
None,
None,
"v1.12.0",
VERSION,
Some("asset-hub-paseo-local"),
tempdir()?.path()
)
Expand All @@ -170,21 +170,20 @@ 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);
assert!(matches!(parachain.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: vec![(expected.binary(), None)],
Expand All @@ -196,21 +195,20 @@ 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);
assert!(matches!(parachain.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: vec![(expected.binary(), None)],
Expand All @@ -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()?;
Expand Down
Loading
Loading