@@ -5,19 +5,10 @@ set -ex
55# The following are required script arguments.
66TMUX_WIN_ID=$1
77NAME=$2
8- NODE_PORT=$3
9- CHAIN_ADDRESS=$4
10- CHAIN_PASSWORD=$5
11- CHAIN_ADDRESS_JSON=$6
12- CHAIN_ADDRESS_JSON_FILE_NAME=$7
13- ADDRESS_JSON=$8
14- ADDRESS_JSON_FILE_NAME=$9
15- NODE_KEY=${10}
16- SYNC_MODE=${11}
17- AUTHRPC_PORT=${12}
18- HTTP_PORT=${13}
19- WS_PORT=${14}
20- WS_MODULES=${15}
8+ AUTHRPC_PORT=${3}
9+ HTTP_PORT=${4}
10+ WS_PORT=${5}
11+ WS_MODULES=${6}
2112
2213GROUP_DIR=" ${NODES_ROOT} /${NAME} "
2314MINE_JS=" ${GROUP_DIR} /mine.js"
@@ -33,10 +24,8 @@ geth --datadir="${NODE_DIR}" \$*
3324EOF
3425chmod +x " ${NODES_ROOT} /harness-ctl/${NAME} "
3526
36- # Write mine script if CHAIN_ADDRESS is present.
37- if [ " ${CHAIN_ADDRESS} " != " _" ]; then
38- # The mining script may end up mining more or less blocks than specified.
39- cat > " ${NODES_ROOT} /harness-ctl/mine-${NAME} " << EOF
27+ # The mining script may end up mining more or less blocks than specified.
28+ cat > " ${NODES_ROOT} /harness-ctl/mine-${NAME} " << EOF
4029#!/usr/bin/env bash
4130 NUM=2
4231 case \$ 1 in
@@ -60,17 +49,10 @@ if [ "${CHAIN_ADDRESS}" != "_" ]; then
6049EOF
6150 chmod +x " ${NODES_ROOT} /harness-ctl/mine-${NAME} "
6251
63- # Write password file to unlock accounts later.
64- cat > " ${GROUP_DIR} /password" << EOF
65- $CHAIN_PASSWORD
66- EOF
67-
68- fi
69-
7052cat > " ${NODE_DIR} /eth.conf" << EOF
7153[Eth]
7254NetworkId = 42
73- SyncMode = "${SYNC_MODE} "
55+ SyncMode = "snap "
7456
7557[Node]
7658DataDir = "${NODE_DIR} "
@@ -80,67 +62,22 @@ AuthPort = ${AUTHRPC_PORT}
8062NoDiscovery = true
8163BootstrapNodes = []
8264BootstrapNodesV5 = []
83- ListenAddr = ":${NODE_PORT} "
8465NetRestrict = [ "127.0.0.1/8", "::1/128" ]
85- EOF
86-
87- # Add etherbase if mining.
88- if [ " ${CHAIN_ADDRESS} " != " _" ]; then
89- cat >> " ${NODE_DIR} /eth.conf" << EOF
9066
9167[Eth.Miner]
92- Etherbase = "0x${CHAIN_ADDRESS} "
93- GasFloor = 30000000
9468GasCeil = 30000000
9569EOF
96- fi
9770
9871# Create a tmux window.
9972tmux new-window -t " $TMUX_WIN_ID " -n " ${NAME} " " ${SHELL} "
10073tmux send-keys -t " $TMUX_WIN_ID " " set +o history" C-m
10174tmux send-keys -t " $TMUX_WIN_ID " " cd ${NODE_DIR} " C-m
10275
103- # Create and wait for a node initiated with a predefined genesis json.
104- echo " Creating simnet ${NAME} node"
105- tmux send-keys -t " $TMUX_WIN_ID " " ${NODES_ROOT} /harness-ctl/${NAME} init " \
106- " $GENESIS_JSON_FILE_LOCATION ; tmux wait-for -S ${NAME} " C-m
107- tmux wait-for " ${NAME} "
108-
109- # Create two accounts. The first is used to mine blocks. The second contains
110- # funds.
111- if [ " ${CHAIN_ADDRESS} " != " _" ]; then
112- echo " Creating account"
113- cat > " ${NODE_DIR} /keystore/$CHAIN_ADDRESS_JSON_FILE_NAME " << EOF
114- $CHAIN_ADDRESS_JSON
115- EOF
116- fi
117-
118- cat > " ${NODE_DIR} /keystore/$ADDRESS_JSON_FILE_NAME " << EOF
119- $ADDRESS_JSON
120- EOF
121-
122- # The node key lets us control the enode address value.
123- echo " Setting node key"
124- cat > " ${NODE_DIR} /geth/nodekey" << EOF
125- $NODE_KEY
126- EOF
127-
12876echo " Starting simnet ${NAME} node"
129- if [ " ${SYNC_MODE} " = " snap" ]; then
130- # Start the eth node with the chain account unlocked, listening restricted to
131- # localhost, and our custom configuration file.
132- tmux send-keys -t " $TMUX_WIN_ID " " ${NODES_ROOT} /harness-ctl/${NAME} " \
133- " --config ${NODE_DIR} /eth.conf --unlock ${CHAIN_ADDRESS} " \
134- " --password ${GROUP_DIR} /password --light.serve 25 --datadir.ancient " \
135- " ${NODE_DIR} /geth-ancient --verbosity 5 --vmdebug --http --http.port " \
136- " ${HTTP_PORT} --ws --ws.port ${WS_PORT} --ws.api " \
137- " ${WS_MODULES} --allow-insecure-unlock --rpc.enabledeprecatedpersonal " \
138- " 2>&1 | tee ${NODE_DIR} /${NAME} .log" C-m
139-
140- else
141- # Start the eth node listening restricted to localhost and our custom
142- # configuration file.
143- tmux send-keys -t " $TMUX_WIN_ID " " ${NODES_ROOT} /harness-ctl/${NAME} --allow-insecure-unlock --rpc.enabledeprecatedpersonal " \
144- " --config ${NODE_DIR} /eth.conf --verbosity 5 ${HTTP_OPT} 2>&1 | tee " \
145- " ${NODE_DIR} /${NAME} .log" C-m
146- fi
77+ # Start the eth node with the chain account unlocked, listening restricted to
78+ # localhost, and our custom configuration file.
79+ tmux send-keys -t " $TMUX_WIN_ID " " ${NODES_ROOT} /harness-ctl/${NAME} " \
80+ " --config ${NODE_DIR} /eth.conf " \
81+ " --verbosity 5 --vmdebug --http --http.port " \
82+ " ${HTTP_PORT} --ws --ws.port ${WS_PORT} --ws.api ${WS_MODULES} " \
83+ " --dev --dev.period 5 2>&1 | tee ${NODE_DIR} /${NAME} .log" C-m
0 commit comments