#!/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"