|
9 | 9 | read -p "Enter the total number of validators (default: 4): " total_validators |
10 | 10 | total_validators=${total_validators:-4} |
11 | 11 |
|
12 | | -# Read the total number of clients from the user or use a default value of 2 |
13 | | -read -p "Enter the total number of clients (default: 2): " total_clients |
14 | | -total_clients=${total_clients:-2} |
| 12 | +# Read the total number of clients from the user or use a default value of 0 |
| 13 | +read -p "Enter the total number of clients (default: 0): " total_clients |
| 14 | +total_clients=${total_clients:-0} |
15 | 15 |
|
16 | 16 | # Read the network ID from user or use a default value of 1 |
17 | 17 | read -p "Enter the network ID (mainnet = 0, testnet = 1, canary = 2) (default: 1): " network_id |
18 | 18 | network_id=${network_id:-1} |
19 | 19 |
|
20 | 20 | # Ask the user if they want to run 'cargo install --locked --path .' or use a pre-installed binary |
21 | | -read -p "Do you want to run 'cargo install --locked --path .' to build the binary? (y/n, default: y): " build_binary |
22 | | -build_binary=${build_binary:-y} |
| 21 | +read -p "Do you want to run build (b) or install (i) the binary? (b/i/n, default: b): " build_binary |
| 22 | +build_binary=${build_binary:-b} |
| 23 | + |
| 24 | +# Ask the user whether to use a custom relative path |
| 25 | +read -p "Do you want to run snarkos from a relative path? (default: ./target/debug/snarkos): " binary_path |
| 26 | +binary_path=${binary_path:-"./target/debug/snarkos"} |
23 | 27 |
|
24 | 28 | # Ask the user whether to clear the existing ledger history |
25 | | -read -p "Do you want to clear the existing ledger history? (y/n, default: n): " clear_ledger |
26 | | -clear_ledger=${clear_ledger:-n} |
| 29 | +read -p "Do you want to clear the existing ledger history? (y/n, default: y): " clear_ledger |
| 30 | +clear_ledger=${clear_ledger:-y} |
27 | 31 |
|
28 | 32 | # Log verbosity is set to 1 (DEBUG) by default. |
29 | 33 | verbosity=1 |
30 | 34 |
|
31 | 35 | # Binary path set to "" by default (using installed binary) |
32 | 36 | binary_path="" |
33 | 37 |
|
34 | | -if [[ $build_binary == "y" ]]; then |
| 38 | +# Build command set to "" by default |
| 39 | +build_cmd="" |
| 40 | + |
| 41 | +if [[ $build_binary != "n" ]]; then |
35 | 42 | # Ask the user for additional crate features (comma-separated) |
36 | 43 | read -p "Enter crate features to enable (comma separated, default: test_network,telemetry): " crate_features |
37 | 44 | crate_features=${crate_features:-test_network,telemetry} |
38 | 45 |
|
39 | | - # Build command |
40 | | - build_cmd="cargo install --locked --path ." |
| 46 | + if [[ $build_binary == "i" ]]; then |
| 47 | + # Build command |
| 48 | + build_cmd="cargo install --locked --path ." |
| 49 | + elif [[ $build_binary == "b" ]]; then |
| 50 | + # Build command |
| 51 | + build_cmd="cargo build" |
| 52 | + fi |
41 | 53 |
|
42 | 54 | # Add any extra features if provided |
43 | 55 | if [[ -n $crate_features ]]; then |
44 | 56 | build_cmd+=" --features ${crate_features}" |
45 | 57 | fi |
46 | | - |
47 | 58 | # Build command |
48 | 59 | echo "Running build command: \"$build_cmd\"" |
49 | 60 | eval "$build_cmd" || exit 1 |
50 | | -else |
51 | | - # Ask the user whether to use a custom relative path |
52 | | - read -p "Do you want to run snarkos from a relative path? (default: ./target/debug/snarkos): " binary_path |
53 | | - binary_path=${binary_path:-"./target/debug/snarkos"} |
54 | 61 | fi |
55 | 62 |
|
| 63 | + |
56 | 64 | # Clear the ledger logs for each validator if the user chooses to clear ledger |
57 | 65 | if [[ $clear_ledger == "y" ]]; then |
58 | 66 | # Create an array to store background processes |
|
0 commit comments