mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-06-13 22:11:04 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a5f0c8713f | |||
| 89ccd72d20 | |||
| 4a4ac7ede6 | |||
| 94b04c0189 | |||
| 2d3602aaed |
@@ -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)"
|
description: "The identifier of the platform to run the tests on (e.g., geth-evm-solc, revive-dev-node-revm-solc)"
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
polkadot-omnichain-node-runtime-path:
|
polkadot-omnichain-node-chain-spec-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."
|
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
|
required: false
|
||||||
type: string
|
type: string
|
||||||
polkadot-omnichain-node-parachain-id:
|
polkadot-omnichain-node-parachain-id:
|
||||||
@@ -89,10 +89,10 @@ runs:
|
|||||||
"${{ inputs['polkadot-omnichain-node-parachain-id'] }}"
|
"${{ inputs['polkadot-omnichain-node-parachain-id'] }}"
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
if [[ -n "${{ inputs['polkadot-omnichain-node-runtime-path'] }}" ]]; then
|
if [[ -n "${{ inputs['polkadot-omnichain-node-chain-spec-path'] }}" ]]; then
|
||||||
OMNI_ARGS+=(
|
OMNI_ARGS+=(
|
||||||
--polkadot-omni-node.runtime-wasm-path
|
--polkadot-omni-node.chain-spec-path
|
||||||
"${{ inputs['polkadot-omnichain-node-runtime-path'] }}"
|
"${{ inputs['polkadot-omnichain-node-chain-spec-path'] }}"
|
||||||
)
|
)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Generated
+1065
-1076
File diff suppressed because it is too large
Load Diff
+3
-3
@@ -73,9 +73,9 @@ indexmap = { version = "2.10.0", default-features = false }
|
|||||||
itertools = { version = "0.14.0" }
|
itertools = { version = "0.14.0" }
|
||||||
|
|
||||||
# revive compiler
|
# revive compiler
|
||||||
revive-solc-json-interface = { git = "https://github.com/paritytech/revive", rev = "3389865af7c3ff6f29a586d82157e8bc573c1a8e" }
|
revive-solc-json-interface = { version = "0.5.0" }
|
||||||
revive-common = { git = "https://github.com/paritytech/revive", rev = "3389865af7c3ff6f29a586d82157e8bc573c1a8e" }
|
revive-common = { version = "0.3.0" }
|
||||||
revive-differential = { git = "https://github.com/paritytech/revive", rev = "3389865af7c3ff6f29a586d82157e8bc573c1a8e" }
|
revive-differential = { version = "0.3.0" }
|
||||||
|
|
||||||
zombienet-sdk = { git = "https://github.com/paritytech/zombienet-sdk.git", rev = "891f6554354ce466abd496366dbf8b4f82141241" }
|
zombienet-sdk = { git = "https://github.com/paritytech/zombienet-sdk.git", rev = "891f6554354ce466abd496366dbf8b4f82141241" }
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,13 @@ use dashmap::DashMap;
|
|||||||
use revive_dt_common::types::VersionOrRequirement;
|
use revive_dt_common::types::VersionOrRequirement;
|
||||||
use revive_dt_config::{ResolcConfiguration, SolcConfiguration, WorkingDirectoryConfiguration};
|
use revive_dt_config::{ResolcConfiguration, SolcConfiguration, WorkingDirectoryConfiguration};
|
||||||
use revive_solc_json_interface::{
|
use revive_solc_json_interface::{
|
||||||
SolcStandardJsonInput, SolcStandardJsonInputLanguage, SolcStandardJsonInputSettings,
|
PolkaVMDefaultHeapMemorySize, PolkaVMDefaultStackMemorySize, SolcStandardJsonInput,
|
||||||
SolcStandardJsonInputSettingsOptimizer, SolcStandardJsonInputSettingsSelection,
|
SolcStandardJsonInputLanguage, SolcStandardJsonInputSettings,
|
||||||
SolcStandardJsonOutput,
|
SolcStandardJsonInputSettingsLibraries, SolcStandardJsonInputSettingsMetadata,
|
||||||
|
SolcStandardJsonInputSettingsOptimizer, SolcStandardJsonInputSettingsPolkaVM,
|
||||||
|
SolcStandardJsonInputSettingsPolkaVMMemory, SolcStandardJsonInputSettingsSelection,
|
||||||
|
SolcStandardJsonOutput, standard_json::input::settings::optimizer::Optimizer,
|
||||||
|
standard_json::input::settings::optimizer::details::Details,
|
||||||
};
|
};
|
||||||
use tracing::{Span, field::display};
|
use tracing::{Span, field::display};
|
||||||
|
|
||||||
@@ -25,6 +29,7 @@ use crate::{
|
|||||||
use alloy::json_abi::JsonAbi;
|
use alloy::json_abi::JsonAbi;
|
||||||
use anyhow::{Context as _, Result};
|
use anyhow::{Context as _, Result};
|
||||||
use semver::Version;
|
use semver::Version;
|
||||||
|
use std::collections::BTreeSet;
|
||||||
use tokio::{io::AsyncWriteExt, process::Command as AsyncCommand};
|
use tokio::{io::AsyncWriteExt, process::Command as AsyncCommand};
|
||||||
|
|
||||||
/// A wrapper around the `resolc` binary, emitting PVM-compatible bytecode.
|
/// A wrapper around the `resolc` binary, emitting PVM-compatible bytecode.
|
||||||
@@ -37,6 +42,10 @@ struct ResolcInner {
|
|||||||
solc: Solc,
|
solc: Solc,
|
||||||
/// Path to the `resolc` executable
|
/// Path to the `resolc` executable
|
||||||
resolc_path: PathBuf,
|
resolc_path: PathBuf,
|
||||||
|
/// The PVM heap size in bytes.
|
||||||
|
pvm_heap_size: u32,
|
||||||
|
/// The PVM stack size in bytes.
|
||||||
|
pvm_stack_size: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Resolc {
|
impl Resolc {
|
||||||
@@ -63,10 +72,35 @@ impl Resolc {
|
|||||||
Self(Arc::new(ResolcInner {
|
Self(Arc::new(ResolcInner {
|
||||||
solc,
|
solc,
|
||||||
resolc_path: resolc_configuration.path.clone(),
|
resolc_path: resolc_configuration.path.clone(),
|
||||||
|
pvm_heap_size: resolc_configuration
|
||||||
|
.heap_size
|
||||||
|
.unwrap_or(PolkaVMDefaultHeapMemorySize),
|
||||||
|
pvm_stack_size: resolc_configuration
|
||||||
|
.stack_size
|
||||||
|
.unwrap_or(PolkaVMDefaultStackMemorySize),
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
.clone())
|
.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn polkavm_settings(&self) -> SolcStandardJsonInputSettingsPolkaVM {
|
||||||
|
SolcStandardJsonInputSettingsPolkaVM::new(
|
||||||
|
Some(SolcStandardJsonInputSettingsPolkaVMMemory::new(
|
||||||
|
Some(self.0.pvm_heap_size),
|
||||||
|
Some(self.0.pvm_stack_size),
|
||||||
|
)),
|
||||||
|
false,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn inject_polkavm_settings(&self, input: &SolcStandardJsonInput) -> Result<serde_json::Value> {
|
||||||
|
let mut input_value = serde_json::to_value(input)
|
||||||
|
.context("Failed to serialize Standard JSON input for resolc")?;
|
||||||
|
if let Some(settings) = input_value.get_mut("settings") {
|
||||||
|
settings["polkavm"] = serde_json::to_value(self.polkavm_settings()).unwrap();
|
||||||
|
}
|
||||||
|
Ok(input_value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SolidityCompiler for Resolc {
|
impl SolidityCompiler for Resolc {
|
||||||
@@ -121,8 +155,8 @@ impl SolidityCompiler for Resolc {
|
|||||||
.collect(),
|
.collect(),
|
||||||
settings: SolcStandardJsonInputSettings {
|
settings: SolcStandardJsonInputSettings {
|
||||||
evm_version,
|
evm_version,
|
||||||
libraries: Some(
|
libraries: SolcStandardJsonInputSettingsLibraries {
|
||||||
libraries
|
inner: libraries
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(source_code, libraries_map)| {
|
.map(|(source_code, libraries_map)| {
|
||||||
(
|
(
|
||||||
@@ -136,23 +170,29 @@ impl SolidityCompiler for Resolc {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
),
|
},
|
||||||
remappings: None,
|
remappings: BTreeSet::<String>::new(),
|
||||||
output_selection: Some(SolcStandardJsonInputSettingsSelection::new_required()),
|
output_selection: SolcStandardJsonInputSettingsSelection::new_required(),
|
||||||
via_ir: Some(true),
|
via_ir: Some(true),
|
||||||
optimizer: SolcStandardJsonInputSettingsOptimizer::new(
|
optimizer: SolcStandardJsonInputSettingsOptimizer::new(
|
||||||
optimization
|
optimization
|
||||||
.unwrap_or(ModeOptimizerSetting::M0)
|
.unwrap_or(ModeOptimizerSetting::M0)
|
||||||
.optimizations_enabled(),
|
.optimizations_enabled(),
|
||||||
None,
|
Optimizer::default_mode(),
|
||||||
&Version::new(0, 0, 0),
|
Details::disabled(&Version::new(0, 0, 0)),
|
||||||
false,
|
|
||||||
),
|
),
|
||||||
metadata: None,
|
polkavm: self.polkavm_settings(),
|
||||||
polkavm: None,
|
metadata: SolcStandardJsonInputSettingsMetadata::default(),
|
||||||
|
detect_missing_libraries: false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
Span::current().record("json_in", display(serde_json::to_string(&input).unwrap()));
|
// Manually inject polkavm settings since it's marked skip_serializing in the upstream crate
|
||||||
|
let std_input_json = self.inject_polkavm_settings(&input)?;
|
||||||
|
|
||||||
|
Span::current().record(
|
||||||
|
"json_in",
|
||||||
|
display(serde_json::to_string(&std_input_json).unwrap()),
|
||||||
|
);
|
||||||
|
|
||||||
let path = &self.0.resolc_path;
|
let path = &self.0.resolc_path;
|
||||||
let mut command = AsyncCommand::new(path);
|
let mut command = AsyncCommand::new(path);
|
||||||
@@ -181,8 +221,9 @@ impl SolidityCompiler for Resolc {
|
|||||||
.with_context(|| format!("Failed to spawn resolc at {}", path.display()))?;
|
.with_context(|| format!("Failed to spawn resolc at {}", path.display()))?;
|
||||||
|
|
||||||
let stdin_pipe = child.stdin.as_mut().expect("stdin must be piped");
|
let stdin_pipe = child.stdin.as_mut().expect("stdin must be piped");
|
||||||
let serialized_input = serde_json::to_vec(&input)
|
let serialized_input = serde_json::to_vec(&std_input_json)
|
||||||
.context("Failed to serialize Standard JSON input for resolc")?;
|
.context("Failed to serialize Standard JSON input for resolc")?;
|
||||||
|
|
||||||
stdin_pipe
|
stdin_pipe
|
||||||
.write_all(&serialized_input)
|
.write_all(&serialized_input)
|
||||||
.await
|
.await
|
||||||
@@ -228,7 +269,7 @@ impl SolidityCompiler for Resolc {
|
|||||||
|
|
||||||
// Detecting if the compiler output contained errors and reporting them through logs and
|
// Detecting if the compiler output contained errors and reporting them through logs and
|
||||||
// errors instead of returning the compiler output that might contain errors.
|
// errors instead of returning the compiler output that might contain errors.
|
||||||
for error in parsed.errors.iter().flatten() {
|
for error in parsed.errors.iter() {
|
||||||
if error.severity == "error" {
|
if error.severity == "error" {
|
||||||
tracing::error!(
|
tracing::error!(
|
||||||
?error,
|
?error,
|
||||||
@@ -240,12 +281,12 @@ impl SolidityCompiler for Resolc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let Some(contracts) = parsed.contracts else {
|
if parsed.contracts.is_empty() {
|
||||||
anyhow::bail!("Unexpected error - resolc output doesn't have a contracts section");
|
anyhow::bail!("Unexpected error - resolc output doesn't have a contracts section");
|
||||||
};
|
}
|
||||||
|
|
||||||
let mut compiler_output = CompilerOutput::default();
|
let mut compiler_output = CompilerOutput::default();
|
||||||
for (source_path, contracts) in contracts.into_iter() {
|
for (source_path, contracts) in parsed.contracts.into_iter() {
|
||||||
let src_for_msg = source_path.clone();
|
let src_for_msg = source_path.clone();
|
||||||
let source_path = PathBuf::from(source_path)
|
let source_path = PathBuf::from(source_path)
|
||||||
.canonicalize()
|
.canonicalize()
|
||||||
@@ -258,10 +299,11 @@ impl SolidityCompiler for Resolc {
|
|||||||
.and_then(|evm| evm.bytecode.clone())
|
.and_then(|evm| evm.bytecode.clone())
|
||||||
.context("Unexpected - Contract compiled with resolc has no bytecode")?;
|
.context("Unexpected - Contract compiled with resolc has no bytecode")?;
|
||||||
let abi = {
|
let abi = {
|
||||||
let metadata = contract_information
|
let metadata = &contract_information.metadata;
|
||||||
.metadata
|
if metadata.is_null() {
|
||||||
.as_ref()
|
anyhow::bail!("No metadata found for the contract");
|
||||||
.context("No metadata found for the contract")?;
|
}
|
||||||
|
|
||||||
let solc_metadata_str = match metadata {
|
let solc_metadata_str = match metadata {
|
||||||
serde_json::Value::String(solc_metadata_str) => {
|
serde_json::Value::String(solc_metadata_str) => {
|
||||||
solc_metadata_str.as_str()
|
solc_metadata_str.as_str()
|
||||||
|
|||||||
@@ -800,6 +800,17 @@ pub struct ResolcConfiguration {
|
|||||||
/// provided in the user's $PATH.
|
/// provided in the user's $PATH.
|
||||||
#[clap(id = "resolc.path", long = "resolc.path", default_value = "resolc")]
|
#[clap(id = "resolc.path", long = "resolc.path", default_value = "resolc")]
|
||||||
pub path: PathBuf,
|
pub path: PathBuf,
|
||||||
|
|
||||||
|
/// Specifies the PVM heap size in bytes.
|
||||||
|
///
|
||||||
|
/// If unspecified, the revive compiler default is used
|
||||||
|
#[clap(id = "resolc.heap-size", long = "resolc.heap-size")]
|
||||||
|
pub heap_size: Option<u32>,
|
||||||
|
/// Specifies the PVM stack size in bytes.
|
||||||
|
///
|
||||||
|
/// If unspecified, the revive compiler default is used
|
||||||
|
#[clap(id = "resolc.stack-size", long = "resolc.stack-size")]
|
||||||
|
pub stack_size: Option<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A set of configuration parameters for Polkadot Parachain.
|
/// A set of configuration parameters for Polkadot Parachain.
|
||||||
@@ -943,13 +954,12 @@ pub struct PolkadotOmnichainNodeConfiguration {
|
|||||||
)]
|
)]
|
||||||
pub block_time: Duration,
|
pub block_time: Duration,
|
||||||
|
|
||||||
/// The path of the WASM runtime to use for the polkadot-omni-node. This argument is required if
|
/// The path of the chainspec of the chain that we're spawning
|
||||||
/// the polkadot-omni-node is one of the selected platforms for running the tests or benchmarks.
|
|
||||||
#[clap(
|
#[clap(
|
||||||
id = "polkadot-omni-node.runtime-wasm-path",
|
id = "polkadot-omni-node.chain-spec-path",
|
||||||
long = "polkadot-omni-node.runtime-wasm-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 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.
|
/// the polkadot-omni-node is one of the selected platforms for running the tests or benchmarks.
|
||||||
|
|||||||
+2
-10
@@ -486,13 +486,9 @@ impl Platform for PolkadotOmniNodePolkavmResolcPlatform {
|
|||||||
let wallet = AsRef::<WalletConfiguration>::as_ref(&context).wallet();
|
let wallet = AsRef::<WalletConfiguration>::as_ref(&context).wallet();
|
||||||
|
|
||||||
PolkadotOmnichainNode::node_genesis(
|
PolkadotOmnichainNode::node_genesis(
|
||||||
&polkadot_omnichain_node_configuration.path,
|
|
||||||
&wallet,
|
&wallet,
|
||||||
polkadot_omnichain_node_configuration
|
polkadot_omnichain_node_configuration
|
||||||
.parachain_id
|
.chain_spec_path
|
||||||
.context("No parachain id found in the configuration of the polkadot-omni-node")?,
|
|
||||||
polkadot_omnichain_node_configuration
|
|
||||||
.runtime_wasm_path
|
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.context("No WASM runtime path found in the polkadot-omni-node configuration")?,
|
.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();
|
let wallet = AsRef::<WalletConfiguration>::as_ref(&context).wallet();
|
||||||
|
|
||||||
PolkadotOmnichainNode::node_genesis(
|
PolkadotOmnichainNode::node_genesis(
|
||||||
&polkadot_omnichain_node_configuration.path,
|
|
||||||
&wallet,
|
&wallet,
|
||||||
polkadot_omnichain_node_configuration
|
polkadot_omnichain_node_configuration
|
||||||
.parachain_id
|
.chain_spec_path
|
||||||
.context("No parachain id found in the configuration of the polkadot-omni-node")?,
|
|
||||||
polkadot_omnichain_node_configuration
|
|
||||||
.runtime_wasm_path
|
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.context("No WASM runtime path found in the polkadot-omni-node configuration")?,
|
.context("No WASM runtime path found in the polkadot-omni-node configuration")?,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ serde_yaml_ng = { workspace = true }
|
|||||||
sp-core = { workspace = true }
|
sp-core = { workspace = true }
|
||||||
sp-runtime = { workspace = true }
|
sp-runtime = { workspace = true }
|
||||||
subxt = { workspace = true }
|
subxt = { workspace = true }
|
||||||
temp-dir = { workspace = true }
|
|
||||||
zombienet-sdk = { workspace = true }
|
zombienet-sdk = { workspace = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ use revive_dt_report::{
|
|||||||
EthereumMinedBlockInformation, MinedBlockInformation, SubstrateMinedBlockInformation,
|
EthereumMinedBlockInformation, MinedBlockInformation, SubstrateMinedBlockInformation,
|
||||||
};
|
};
|
||||||
use subxt::{OnlineClient, SubstrateConfig};
|
use subxt::{OnlineClient, SubstrateConfig};
|
||||||
use temp_dir::TempDir;
|
|
||||||
use tokio::sync::OnceCell;
|
use tokio::sync::OnceCell;
|
||||||
use tracing::{instrument, trace};
|
use tracing::{instrument, trace};
|
||||||
|
|
||||||
@@ -70,7 +69,7 @@ pub struct PolkadotOmnichainNode {
|
|||||||
/// The path of the eth-rpc binary.
|
/// The path of the eth-rpc binary.
|
||||||
eth_rpc_binary_path: PathBuf,
|
eth_rpc_binary_path: PathBuf,
|
||||||
/// The path of the runtime's WASM that this node will be spawned with.
|
/// 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.
|
/// The path of the base directory which contains all of the stored data for this node.
|
||||||
base_directory_path: PathBuf,
|
base_directory_path: PathBuf,
|
||||||
/// The path of the logs directory which contains all of the stored logs.
|
/// The path of the logs directory which contains all of the stored logs.
|
||||||
@@ -144,8 +143,8 @@ impl PolkadotOmnichainNode {
|
|||||||
.path
|
.path
|
||||||
.to_path_buf(),
|
.to_path_buf(),
|
||||||
eth_rpc_binary_path: eth_rpc_path.to_path_buf(),
|
eth_rpc_binary_path: eth_rpc_path.to_path_buf(),
|
||||||
runtime_wasm_path: polkadot_omnichain_node_configuration
|
chain_spec_path: polkadot_omnichain_node_configuration
|
||||||
.runtime_wasm_path
|
.chain_spec_path
|
||||||
.clone(),
|
.clone(),
|
||||||
base_directory_path: base_directory,
|
base_directory_path: base_directory,
|
||||||
logs_directory_path: logs_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 template_chainspec_path = self.base_directory_path.join(Self::CHAIN_SPEC_JSON_FILE);
|
||||||
|
|
||||||
let chainspec_json = Self::node_genesis(
|
let chainspec_json = Self::node_genesis(
|
||||||
&self.polkadot_omnichain_node_binary_path,
|
|
||||||
&self.wallet,
|
&self.wallet,
|
||||||
self.parachain_id.context("No parachain id provided")?,
|
self.chain_spec_path
|
||||||
self.runtime_wasm_path
|
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.context("No runtime path provided")?,
|
.context("No runtime path provided")?,
|
||||||
)
|
)
|
||||||
@@ -199,7 +196,7 @@ impl PolkadotOmnichainNode {
|
|||||||
fn spawn_process(&mut self) -> anyhow::Result<()> {
|
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
|
// Error out if the runtime's path or the parachain id are not set which means that the
|
||||||
// arguments we require were not provided.
|
// arguments we require were not provided.
|
||||||
self.runtime_wasm_path
|
self.chain_spec_path
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.context("No WASM path provided for the runtime")?;
|
.context("No WASM path provided for the runtime")?;
|
||||||
self.parachain_id
|
self.parachain_id
|
||||||
@@ -358,40 +355,11 @@ impl PolkadotOmnichainNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn node_genesis(
|
pub fn node_genesis(
|
||||||
node_path: &Path,
|
|
||||||
wallet: &EthereumWallet,
|
wallet: &EthereumWallet,
|
||||||
parachain_id: usize,
|
chain_spec_path: &Path,
|
||||||
runtime_wasm_path: &Path,
|
|
||||||
) -> anyhow::Result<serde_json::Value> {
|
) -> anyhow::Result<serde_json::Value> {
|
||||||
let tempdir = TempDir::new().context("Failed to create a temporary directory")?;
|
let unmodified_chainspec_file =
|
||||||
let unmodified_chainspec_path = tempdir.path().join("chainspec.json");
|
File::open(chain_spec_path).context("Failed to open the unmodified chainspec file")?;
|
||||||
|
|
||||||
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 mut chainspec_json =
|
let mut chainspec_json =
|
||||||
serde_json::from_reader::<_, serde_json::Value>(&unmodified_chainspec_file)
|
serde_json::from_reader::<_, serde_json::Value>(&unmodified_chainspec_file)
|
||||||
.context("Failed to read the unmodified chainspec JSON")?;
|
.context("Failed to read the unmodified chainspec JSON")?;
|
||||||
|
|||||||
Reference in New Issue
Block a user