-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathstart_local_testnet.sh
More file actions
executable file
·97 lines (80 loc) · 3.54 KB
/
start_local_testnet.sh
File metadata and controls
executable file
·97 lines (80 loc) · 3.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/usr/bin/env bash
# Ported and modified from https://github.com/eth-act/lighthouse/blob/optional-proofs/scripts/local_testnet/start_local_testnet.sh
# Requires `docker`, `kurtosis`, `yq`
set -Eeuo pipefail
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
ENCLAVE_NAME=local-testnet
NETWORK_PARAMS_FILE=$SCRIPT_DIR/network_params.yaml
ETHEREUM_PKG_VERSION=main
BUILD_IMAGE=true
BUILDER_PROPOSALS=false
CI=false
KEEP_ENCLAVE=false
RUN_ASSERTOOR_TESTS=false
# Get options
while getopts "e:b:n:phcak" flag; do
case "${flag}" in
a) RUN_ASSERTOOR_TESTS=true;;
e) ENCLAVE_NAME=${OPTARG};;
b) BUILD_IMAGE=${OPTARG};;
n) NETWORK_PARAMS_FILE=${OPTARG};;
p) BUILDER_PROPOSALS=true;;
c) CI=true;;
k) KEEP_ENCLAVE=true;;
h)
echo "Start a local testnet with kurtosis."
echo
echo "usage: $0 <Options>"
echo
echo "Options:"
echo " -e: enclave name default: $ENCLAVE_NAME"
echo " -b: whether to build Lighthouse docker image default: $BUILD_IMAGE"
echo " -n: kurtosis network params file path default: $NETWORK_PARAMS_FILE"
echo " -p: enable builder proposals"
echo " -c: CI mode, run without other additional services like Grafana and Dora explorer"
echo " -a: run Assertoor tests"
echo " -k: keeping enclave to allow starting the testnet without destroying the existing one"
echo " -h: this help"
exit
;;
esac
done
LH_IMAGE_NAME=$(yq eval ".participants[0].cl_image" $NETWORK_PARAMS_FILE)
if ! command -v docker &> /dev/null; then
echo "Docker is not installed. Please install Docker and try again."
exit 1
fi
if ! command -v kurtosis &> /dev/null; then
echo "kurtosis command not found. Please install kurtosis and try again."
exit
fi
if ! command -v yq &> /dev/null; then
echo "yq not found. Please install yq and try again."
fi
if [ "$BUILDER_PROPOSALS" = true ]; then
yq eval '.participants[0].vc_extra_params = ["--builder-proposals"]' -i $NETWORK_PARAMS_FILE
echo "--builder-proposals VC flag added to network_params.yaml"
fi
if [ "$CI" = true ]; then
yq eval '.additional_services = []' -i $NETWORK_PARAMS_FILE
echo "Running without additional services (CI mode)."
fi
if [ "$RUN_ASSERTOOR_TESTS" = true ]; then
yq eval '.additional_services += ["assertoor"] | .additional_services |= unique' -i $NETWORK_PARAMS_FILE
# The available tests can be found in the `assertoor_params` section:
# https://github.com/ethpandaops/ethereum-package?tab=readme-ov-file#configuration
yq eval '.assertoor_params = {"run_stability_check": true, "run_block_proposal_check": true, "run_transaction_test": true, "run_blob_transaction_test": true}' -i $NETWORK_PARAMS_FILE
echo "Assertoor has been added to $NETWORK_PARAMS_FILE."
fi
if [ "$KEEP_ENCLAVE" = false ]; then
# Stop local testnet
kurtosis enclave rm -f $ENCLAVE_NAME 2>/dev/null || true
fi
kurtosis run --enclave $ENCLAVE_NAME github.com/ethpandaops/ethereum-package@$ETHEREUM_PKG_VERSION --args-file $NETWORK_PARAMS_FILE
# Extract the EL container name and generate the zkboost config file.
EL_NAME=el-1-reth-lighthouse
EL_UUID=$(kurtosis enclave inspect "$ENCLAVE_NAME" --full-uuids | grep "$EL_NAME" | awk '{print $1}')
EL_ENDPOINT="http://$EL_NAME--$EL_UUID:8545"
sed "s|^el_endpoint =.*|el_endpoint = \"$EL_ENDPOINT\"|" "$SCRIPT_DIR/zkboost/config.toml.tmpl" > "$SCRIPT_DIR/zkboost/config.toml"
echo "Generated zkboost/config.toml with EL endpoint: $EL_ENDPOINT"
echo "Started!"