Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions scripts/run_native_testnet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/bin/bash

: '
This script sets up and runs a native testnet for the Aztec network.

Steps:
1. Parse command-line arguments for custom test script and number of validators.
2. Set up the base command for running the native network test, including:
- Running the specified test script
- Deploying L1 and L2 contracts
- Starting the boot node
- Setting up the Ethereum environment
- Starting the prover node
- Starting the PXE
- Starting the transaction bot
3. Dynamically generate commands for the specified number of validators,
each with an incrementing port number starting from 8081.
4. Execute the complete command to start the testnet.

Usage:
./run_native_testnet.sh [options]

Options:
-h: Display help message
-t: Specify a custom test script (default: ./test-transfer.sh)
-v: Specify the number of validators (default: 3)
'

# Function to display help message
display_help() {
echo "Usage: $0 [options]"
echo
echo "Options:"
echo " -h Display this help message"
echo " -t Specify the test script file (default: ./test-transfer.sh)"
echo " -v Specify the number of validators (default: 3)"
echo
echo "Example:"
echo " $0 -t ./custom-test.sh -v 5"
}

# Default values
TEST_SCRIPT="./test-transfer.sh"
NUM_VALIDATORS=3

# Parse command line arguments
while getopts "ht:v:" opt; do
case $opt in
h)
display_help
exit 0
;;
t) TEST_SCRIPT="$OPTARG"
;;
v) NUM_VALIDATORS="$OPTARG"
;;
\?) echo "Invalid option -$OPTARG" >&2
display_help
exit 1
;;
esac
done

# Base command
BASE_CMD="./yarn-project/end-to-end/scripts/native_network_test.sh \
$TEST_SCRIPT \
./deploy-l1-contracts.sh \
./deploy-l2-contracts.sh \
./boot-node.sh \
./ethereum.sh \
\"./prover-node.sh false\" \
./pxe.sh \
./transaction-bot.sh"

# Generate validator commands
for ((i=0; i<NUM_VALIDATORS; i++))
do
PORT=$((8081 + i))
BASE_CMD+=" \"./validator.sh $PORT\""
done

# Execute the command
eval $BASE_CMD
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ echo "Done waiting."

# Run the deploy-l1-contracts command and capture the output
export ETHEREUM_HOST="http://127.0.0.1:8545"
output=$(node --no-warnings $(git rev-parse --show-toplevel)/yarn-project/aztec/dest/bin/index.js deploy-l1-contracts)
output=$(node --no-warnings $(git rev-parse --show-toplevel)/yarn-project/aztec/dest/bin/index.js deploy-l1-contracts --salt 1337)

echo "$output"

Expand All @@ -43,8 +43,3 @@ export FEE_JUICE_PORTAL_CONTRACT_ADDRESS=$FEE_JUICE_PORTAL_CONTRACT_ADDRESS
EOCONFIG

echo "Contract addresses saved to l1-contracts.env"
sleep 5
function close_tmux_pane() {
tmux kill-pane -t $(tmux display -p '#{pane_id}')
}
close_tmux_pane 2>/dev/null || true