@@ -14,6 +14,11 @@ eval `ssh-agent -s`
1414ssh-add
1515ssh-add ${HOME} /.ssh/id_rsa.ipc
1616
17+ if [[ ! -v PARENT_HTTP_AUTH_TOKEN ]]; then
18+ echo " PARENT_HTTP_AUTH_TOKEN is not set"
19+ exit 1
20+ fi
21+
1722DASHES=' ------'
1823if [[ ! -v IPC_FOLDER ]]; then
1924 IPC_FOLDER=${HOME} /ipc
@@ -133,10 +138,41 @@ cd ${IPC_FOLDER}/fendermint
133138make clean
134139make docker-build
135140
136- # Step 4.2: Start other validator node
137- echo " $DASHES Restart validator nodes "
141+ # Step 4.2: Start first validator node as bootstrap
142+ echo " $DASHES Start first validator node as bootstrap "
138143cd ${IPC_FOLDER}
139- for i in {0..2}
144+ bootstrap_output=$( cargo make --makefile infra/fendermint/Makefile.toml \
145+ -e NODE_NAME=validator-0 \
146+ -e PRIVATE_KEY_PATH=${IPC_CONFIG_FOLDER} /validator_0.sk \
147+ -e SUBNET_ID=${subnet_id} \
148+ -e CMT_P2P_HOST_PORT=${CMT_P2P_HOST_PORTS[0]} \
149+ -e CMT_RPC_HOST_PORT=${CMT_RPC_HOST_PORTS[0]} \
150+ -e ETHAPI_HOST_PORT=${ETHAPI_HOST_PORTS[0]} \
151+ -e RESOLVER_HOST_PORT=${RESOLVER_HOST_PORTS[0]} \
152+ -e PROXY_HOST_PORT=${PROXY_HOST_PORTS[0]} \
153+ -e IPFS_SWARM_HOST_PORT=${IPFS_SWARM_HOST_PORTS[0]} \
154+ -e IPFS_RPC_HOST_PORT=${IPFS_RPC_HOST_PORTS[0]} \
155+ -e IPFS_GATEWAY_HOST_PORT=${IPFS_GATEWAY_HOST_PORTS[0]} \
156+ -e IPFS_PROFILE=" local-discovery" \
157+ -e PARENT_HTTP_AUTH_TOKEN=${PARENT_HTTP_AUTH_TOKEN} \
158+ -e PARENT_REGISTRY=${parent_registry_address} \
159+ -e PARENT_GATEWAY=${parent_gateway_address} \
160+ -e FM_PULL_SKIP=1 \
161+ -e FM_LOG_LEVEL=" info,fendermint=debug" \
162+ child-validator-restart 2>&1 )
163+ echo " $bootstrap_output "
164+ bootstrap_node_id=$( echo " $bootstrap_output " | sed -n ' /CometBFT node ID:/ {n;p;}' | tr -d " [:blank:]" )
165+ bootstrap_peer_id=$( echo " $bootstrap_output " | sed -n ' /IPLD Resolver Multiaddress:/ {n;p;}' | tr -d " [:blank:]" | sed ' s/.*\/p2p\///' )
166+ echo " Bootstrap node started. Node id ${bootstrap_node_id} , peer id ${bootstrap_peer_id} "
167+
168+ bootstrap_node_endpoint=${bootstrap_node_id} @validator-0-cometbft:${CMT_P2P_HOST_PORTS[0]}
169+ echo " Bootstrap node endpoint: ${bootstrap_node_endpoint} "
170+ bootstrap_resolver_endpoint=" /dns/validator-0-fendermint/tcp/${RESOLVER_HOST_PORTS[0]} /p2p/${bootstrap_peer_id} "
171+ echo " Bootstrap resolver endpoint: ${bootstrap_resolver_endpoint} "
172+
173+ # Step 4.3: Start other validator node
174+ echo " $DASHES Start the other validator nodes"
175+ for i in {1..2}
140176do
141177 cargo make --makefile infra/fendermint/Makefile.toml \
142178 -e NODE_NAME=validator-${i} \
151187 -e IPFS_RPC_HOST_PORT=${IPFS_RPC_HOST_PORTS[i]} \
152188 -e IPFS_GATEWAY_HOST_PORT=${IPFS_GATEWAY_HOST_PORTS[i]} \
153189 -e IPFS_PROFILE=" local-discovery" \
190+ -e RESOLVER_BOOTSTRAPS=${bootstrap_resolver_endpoint} \
191+ -e BOOTSTRAPS=${bootstrap_node_endpoint} \
192+ -e PARENT_HTTP_AUTH_TOKEN=${PARENT_HTTP_AUTH_TOKEN} \
154193 -e PARENT_REGISTRY=${parent_registry_address} \
155194 -e PARENT_GATEWAY=${parent_gateway_address} \
156195 -e FM_PULL_SKIP=1 \
157- -e FM_LOG_LEVEL=" info" \
196+ -e FM_LOG_LEVEL=" info,fendermint=debug " \
158197 child-validator-restart
159198done
160199
0 commit comments