-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
1,019 additions
and
388 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,6 +73,7 @@ | |
celestia-node | ||
celestia-app | ||
monza-aptos | ||
jq | ||
]; | ||
|
||
# Specific version of toolchain | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
profiles: | ||
default: | ||
private_key: "0xfbc0596f14bd008b20269a52e22311842453ccd3dd64575bc656dc8e755244b7" | ||
public_key: "0xbe11803a40d33723d0a294cb657dd2477af4c31cae019f1e4bd783084033d1f6" | ||
account: 00da3c48fe5d426966ae33945eff05cdbc5fb9a986c92d26a9d7665d99efdeff | ||
rest_url: "http://0.0.0.0:30731/" | ||
faucet_url: "http://0.0.0.0:30733/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
networks/suzuka/suzuka-client/src/tests/complex-alice/deploy.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
|
||
# Initializes an account if keys are not present | ||
initialize_output=$(echo -ne '\n' | aptos init --network custom --rest-url $NODE_URL --faucet-url $FAUCET_URL --assume-yes) | ||
echo "$initialize_output" | ||
|
||
aptos move test --package-dir src/tests/complex-alice --named-addresses resource_roulette=default | ||
|
||
aptos move compile --package-dir src/tests/complex-alice --named-addresses resource_roulette=default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
process-compose/suzuka-full-node/process-compose.complex-alice.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: "3" | ||
|
||
environment: | ||
|
||
processes: | ||
|
||
complex-alice-tests: | ||
command: | | ||
cargo test -p suzuka-client test_complex_alice | ||
depends_on: | ||
suzuka-full-node: | ||
condition: process_healthy | ||
suzuka-faucet: | ||
condition: process_healthy | ||
availability: | ||
exit_on_end: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[package] | ||
name = "commander" | ||
version = { workspace = true } | ||
edition = { workspace = true } | ||
license = { workspace = true } | ||
authors = { workspace = true } | ||
repository = { workspace = true } | ||
homepage = { workspace = true } | ||
publish = { workspace = true } | ||
rust-version = { workspace = true } | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
anyhow = { workspace = true } | ||
tokio = { workspace = true } | ||
futures = { workspace = true } | ||
tracing = { workspace = true } | ||
|
||
[lints] | ||
workspace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
use tokio::process::Command; | ||
use std::process::Stdio; | ||
use tokio::io::{self, AsyncBufReadExt, AsyncWriteExt, BufReader}; | ||
use anyhow::Result; | ||
use futures::future::try_join; | ||
|
||
async fn pipe_output<R: tokio::io::AsyncRead + Unpin + Send + 'static>( | ||
reader: R, | ||
mut writer: io::Stdout, | ||
output: &mut String, | ||
) -> Result<()> { | ||
let mut reader = BufReader::new(reader).lines(); | ||
while let Ok(Some(line)) = reader.next_line().await { | ||
writer.write_all(line.as_bytes()).await?; | ||
writer.write_all(b"\n").await?; | ||
output.push_str(&line); | ||
output.push('\n'); | ||
} | ||
Ok(()) | ||
} | ||
|
||
async fn pipe_error_output<R: tokio::io::AsyncRead + Unpin + Send + 'static>( | ||
reader: R, | ||
mut writer: io::Stderr, | ||
output: &mut String, | ||
) -> Result<()> { | ||
let mut reader = BufReader::new(reader).lines(); | ||
while let Ok(Some(line)) = reader.next_line().await { | ||
writer.write_all(line.as_bytes()).await?; | ||
writer.write_all(b"\n").await?; | ||
output.push_str(&line); | ||
output.push('\n'); | ||
} | ||
Ok(()) | ||
} | ||
|
||
/// Runs a command, piping its output to stdout and stderr, and returns the stdout output if successful. | ||
pub async fn run_command(command: &str, args: &[&str]) -> Result<String> { | ||
|
||
// print command out with args joined by space | ||
println!("Running command: {} {}", command, args.join(" ")); | ||
|
||
let mut child = Command::new(command) | ||
.args(args) | ||
.stdout(Stdio::piped()) | ||
.stderr(Stdio::piped()) | ||
.spawn()?; | ||
|
||
let stdout = child.stdout.take().ok_or_else(|| { | ||
anyhow::anyhow!("Failed to capture standard output from command {}", command) | ||
})?; | ||
let stderr = child.stderr.take().ok_or_else(|| { | ||
anyhow::anyhow!("Failed to capture standard error from command {}", command) | ||
})?; | ||
|
||
let mut stdout_output = String::new(); | ||
let mut stderr_output = String::new(); | ||
|
||
let stdout_writer = io::stdout(); | ||
let stderr_writer = io::stderr(); | ||
|
||
let stdout_future = pipe_output(stdout, stdout_writer, &mut stdout_output); | ||
let stderr_future = pipe_error_output(stderr, stderr_writer, &mut stderr_output); | ||
|
||
let _ = try_join(stdout_future, stderr_future).await; | ||
|
||
let status = child.wait().await?; | ||
if !status.success() { | ||
return Err(anyhow::anyhow!( | ||
"Command {} failed with args {:?}\nError Output: {}", | ||
command, | ||
args, | ||
stderr_output | ||
)); | ||
} | ||
|
||
Ok(stdout_output) | ||
} |