Skip to content

Commit

Permalink
refactor(up): bump fallback versions (#393)
Browse files Browse the repository at this point in the history
* refactor: bump fallback versions

* test: bump versions
  • Loading branch information
evilrobot-01 authored Dec 19, 2024
1 parent c1ed1ce commit 21d02db
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 57 deletions.
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 @@ -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;
Expand All @@ -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,
Expand All @@ -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");
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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(())
Expand All @@ -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,
Expand All @@ -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(())
Expand All @@ -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(())
}
Expand All @@ -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(())
}
Expand All @@ -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,
Expand Down Expand Up @@ -973,15 +972,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 @@ -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(())
}
Expand Down Expand Up @@ -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,
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

0 comments on commit 21d02db

Please sign in to comment.