@@ -227,6 +227,60 @@ storage_should_run_on_validator() {
227227 [ " $run_on " = " $validator_name " ]
228228}
229229
230+ storage_preflight_checks () {
231+ local validator_idx=" $1 "
232+ local validator_name=" $2 "
233+ local eth_api_port=" $3 "
234+ local storage_node_bin=" $4 "
235+ local storage_gateway_bin=" $5 "
236+ local storage_actor_addr=" 0xff00000000000000000000000000000000000042"
237+
238+ if ! exec_on_host_simple " $validator_idx " " command -v yq >/dev/null 2>&1" ; then
239+ log_error " $validator_name : missing required dependency 'yq'"
240+ log_info " Install it on $validator_name and retry:"
241+ log_info " sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 && sudo chmod +x /usr/local/bin/yq"
242+ return 1
243+ fi
244+
245+ if ! exec_on_host_simple " $validator_idx " " [ -x $storage_node_bin ]" ; then
246+ log_error " $validator_name : storage node binary not found/executable: $storage_node_bin "
247+ log_info " Build and deploy storage binaries, then retry start-storage."
248+ return 1
249+ fi
250+
251+ if ! exec_on_host_simple " $validator_idx " " [ -x $storage_gateway_bin ]" ; then
252+ log_error " $validator_name : storage gateway binary not found/executable: $storage_gateway_bin "
253+ log_info " Build and deploy storage binaries, then retry start-storage."
254+ return 1
255+ fi
256+
257+ local actor_probe
258+ actor_probe=$( exec_on_host " $validator_idx " \
259+ " resp=\$ (curl -sS --max-time 8 -H 'Content-Type: application/json' --data '{\" jsonrpc\" :\" 2.0\" ,\" method\" :\" eth_getCode\" ,\" params\" :[\" $storage_actor_addr \" ,\" latest\" ],\" id\" :1}' http://127.0.0.1:$eth_api_port 2>/dev/null || true); \
260+ if echo \"\$ resp\" | grep -q '\" result\" :\" 0x\" '; then echo MISSING; \
261+ elif echo \"\$ resp\" | grep -q '\" result\" :\" 0x0\" '; then echo MISSING; \
262+ elif echo \"\$ resp\" | grep -q '\" result\" :\" 0x'; then echo OK; \
263+ else echo UNKNOWN; fi" )
264+
265+ if echo " $actor_probe " | grep -q " MISSING" ; then
266+ log_error " $validator_name : storage actor (ID 66 / $storage_actor_addr ) is not deployed on this subnet"
267+ log_info " Preflight failed to avoid starting storage against a chain without storage actors."
268+ log_info " Next steps:"
269+ log_info " 1) Keep init.deploy_subnet=true and init.activate_subnet=true in ipc-subnet-config.yml"
270+ log_info " 2) Re-run: ./ipc-manager init --yes"
271+ log_info " 3) After init succeeds, run: ./ipc-manager start-storage --register-operator --yes"
272+ return 1
273+ fi
274+
275+ if echo " $actor_probe " | grep -q " UNKNOWN" ; then
276+ log_error " $validator_name : unable to verify storage actor deployment via http://127.0.0.1:$eth_api_port "
277+ log_info " Ensure the subnet node is up and the eth RPC endpoint is reachable, then retry."
278+ return 1
279+ fi
280+
281+ return 0
282+ }
283+
230284start_storage_services () {
231285 local register_operator=" ${1:- false} "
232286 local started=0
@@ -280,6 +334,10 @@ start_storage_services() {
280334 local storage_node_bin=" $ipc_repo /target/release/node"
281335 local storage_gateway_bin=" $ipc_repo /target/release/gateway"
282336
337+ if ! storage_preflight_checks " $idx " " $name " " $eth_api_port " " $storage_node_bin " " $storage_gateway_bin " ; then
338+ continue
339+ fi
340+
283341 exec_on_host_simple " $idx " " yq eval \" .\\\" objects-listen-addr\\\" = \\\" $objects_listen_addr \\\"\" -i $storage_cfg_path "
284342 exec_on_host_simple " $idx " " yq eval \" .\\\" node-rpc-bind-addr\\\" = \\\" $node_rpc_bind_addr \\\"\" -i $storage_cfg_path "
285343 exec_on_host_simple " $idx " " yq eval \" .\\\" operator-rpc-url\\\" = \\\" $operator_rpc_url \\\"\" -i $storage_cfg_path "
0 commit comments