diff --git a/main.star b/main.star index fe00ae2c..94d51d9b 100644 --- a/main.star +++ b/main.star @@ -58,6 +58,9 @@ def run(plan, args): "L1_WS_URL": external_l1_args.el_ws_url, "L1_CHAIN_ID": external_l1_args.network_id, } + + plan.print("Waiting for network to sync") + wait_for_sync.wait_for_sync(plan, l1_config_env_vars) else: plan.print("Deploying a local L1") l1 = ethereum_package.run(plan, ethereum_args) @@ -74,13 +77,8 @@ def run(plan, args): l1_config_env_vars = get_l1_config( all_l1_participants, l1_network_params, l1_network_id ) - - if l1_network == "kurtosis": plan.print("Waiting for L1 to start up") wait_for_sync.wait_for_startup(plan, l1_config_env_vars) - else: - plan.print("Waiting for network to sync") - wait_for_sync.wait_for_sync(plan, l1_config_env_vars) deployment_output = contract_deployer.deploy_contracts( plan, diff --git a/src/wait/wait_for_sync.star b/src/wait/wait_for_sync.star index 8448afc5..1d8c95ba 100644 --- a/src/wait/wait_for_sync.star +++ b/src/wait/wait_for_sync.star @@ -26,10 +26,20 @@ def wait_for_sync(plan, l1_config_env_vars): def wait_for_startup(plan, l1_config_env_vars): plan.run_sh( - name="wait-for-l1-startup", + name="wait-for-l1-consensus-startup", description="Wait for L1 to start up - can take up to 2 minutes", image=utils.DEPLOYMENT_UTILS_IMAGE, env_vars=l1_config_env_vars, run="while true; do sleep 5; echo 'L1 Chain is starting up'; if [ \"$(curl -s $CL_RPC_URL/eth/v1/beacon/headers/ | jq -r '.data[0].header.message.slot')\" != \"0\" ]; then echo 'L1 Chain has started!'; break; fi; done", wait="300s", ) + + # wait for block 3 to avoid transaction indexing in progress errors + plan.run_sh( + name="wait-for-l1-execution-startup", + description="Wait for L1 execution to start up - can take up to 2 minutes", + image=utils.DEPLOYMENT_UTILS_IMAGE, + env_vars=l1_config_env_vars, + run='while true; do sleep 5; current_head=$(cast bn --rpc-url=$L1_RPC_URL); echo "L1 Execution is starting up"; if [ "$current_head" -ge "3" ]; then echo "L1 Execution has started!"; break; fi; done', + wait="5m" + )