Skip to content

Commit

Permalink
Use binaries instead of running through cargo
Browse files Browse the repository at this point in the history
  • Loading branch information
ryardley committed Dec 31, 2024
1 parent 3613b73 commit 373c83f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
4 changes: 2 additions & 2 deletions packages/ciphernode/ciphernode-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ if [ "$AGGREGATOR" = "true" ]; then
enclave wallet set --config "$CONFIG_FILE" --private-key "$PRIVATE_KEY"

echo "Starting aggregator"
exec enclave aggregator start --config "$CONFIG_FILE"
exec enclave aggregator start -v --config "$CONFIG_FILE"
else
echo "Starting Ciphernode"
exec enclave start --config "$CONFIG_FILE"
exec enclave start -v --config "$CONFIG_FILE"
fi


13 changes: 8 additions & 5 deletions packages/ciphernode/enclave/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,17 @@ pub struct Cli {
short,
long,
action = ArgAction::Count,
global = true
)]
pub verbose: u8,

/// Silence all output
/// Silence all output. This argument cannot be used alongside `-v`
#[arg(
short,
long,
action = ArgAction::SetTrue,
conflicts_with = "verbose"
conflicts_with = "verbose",
global = true
)]
quiet: bool,

Expand All @@ -51,9 +53,10 @@ impl Cli {
Level::ERROR
} else {
match self.verbose {
0 => Level::INFO, // Default is INFO
1 => Level::DEBUG, // -v
_ => Level::TRACE, // -vv
0 => Level::WARN, //
1 => Level::INFO, // -v
2 => Level::DEBUG, // -vv
_ => Level::TRACE, // -vvv
}
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/ciphernode/enclave/src/password_create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ fn get_zeroizing_pw_vec(input: Option<String>) -> Result<Zeroizing<Vec<u8>>> {
}

pub async fn execute(config: &AppConfig, input: Option<String>, overwrite: bool) -> Result<()> {
println!("Setting password...");
password_create::preflight(config, overwrite).await?;

let pw = get_zeroizing_pw_vec(input)?;
Expand Down
11 changes: 6 additions & 5 deletions tests/basic_integration/fns.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ NETWORK_PRIVATE_KEY_2="0x21a1e500a548b70d88184a1e042900c0ed6c57f8710bcc35dc8c85f
NETWORK_PRIVATE_KEY_3="0x31a1e500a548b70d88184a1e042900c0ed6c57f8710bcc35dc8c85fa33d3f580"
NETWORK_PRIVATE_KEY_4="0x41a1e500a548b70d88184a1e042900c0ed6c57f8710bcc35dc8c85fa33d3f580"

ENCLAVE_BIN=./packages/ciphernode/target/debug/enclave

# Function to clean up background processes
cleanup() {
Expand Down Expand Up @@ -87,15 +88,15 @@ waiton-files() {
set_password() {
local name="$1"
local password="$2"
yarn enclave password create \
$ENCLAVE_BIN password create \
--config "$SCRIPT_DIR/lib/$name/config.yaml" \
--password "$password"
}

launch_ciphernode() {
local name="$1"
heading "Launch ciphernode $name"
yarn enclave start \
$ENCLAVE_BIN start -v \
--tag "$name" \
--config "$SCRIPT_DIR/lib/$name/config.yaml" & echo $! > "/tmp/enclave.${ID}_${name}.pid"
}
Expand All @@ -104,7 +105,7 @@ set_private_key() {
local name="$1"
local private_key="$2"

yarn enclave wallet set \
$ENCLAVE_BIN wallet set \
--config "$SCRIPT_DIR/lib/$name/config.yaml" \
--private-key "$private_key"
}
Expand All @@ -113,7 +114,7 @@ set_network_private_key() {
local name="$1"
local private_key="$2"

yarn enclave net set-key \
$ENCLAVE_BIN net set-key \
--config "$SCRIPT_DIR/lib/$name/config.yaml" \
--net-keypair "$private_key"
}
Expand All @@ -122,7 +123,7 @@ launch_aggregator() {
local name="$1"
heading "Launch aggregator $name"

yarn enclave aggregator start \
$ENCLAVE_BIN aggregator start -v \
--tag "$name" \
--config "$SCRIPT_DIR/lib/$name/config.yaml" \
--pubkey-write-path "$SCRIPT_DIR/output/pubkey.bin" \
Expand Down
2 changes: 1 addition & 1 deletion tests/basic_integration/lib/fake_encrypt.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

cd packages/ciphernode && RUSTFLAGS="-A warnings" cargo run --bin fake_encrypt -- "$@"
./packages/ciphernode/target/debug/fake_encrypt "$@"
2 changes: 1 addition & 1 deletion tests/basic_integration/lib/prebuild.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env sh

cd packages/ciphernode && RUSTFLAGS="-A warnings" cargo build --bin fake_encrypt --bin enclave --bin pack_e3_params;
cd packages/ciphernode && RUSTFLAGS="-A warnings" cargo build --release --bin fake_encrypt --bin enclave --bin pack_e3_params;

0 comments on commit 373c83f

Please sign in to comment.