Compare commits

...

2 Commits

Author SHA1 Message Date
Omar Abdulla 320accc62a Remove unneeded dependency 2026-01-13 13:53:33 +03:00
Omar Abdulla 92effaf6c0 Change the input for the polkadot-omni-node to be a path to chain-spec 2026-01-13 13:31:54 +03:00
5 changed files with 19 additions and 61 deletions
@@ -33,8 +33,8 @@ inputs:
description: "The identifier of the platform to run the tests on (e.g., geth-evm-solc, revive-dev-node-revm-solc)"
required: true
type: string
polkadot-omnichain-node-runtime-path:
description: "The path of the WASM runtime to use with the polkadot-omni-node. This is only required if the polkadot-omni-node is one of the selected platforms."
polkadot-omnichain-node-chain-spec-path:
description: "The path of the chain-spec of the chain we're spawning'. This is only required if the polkadot-omni-node is one of the selected platforms."
required: false
type: string
polkadot-omnichain-node-parachain-id:
@@ -89,10 +89,10 @@ runs:
"${{ inputs['polkadot-omnichain-node-parachain-id'] }}"
)
fi
if [[ -n "${{ inputs['polkadot-omnichain-node-runtime-path'] }}" ]]; then
if [[ -n "${{ inputs['polkadot-omnichain-node-chain-spec-path'] }}" ]]; then
OMNI_ARGS+=(
--polkadot-omni-node.runtime-wasm-path
"${{ inputs['polkadot-omnichain-node-runtime-path'] }}"
--polkadot-omni-node.chain-spec-path
"${{ inputs['polkadot-omnichain-node-chain-spec-path'] }}"
)
fi
+4 -5
View File
@@ -943,13 +943,12 @@ pub struct PolkadotOmnichainNodeConfiguration {
)]
pub block_time: Duration,
/// The path of the WASM runtime to use for the polkadot-omni-node. This argument is required if
/// the polkadot-omni-node is one of the selected platforms for running the tests or benchmarks.
/// The path of the chainspec of the chain that we're spawning
#[clap(
id = "polkadot-omni-node.runtime-wasm-path",
long = "polkadot-omni-node.runtime-wasm-path"
id = "polkadot-omni-node.chain-spec-path",
long = "polkadot-omni-node.chain-spec-path"
)]
pub runtime_wasm_path: Option<PathBuf>,
pub chain_spec_path: Option<PathBuf>,
/// The ID of the parachain that the polkadot-omni-node will spawn. This argument is required if
/// the polkadot-omni-node is one of the selected platforms for running the tests or benchmarks.
+2 -10
View File
@@ -486,13 +486,9 @@ impl Platform for PolkadotOmniNodePolkavmResolcPlatform {
let wallet = AsRef::<WalletConfiguration>::as_ref(&context).wallet();
PolkadotOmnichainNode::node_genesis(
&polkadot_omnichain_node_configuration.path,
&wallet,
polkadot_omnichain_node_configuration
.parachain_id
.context("No parachain id found in the configuration of the polkadot-omni-node")?,
polkadot_omnichain_node_configuration
.runtime_wasm_path
.chain_spec_path
.as_ref()
.context("No WASM runtime path found in the polkadot-omni-node configuration")?,
)
@@ -550,13 +546,9 @@ impl Platform for PolkadotOmniNodeRevmSolcPlatform {
let wallet = AsRef::<WalletConfiguration>::as_ref(&context).wallet();
PolkadotOmnichainNode::node_genesis(
&polkadot_omnichain_node_configuration.path,
&wallet,
polkadot_omnichain_node_configuration
.parachain_id
.context("No parachain id found in the configuration of the polkadot-omni-node")?,
polkadot_omnichain_node_configuration
.runtime_wasm_path
.chain_spec_path
.as_ref()
.context("No WASM runtime path found in the polkadot-omni-node configuration")?,
)
-1
View File
@@ -31,7 +31,6 @@ serde_yaml_ng = { workspace = true }
sp-core = { workspace = true }
sp-runtime = { workspace = true }
subxt = { workspace = true }
temp-dir = { workspace = true }
zombienet-sdk = { workspace = true }
[dev-dependencies]
@@ -42,7 +42,6 @@ use revive_dt_report::{
EthereumMinedBlockInformation, MinedBlockInformation, SubstrateMinedBlockInformation,
};
use subxt::{OnlineClient, SubstrateConfig};
use temp_dir::TempDir;
use tokio::sync::OnceCell;
use tracing::{instrument, trace};
@@ -73,7 +72,7 @@ pub struct PolkadotOmnichainNode {
/// The path of the eth-rpc binary.
eth_rpc_binary_path: PathBuf,
/// The path of the runtime's WASM that this node will be spawned with.
runtime_wasm_path: Option<PathBuf>,
chain_spec_path: Option<PathBuf>,
/// The path of the base directory which contains all of the stored data for this node.
base_directory_path: PathBuf,
/// The path of the logs directory which contains all of the stored logs.
@@ -147,8 +146,8 @@ impl PolkadotOmnichainNode {
.path
.to_path_buf(),
eth_rpc_binary_path: eth_rpc_path.to_path_buf(),
runtime_wasm_path: polkadot_omnichain_node_configuration
.runtime_wasm_path
chain_spec_path: polkadot_omnichain_node_configuration
.chain_spec_path
.clone(),
base_directory_path: base_directory,
logs_directory_path: logs_directory,
@@ -180,10 +179,8 @@ impl PolkadotOmnichainNode {
let template_chainspec_path = self.base_directory_path.join(Self::CHAIN_SPEC_JSON_FILE);
let chainspec_json = Self::node_genesis(
&self.polkadot_omnichain_node_binary_path,
&self.wallet,
self.parachain_id.context("No parachain id provided")?,
self.runtime_wasm_path
self.chain_spec_path
.as_ref()
.context("No runtime path provided")?,
)
@@ -202,7 +199,7 @@ impl PolkadotOmnichainNode {
fn spawn_process(&mut self) -> anyhow::Result<()> {
// Error out if the runtime's path or the parachain id are not set which means that the
// arguments we require were not provided.
self.runtime_wasm_path
self.chain_spec_path
.as_ref()
.context("No WASM path provided for the runtime")?;
self.parachain_id
@@ -361,40 +358,11 @@ impl PolkadotOmnichainNode {
}
pub fn node_genesis(
node_path: &Path,
wallet: &EthereumWallet,
parachain_id: usize,
runtime_wasm_path: &Path,
chain_spec_path: &Path,
) -> anyhow::Result<serde_json::Value> {
let tempdir = TempDir::new().context("Failed to create a temporary directory")?;
let unmodified_chainspec_path = tempdir.path().join("chainspec.json");
let output = Command::new(node_path)
.arg("chain-spec-builder")
.arg("-c")
.arg(unmodified_chainspec_path.as_path())
.arg("create")
.arg("--para-id")
.arg(parachain_id.to_string())
.arg("--relay-chain")
.arg("dontcare")
.arg("--runtime")
.arg(runtime_wasm_path)
.arg("named-preset")
.arg("development")
.env_remove("RUST_LOG")
.output()
.context("Failed to export the chain-spec")?;
if !output.status.success() {
anyhow::bail!(
"Exporting chainspec from polkadot-omni-node failed: {}",
String::from_utf8_lossy(&output.stderr)
);
}
let unmodified_chainspec_file = File::open(unmodified_chainspec_path.as_path())
.context("Failed to open the unmodified chainspec file")?;
let unmodified_chainspec_file =
File::open(chain_spec_path).context("Failed to open the unmodified chainspec file")?;
let mut chainspec_json =
serde_json::from_reader::<_, serde_json::Value>(&unmodified_chainspec_file)
.context("Failed to read the unmodified chainspec JSON")?;