From e3589ddaa6e13c353577b015b6e280e334f5a802 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Fri, 26 Apr 2024 16:12:51 +0530 Subject: [PATCH] Update optimism and contracts deployment script --- .../optimism-contracts/deploy-contracts.sh | 36 ++++++------------- stack/fixturenet-optimism/stack.yml | 4 +-- 2 files changed, 12 insertions(+), 28 deletions(-) diff --git a/config/fixturenet-optimism/optimism-contracts/deploy-contracts.sh b/config/fixturenet-optimism/optimism-contracts/deploy-contracts.sh index 23a2bc3..d31dc22 100755 --- a/config/fixturenet-optimism/optimism-contracts/deploy-contracts.sh +++ b/config/fixturenet-optimism/optimism-contracts/deploy-contracts.sh @@ -65,7 +65,7 @@ if [ -n "$CERC_L1_ADDRESS" ] && [ -n "$CERC_L1_PRIV_KEY" ]; then # Sequencer SEQ=$(echo "$wallet3" | awk '/Address:/{print $2}') SEQ_KEY=$(echo "$wallet3" | awk '/Private key:/{print $3}') - + echo "Funding accounts." wait_for_block 1 300 cast send --from $ADMIN --rpc-url $CERC_L1_RPC --value 5ether $PROPOSER --private-key $ADMIN_KEY @@ -105,42 +105,26 @@ echo "$accounts_json" > "/l2-accounts/accounts.json" echo "Checking L1 for finalized block..." finalized=$(cast block finalized --rpc-url $CERC_L1_RPC | grep -E "(timestamp|hash|number)" || true) -if [ -n "$finalized" ]; then - # finalized block was found - start_block=$finalized -else +config_build_script="scripts/getting-started/config.sh" +if [ -z "$finalized" ]; then # assume fresh chain and use block 1 instead echo "No finalized block. Using block 1 instead." # wait for 20 or so blocks to be safe wait_for_block 24 300 - start_block=$(cast block 1 --rpc-url $CERC_L1_RPC | grep -E "(timestamp|hash|number)" || true) + + # Replace how block is calculated in the config building script + sed -i 's/block=.*/block=$(cast block 1 --rpc-url $L1_RPC_URL)/g' $config_build_script fi -if [ -z "$start_block" ]; then - echo "Unable to query chain for starting block. Exiting..." - exit 1 -fi +# Generate the deploy-config/getting-started.json file +GS_ADMIN_ADDRESS=$ADMIN GS_BATCHER_ADDRESS=$BATCHER GS_PROPOSER_ADDRESS=$PROPOSER GS_SEQUENCER_ADDRESS=$SEQ L1_RPC_URL=$CERC_L1_RPC $config_build_script -BLOCKHASH=$(echo $start_block | awk -F ' ' '{print $2}') -HEIGHT=$(echo $start_block | awk -F ' ' '{print $4}') -TIMESTAMP=$(echo $start_block | awk -F ' ' '{print $6}') - -echo "Using block as deployment point:" -echo "Height: $HEIGHT" -echo "Hash: $BLOCKHASH" -echo "Timestamp: $TIMESTAMP" - -# Fill out the deployment template (./deploy-config/getting-started.json) with our values: echo "Writing deployment config." deploy_config_file="deploy-config/$DEPLOYMENT_CONTEXT.json" cp deploy-config/getting-started.json $deploy_config_file + +# Replace chain id in the copied config sed -i "s/\"l1ChainID\": .*/\"l1ChainID\": $DEPLOYMENT_CONTEXT,/g" $deploy_config_file -sed -i "s/ADMIN/$ADMIN/g" $deploy_config_file -sed -i "s/PROPOSER/$PROPOSER/g" $deploy_config_file -sed -i "s/BATCHER/$BATCHER/g" $deploy_config_file -sed -i "s/SEQUENCER/$SEQ/g" $deploy_config_file -sed -i "s/BLOCKHASH/$BLOCKHASH/g" $deploy_config_file -sed -i "s/TIMESTAMP/$TIMESTAMP/g" $deploy_config_file mkdir -p deployments/$DEPLOYMENT_CONTEXT diff --git a/stack/fixturenet-optimism/stack.yml b/stack/fixturenet-optimism/stack.yml index 56c54bf..3ea9217 100644 --- a/stack/fixturenet-optimism/stack.yml +++ b/stack/fixturenet-optimism/stack.yml @@ -8,8 +8,8 @@ repos: - git.vdb.to/cerc-io/lighthouse # L2 (optimism) - github.com/dboreham/foundry - - github.com/ethereum-optimism/optimism@op-node/v1.3.0 - - github.com/ethereum-optimism/op-geth@v1.101304.0 + - github.com/ethereum-optimism/optimism@v1.7.3 + - github.com/ethereum-optimism/op-geth@v1.101311.0 containers: # L1 (fixturenet-plugeth) - cerc/plugeth-statediff