Prathamesh Musale
47cc5ed527
Part of [Create a public laconicd testnet](https://www.notion.so/Create-a-public-laconicd-testnet-896a11bdd8094eff8f1b49c0be0ca3b8) and [Create bridge channel in go-nitro](https://www.notion.so/Create-bridge-channel-in-go-nitro-22ce80a0d8ae4edb80020a8f250ea270) Reviewed-on: #1 Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com> Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
79 lines
2.0 KiB
Bash
Executable File
79 lines
2.0 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
|
set -x
|
|
fi
|
|
|
|
echo "Using the following env:"
|
|
echo "CERC_NETWORK: ${CERC_NETWORK}"
|
|
echo "CERC_ALLOW_UNPROTECTED_TXS: ${CERC_ALLOW_UNPROTECTED_TXS}"
|
|
echo "CERC_SYNCMODE: ${CERC_SYNCMODE}"
|
|
echo "CERC_GCMODE: ${CERC_GCMODE}"
|
|
echo "CERC_GETH_VERBOSITY: ${CERC_GETH_VERBOSITY}"
|
|
echo "ETH_DATADIR: ${ETH_DATADIR}"
|
|
|
|
# See https://linuxconfig.org/how-to-propagate-a-signal-to-child-processes-from-a-bash-script
|
|
cleanup() {
|
|
echo "Signal received, cleaning up..."
|
|
|
|
# Kill the child process first (CERC_REMOTE_DEBUG=true uses dlv which starts geth as a child process)
|
|
pkill -P ${geth_pid}
|
|
sleep 2
|
|
kill $(jobs -p)
|
|
|
|
wait
|
|
echo "Done"
|
|
}
|
|
trap 'cleanup' SIGINT SIGTERM
|
|
|
|
# Wait for the JWT secret to be generated
|
|
jwtsecret_file_path=/root/secrets/jwtsecret
|
|
retry_interval=3
|
|
while [ ! -f "$jwtsecret_file_path" ]; do
|
|
echo "JWT secret not found, retrying after ${retry_interval}s..."
|
|
sleep $retry_interval
|
|
done
|
|
|
|
echo "JWT secret found at $jwtsecret_file_path"
|
|
|
|
NETWORK_OPT=""
|
|
if [ "$CERC_NETWORK" = "sepolia" ] || [ "$CERC_NETWORK" = "holesky" ] || [ "$CERC_NETWORK" = "mainnet" ]; then
|
|
NETWORK_OPT="--${CERC_NETWORK}"
|
|
else
|
|
NETWORK_OPT="--networkid ${CERC_NETWORK}"
|
|
fi
|
|
|
|
OTHER_OPTS=""
|
|
if [ "$CERC_ALLOW_UNPROTECTED_TXS" == "true" ]; then
|
|
# Allow for unprotected (non EIP155) txs to be submitted via RPC
|
|
OTHER_OPTS="--rpc.allow-unprotected-txs"
|
|
fi
|
|
|
|
geth \
|
|
${NETWORK_OPT} \
|
|
--datadir="${ETH_DATADIR}" \
|
|
--authrpc.addr="0.0.0.0" \
|
|
--authrpc.vhosts="*" \
|
|
--authrpc.jwtsecret="$jwtsecret_file_path" \
|
|
--http \
|
|
--http.addr="0.0.0.0" \
|
|
--http.vhosts="*" \
|
|
--http.api="eth,web3,net,admin,personal,debug" \
|
|
--http.corsdomain="*" \
|
|
--ws \
|
|
--ws.addr="0.0.0.0" \
|
|
--ws.origins="*" \
|
|
--ws.api="eth,web3,net,admin,personal,debug" \
|
|
--state.scheme hash \
|
|
--gcmode $CERC_GCMODE \
|
|
--syncmode=$CERC_SYNCMODE \
|
|
--metrics \
|
|
--metrics.addr="0.0.0.0" \
|
|
--verbosity=${CERC_GETH_VERBOSITY} \
|
|
${OTHER_OPTS} \
|
|
&
|
|
|
|
geth_pid=$!
|
|
wait $geth_pid
|