diff --git a/.github/actions/run-differential-tests/action.yml b/.github/actions/run-differential-tests/action.yml index 1fe3ec2..06f4112 100644 --- a/.github/actions/run-differential-tests/action.yml +++ b/.github/actions/run-differential-tests/action.yml @@ -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 diff --git a/crates/config/src/lib.rs b/crates/config/src/lib.rs index 3b63c1b..be8838c 100644 --- a/crates/config/src/lib.rs +++ b/crates/config/src/lib.rs @@ -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, + pub chain_spec_path: Option, /// 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. diff --git a/crates/core/src/lib.rs b/crates/core/src/lib.rs index ae42715..5928b85 100644 --- a/crates/core/src/lib.rs +++ b/crates/core/src/lib.rs @@ -486,13 +486,9 @@ impl Platform for PolkadotOmniNodePolkavmResolcPlatform { let wallet = AsRef::::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::::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")?, ) diff --git a/crates/node/Cargo.toml b/crates/node/Cargo.toml index 2ef530a..739ce8b 100644 --- a/crates/node/Cargo.toml +++ b/crates/node/Cargo.toml @@ -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] diff --git a/crates/node/src/node_implementations/polkadot_omni_node.rs b/crates/node/src/node_implementations/polkadot_omni_node.rs index e3a17e3..70d0ddd 100644 --- a/crates/node/src/node_implementations/polkadot_omni_node.rs +++ b/crates/node/src/node_implementations/polkadot_omni_node.rs @@ -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}; @@ -70,7 +69,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, + chain_spec_path: Option, /// 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. @@ -144,8 +143,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, @@ -177,10 +176,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")?, ) @@ -199,7 +196,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 @@ -358,40 +355,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 { - 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")?;