mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-06-12 17:01:06 +00:00
Revert the use of subprocess
This commit is contained in:
Generated
-11
@@ -4002,7 +4002,6 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"sp-core",
|
"sp-core",
|
||||||
"sp-runtime",
|
"sp-runtime",
|
||||||
"subprocess",
|
|
||||||
"temp-dir",
|
"temp-dir",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
@@ -5044,16 +5043,6 @@ dependencies = [
|
|||||||
"syn 2.0.101",
|
"syn 2.0.101",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "subprocess"
|
|
||||||
version = "0.2.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0c2e86926081dda636c546d8c5e641661049d7562a68f5488be4a1f7f66f6086"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "substrate-bip39"
|
name = "substrate-bip39"
|
||||||
version = "0.6.0"
|
version = "0.6.0"
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ tracing-subscriber = { version = "0.3.19", default-features = false, features =
|
|||||||
"json",
|
"json",
|
||||||
"env-filter",
|
"env-filter",
|
||||||
] }
|
] }
|
||||||
subprocess = { version = "0.2.9" }
|
|
||||||
|
|
||||||
# revive compiler
|
# revive compiler
|
||||||
revive-solc-json-interface = { git = "https://github.com/paritytech/revive", rev = "3389865af7c3ff6f29a586d82157e8bc573c1a8e" }
|
revive-solc-json-interface = { git = "https://github.com/paritytech/revive", rev = "3389865af7c3ff6f29a586d82157e8bc573c1a8e" }
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ rust-version.workspace = true
|
|||||||
anyhow = { workspace = true }
|
anyhow = { workspace = true }
|
||||||
alloy = { workspace = true }
|
alloy = { workspace = true }
|
||||||
tracing = { workspace = true }
|
tracing = { workspace = true }
|
||||||
subprocess = { workspace = true }
|
|
||||||
tokio = { workspace = true }
|
tokio = { workspace = true }
|
||||||
|
|
||||||
revive-dt-node-interaction = { workspace = true }
|
revive-dt-node-interaction = { workspace = true }
|
||||||
|
|||||||
+7
-11
@@ -5,7 +5,7 @@ use std::{
|
|||||||
fs::{File, OpenOptions, create_dir_all, remove_dir_all},
|
fs::{File, OpenOptions, create_dir_all, remove_dir_all},
|
||||||
io::{BufRead, BufReader, Read, Write},
|
io::{BufRead, BufReader, Read, Write},
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
process::{Command, Stdio},
|
process::{Child, Command, Stdio},
|
||||||
sync::{
|
sync::{
|
||||||
Mutex,
|
Mutex,
|
||||||
atomic::{AtomicU32, Ordering},
|
atomic::{AtomicU32, Ordering},
|
||||||
@@ -27,7 +27,6 @@ use revive_dt_node_interaction::{
|
|||||||
EthereumNode, nonce::fetch_onchain_nonce, trace::trace_transaction,
|
EthereumNode, nonce::fetch_onchain_nonce, trace::trace_transaction,
|
||||||
transaction::execute_transaction,
|
transaction::execute_transaction,
|
||||||
};
|
};
|
||||||
use subprocess::{Exec, Popen};
|
|
||||||
use tracing::Level;
|
use tracing::Level;
|
||||||
|
|
||||||
use crate::Node;
|
use crate::Node;
|
||||||
@@ -49,7 +48,7 @@ pub struct Instance {
|
|||||||
logs_directory: PathBuf,
|
logs_directory: PathBuf,
|
||||||
geth: PathBuf,
|
geth: PathBuf,
|
||||||
id: u32,
|
id: u32,
|
||||||
handle: Option<Popen>,
|
handle: Option<Child>,
|
||||||
network_id: u64,
|
network_id: u64,
|
||||||
start_timeout: u64,
|
start_timeout: u64,
|
||||||
wallet: EthereumWallet,
|
wallet: EthereumWallet,
|
||||||
@@ -122,7 +121,7 @@ impl Instance {
|
|||||||
.clone()
|
.clone()
|
||||||
.open(self.geth_stdout_log_file_path())?;
|
.open(self.geth_stdout_log_file_path())?;
|
||||||
let stderr_logs_file = open_options.open(self.geth_stderr_log_file_path())?;
|
let stderr_logs_file = open_options.open(self.geth_stderr_log_file_path())?;
|
||||||
self.handle = Exec::cmd(&self.geth)
|
self.handle = Command::new(&self.geth)
|
||||||
.arg("--dev")
|
.arg("--dev")
|
||||||
.arg("--datadir")
|
.arg("--datadir")
|
||||||
.arg(&self.data_directory)
|
.arg(&self.data_directory)
|
||||||
@@ -135,7 +134,7 @@ impl Instance {
|
|||||||
.arg("0")
|
.arg("0")
|
||||||
.stderr(stderr_logs_file)
|
.stderr(stderr_logs_file)
|
||||||
.stdout(stdout_logs_file)
|
.stdout(stdout_logs_file)
|
||||||
.popen()?
|
.spawn()?
|
||||||
.into();
|
.into();
|
||||||
|
|
||||||
if let Err(error) = self.wait_ready() {
|
if let Err(error) = self.wait_ready() {
|
||||||
@@ -362,12 +361,9 @@ impl Node for Instance {
|
|||||||
fn shutdown(&mut self) -> anyhow::Result<()> {
|
fn shutdown(&mut self) -> anyhow::Result<()> {
|
||||||
// Terminate the processes in a graceful manner to allow for the output to be flushed.
|
// Terminate the processes in a graceful manner to allow for the output to be flushed.
|
||||||
if let Some(mut child) = self.handle.take() {
|
if let Some(mut child) = self.handle.take() {
|
||||||
child.terminate().map_err(|error| {
|
child
|
||||||
anyhow::anyhow!("Failed to terminate the geth process: {error:?}")
|
.kill()
|
||||||
})?;
|
.map_err(|error| anyhow::anyhow!("Failed to kill the geth process: {error:?}"))?;
|
||||||
child.wait().map_err(|error| {
|
|
||||||
anyhow::anyhow!("Failed to wait for the termination of the geth process: {error:?}")
|
|
||||||
})?;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the node's database so that subsequent runs do not run on the same database. We
|
// Remove the node's database so that subsequent runs do not run on the same database. We
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ use std::{
|
|||||||
fs::{OpenOptions, create_dir_all, remove_dir_all},
|
fs::{OpenOptions, create_dir_all, remove_dir_all},
|
||||||
io::BufRead,
|
io::BufRead,
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
process::{Command, Stdio},
|
process::{Child, Command, Stdio},
|
||||||
sync::{
|
sync::{
|
||||||
Mutex,
|
Mutex,
|
||||||
atomic::{AtomicU32, Ordering},
|
atomic::{AtomicU32, Ordering},
|
||||||
@@ -30,7 +30,6 @@ use serde::{Deserialize, Serialize};
|
|||||||
use serde_json::{Value as JsonValue, json};
|
use serde_json::{Value as JsonValue, json};
|
||||||
use sp_core::crypto::Ss58Codec;
|
use sp_core::crypto::Ss58Codec;
|
||||||
use sp_runtime::AccountId32;
|
use sp_runtime::AccountId32;
|
||||||
use subprocess::{Exec, Popen};
|
|
||||||
use tracing::Level;
|
use tracing::Level;
|
||||||
|
|
||||||
use revive_dt_config::Arguments;
|
use revive_dt_config::Arguments;
|
||||||
@@ -52,8 +51,8 @@ pub struct KitchensinkNode {
|
|||||||
wallet: EthereumWallet,
|
wallet: EthereumWallet,
|
||||||
base_directory: PathBuf,
|
base_directory: PathBuf,
|
||||||
logs_directory: PathBuf,
|
logs_directory: PathBuf,
|
||||||
process_substrate: Option<Popen>,
|
process_substrate: Option<Child>,
|
||||||
process_proxy: Option<Popen>,
|
process_proxy: Option<Child>,
|
||||||
nonces: Mutex<HashMap<Address, u64>>,
|
nonces: Mutex<HashMap<Address, u64>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +159,7 @@ impl KitchensinkNode {
|
|||||||
let stderr_logs_file = open_options
|
let stderr_logs_file = open_options
|
||||||
.clone()
|
.clone()
|
||||||
.open(self.kitchensink_stderr_log_file_path())?;
|
.open(self.kitchensink_stderr_log_file_path())?;
|
||||||
self.process_substrate = Exec::cmd(&self.substrate_binary)
|
self.process_substrate = Command::new(&self.substrate_binary)
|
||||||
.arg("--chain")
|
.arg("--chain")
|
||||||
.arg(chainspec_path)
|
.arg(chainspec_path)
|
||||||
.arg("--base-path")
|
.arg("--base-path")
|
||||||
@@ -177,7 +176,7 @@ impl KitchensinkNode {
|
|||||||
.env("RUST_LOG", Self::SUBSTRATE_LOG_ENV)
|
.env("RUST_LOG", Self::SUBSTRATE_LOG_ENV)
|
||||||
.stdout(stdout_logs_file)
|
.stdout(stdout_logs_file)
|
||||||
.stderr(stderr_logs_file)
|
.stderr(stderr_logs_file)
|
||||||
.popen()?
|
.spawn()?
|
||||||
.into();
|
.into();
|
||||||
|
|
||||||
// Give the node a moment to boot
|
// Give the node a moment to boot
|
||||||
@@ -198,7 +197,7 @@ impl KitchensinkNode {
|
|||||||
.clone()
|
.clone()
|
||||||
.open(self.proxy_stdout_log_file_path())?;
|
.open(self.proxy_stdout_log_file_path())?;
|
||||||
let stderr_logs_file = open_options.open(self.proxy_stderr_log_file_path())?;
|
let stderr_logs_file = open_options.open(self.proxy_stderr_log_file_path())?;
|
||||||
self.process_proxy = Exec::cmd(&self.eth_proxy_binary)
|
self.process_proxy = Command::new(&self.eth_proxy_binary)
|
||||||
.arg("--dev")
|
.arg("--dev")
|
||||||
.arg("--rpc-port")
|
.arg("--rpc-port")
|
||||||
.arg(proxy_rpc_port.to_string())
|
.arg(proxy_rpc_port.to_string())
|
||||||
@@ -211,7 +210,7 @@ impl KitchensinkNode {
|
|||||||
// don't have to worry about either streams overriding each other.
|
// don't have to worry about either streams overriding each other.
|
||||||
.stdout(stdout_logs_file)
|
.stdout(stdout_logs_file)
|
||||||
.stderr(stderr_logs_file)
|
.stderr(stderr_logs_file)
|
||||||
.popen()?
|
.spawn()?
|
||||||
.into();
|
.into();
|
||||||
|
|
||||||
if let Err(error) = Self::wait_ready(
|
if let Err(error) = Self::wait_ready(
|
||||||
@@ -434,23 +433,13 @@ impl Node for KitchensinkNode {
|
|||||||
fn shutdown(&mut self) -> anyhow::Result<()> {
|
fn shutdown(&mut self) -> anyhow::Result<()> {
|
||||||
// Terminate the processes in a graceful manner to allow for the output to be flushed.
|
// Terminate the processes in a graceful manner to allow for the output to be flushed.
|
||||||
if let Some(mut child) = self.process_proxy.take() {
|
if let Some(mut child) = self.process_proxy.take() {
|
||||||
child.terminate().map_err(|error| {
|
child
|
||||||
anyhow::anyhow!("Failed to terminate the proxy process: {error:?}")
|
.kill()
|
||||||
})?;
|
.map_err(|error| anyhow::anyhow!("Failed to kill the proxy process: {error:?}"))?;
|
||||||
child.wait().map_err(|error| {
|
|
||||||
anyhow::anyhow!(
|
|
||||||
"Failed to wait for the termination of the proxy process: {error:?}"
|
|
||||||
)
|
|
||||||
})?;
|
|
||||||
}
|
}
|
||||||
if let Some(mut child) = self.process_substrate.take() {
|
if let Some(mut child) = self.process_substrate.take() {
|
||||||
child.terminate().map_err(|error| {
|
child.kill().map_err(|error| {
|
||||||
anyhow::anyhow!("Failed to terminate the substrate process: {error:?}")
|
anyhow::anyhow!("Failed to kill the substrate process: {error:?}")
|
||||||
})?;
|
|
||||||
child.wait().map_err(|error| {
|
|
||||||
anyhow::anyhow!(
|
|
||||||
"Failed to wait for the termination of the substrate process: {error:?}"
|
|
||||||
)
|
|
||||||
})?;
|
})?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user