fixturenet-optimism-stack/config/fixturenet-optimism/generate-l2-config.sh
Prathamesh Musale 9ca108e877 Upgrade Optimism to latest release (#3)
Part of [laconicd testnet validator enrollment](https://www.notion.so/laconicd-testnet-validator-enrollment-6fc1d3cafcc64fef8c5ed3affa27c675)

- Updated Dockerfiles
- Added a separate service to generate L2 config files
  - Updated service dependency for `op-geth` and `op-node`
- Passed lighthouse beacon API endpoint to the `op-node` command
- Updated path for artifact generated by L1 contracts deployment

Co-authored-by: Adwait Gharpure <69599306+Adw8@users.noreply.github.com>
Reviewed-on: cerc-io/fixturenet-optimism-stack#3
2024-07-18 15:02:52 +00:00

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"