fixturenet-optimism-stack/config/fixturenet-optimism/generate-l2-config.sh
Adwait Gharpure 963b989457
Upgrade Optimism to latest release (#1)
* Update optimism contracts script

* Add l2-config-generation service to compose file

* Pass flag to op-node for lighthouse beacon API endpoint

* Remove command to copy op-bindings from Dockerfiles in container-build directory

* Remove unnecessary commands

* Retrieve L1 chain id from env in compose file

* Add missing $

* Check if config files already exist

* Return if both config outfiles exist
2024-07-18 20:27:06 +05:30

37 lines
1.1 KiB
Bash

#!/bin/bash
set -e
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
CERC_L1_CHAIN_ID="${CERC_L1_CHAIN_ID:-${DEFAULT_CERC_L1_CHAIN_ID}}"
CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
DEPLOYMENT_CONTEXT="$CERC_L1_CHAIN_ID"
deploy_config_file="/l2-config/$DEPLOYMENT_CONTEXT.json"
l1_deployment_file="/l1-deployment/$DEPLOYMENT_CONTEXT-deploy.json"
l2_allocs_file="/l2-config/allocs-l2.json"
genesis_outfile="/l2-config/genesis.json"
rollup_outfile="/l2-config/rollup.json"
# Check if genesis.json and rollup.json already exist
if [ -f "$genesis_outfile" ] && [ -f "$rollup_outfile" ]; then
echo "Skipping generation, files already exist: $genesis_outfile, $rollup_outfile"
exit 0
fi
# If files don't exist, proceed with generation
echo "Generating l2 config files..."
op-node genesis l2 \
--deploy-config "$deploy_config_file" \
--l1-deployments "$l1_deployment_file" \
--l2-allocs "$l2_allocs_file" \
--outfile.l2 "$genesis_outfile" \
--outfile.rollup "$rollup_outfile" \
--l1-rpc "$CERC_L1_RPC"
echo "Generated the l2 config files successfully"
echo "Exiting"