From 0c942d871b6427067643a1e2dbe203778925149d Mon Sep 17 00:00:00 2001 From: prathamesh0 Date: Fri, 31 Mar 2023 14:46:10 +0530 Subject: [PATCH] Wait for a finalized L1 block to exist --- .../config/fixturenet-optimism/optimism-contracts/run.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/data/config/fixturenet-optimism/optimism-contracts/run.sh b/app/data/config/fixturenet-optimism/optimism-contracts/run.sh index c3566e35..5b91901a 100755 --- a/app/data/config/fixturenet-optimism/optimism-contracts/run.sh +++ b/app/data/config/fixturenet-optimism/optimism-contracts/run.sh @@ -33,7 +33,11 @@ yarn hardhat send-balance --to "${BATCHER_ADDRESS}" --amount 1000 --private-key echo "Balances sent to L2 accounts" # Select a finalized L1 block as the starting point for roll ups -CAST_OUTPUT=$(cast block finalized --rpc-url "$L1_RPC") +until CAST_OUTPUT=$(cast block finalized --rpc-url "$L1_RPC"); do + echo "Waiting for a finalized L1 block to exist, retrying after 10s" + sleep 10 +done + L1_BLOCKHASH=$(echo "$CAST_OUTPUT" | awk '/hash/{print $2}') L1_BLOCKTIMESTAMP=$(echo "$CAST_OUTPUT" | awk '/timestamp/{print $2}') @@ -49,6 +53,8 @@ echo "Updated the deployment config" echo "L1_RPC=$L1_RPC" > .env echo "PRIVATE_KEY_DEPLOYER=$ADMIN_PRIV_KEY" >> .env +echo "Deploying the L1 smart contracts, this will take a while..." + # Deploy the L1 smart contracts yarn hardhat deploy --network getting-started