Update L2 genesis generation

This commit is contained in:
Prathamesh Musale 2024-04-30 15:54:00 +05:30
parent 16a290c050
commit 384c450f61
3 changed files with 14 additions and 5 deletions

View File

@ -19,7 +19,7 @@ echo "Using L1 RPC endpoint ${CERC_L1_RPC}"
if [ -d "/l1-deployment/$DEPLOYMENT_CONTEXT" ]; then if [ -d "/l1-deployment/$DEPLOYMENT_CONTEXT" ]; then
echo "Deployment directory /l1-deployment/$DEPLOYMENT_CONTEXT, checking OptimismPortal deployment" echo "Deployment directory /l1-deployment/$DEPLOYMENT_CONTEXT, checking OptimismPortal deployment"
OPTIMISM_PORTAL_ADDRESS=$(cat /l1-deployment/$DEPLOYMENT_CONTEXT/OptimismPortal.json | jq -r .address) OPTIMISM_PORTAL_ADDRESS=$(cat /l1-deployment/$DEPLOYMENT_CONTEXT/.deploy | jq -r .OptimismPortal)
contract_code=$(cast code $OPTIMISM_PORTAL_ADDRESS --rpc-url $CERC_L1_RPC) contract_code=$(cast code $OPTIMISM_PORTAL_ADDRESS --rpc-url $CERC_L1_RPC)
if [ -z "${contract_code#0x}" ]; then if [ -z "${contract_code#0x}" ]; then
@ -150,14 +150,21 @@ fi
# Writes out artifact to /app/packages/contracts-bedrock/deployments/$DEPLOYMENT_CONTEXT/.deploy # Writes out artifact to /app/packages/contracts-bedrock/deployments/$DEPLOYMENT_CONTEXT/.deploy
echo "Deploying L1 Optimism contracts..." echo "Deploying L1 Optimism contracts..."
forge script scripts/Deploy.s.sol:Deploy --private-key $ADMIN_KEY --broadcast --rpc-url $CERC_L1_RPC forge script scripts/Deploy.s.sol:Deploy --private-key $ADMIN_KEY --broadcast --rpc-url $CERC_L1_RPC
echo "Done deploying contracts."
echo "Generating L2 genesis allocs..."
L2_CHAIN_ID=$(jq ".l2ChainID" $deploy_config_file)
CONTRACT_ADDRESSES_PATH=deployments/$DEPLOYMENT_CONTEXT/.deploy forge script --chain-id $L2_CHAIN_ID scripts/L2Genesis.s.sol:L2Genesis --sig 'runWithAllUpgrades()' --private-key $ADMIN_KEY
echo "{ \"accounts\": $(jq '.' /app/packages/contracts-bedrock/state-dump-$L2_CHAIN_ID.json) }" > allocs-l2.json
echo "Done."
echo "*************************************" echo "*************************************"
echo "Done deploying contracts."
# Copy files needed by other containers to the appropriate shared volumes # Copy files needed by other containers to the appropriate shared volumes
echo "Copying deployment artifacts volume l1_deployment and deploy-config to volume l2_config" echo "Copying deployment artifacts volume l1_deployment and deploy-config to volume l2_config"
cp -a /app/packages/contracts-bedrock/deployments/$DEPLOYMENT_CONTEXT /l1-deployment cp -a /app/packages/contracts-bedrock/deployments/$DEPLOYMENT_CONTEXT /l1-deployment
cp /app/packages/contracts-bedrock/deploy-config/$DEPLOYMENT_CONTEXT.json /l2-config cp /app/packages/contracts-bedrock/deploy-config/$DEPLOYMENT_CONTEXT.json /l2-config
cp allocs-l2.json /l2-config
openssl rand -hex 32 > /l2-config/l2-jwt.txt openssl rand -hex 32 > /l2-config/l2-jwt.txt
echo "Deployment successful. Exiting" echo "Deployment successful. Exiting"

View File

@ -9,7 +9,8 @@ CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
DEPLOYMENT_CONTEXT="$CERC_L1_CHAIN_ID" DEPLOYMENT_CONTEXT="$CERC_L1_CHAIN_ID"
deploy_config_file="/l2-config/$DEPLOYMENT_CONTEXT.json" deploy_config_file="/l2-config/$DEPLOYMENT_CONTEXT.json"
deployment_dir="/l1-deployment/$DEPLOYMENT_CONTEXT" l1_deployment_file="/l1-deployment/$DEPLOYMENT_CONTEXT/.deploy"
l2_allocs_file="/l2-config/allocs-l2.json"
genesis_outfile="/l2-config/genesis.json" genesis_outfile="/l2-config/genesis.json"
rollup_outfile="/l2-config/rollup.json" rollup_outfile="/l2-config/rollup.json"
@ -17,7 +18,8 @@ rollup_outfile="/l2-config/rollup.json"
if [ ! -f "$genesis_outfile" ] || [ ! -f "$rollup_outfile" ]; then if [ ! -f "$genesis_outfile" ] || [ ! -f "$rollup_outfile" ]; then
op-node genesis l2 \ op-node genesis l2 \
--deploy-config $deploy_config_file \ --deploy-config $deploy_config_file \
--deployment-dir $deployment_dir \ --l1-deployments $l1_deployment_file \
--l2-allocs $l2_allocs_file \
--outfile.l2 $genesis_outfile \ --outfile.l2 $genesis_outfile \
--outfile.rollup $rollup_outfile \ --outfile.rollup $rollup_outfile \
--l1-rpc $CERC_L1_RPC --l1-rpc $CERC_L1_RPC

View File

@ -11,7 +11,7 @@ DEPLOYMENT_CONTEXT="$CERC_L1_CHAIN_ID"
# Start op-proposer # Start op-proposer
ROLLUP_RPC="http://op-node:8547" ROLLUP_RPC="http://op-node:8547"
PROPOSER_KEY=$(cat /l2-accounts/accounts.json | jq -r .ProposerKey) PROPOSER_KEY=$(cat /l2-accounts/accounts.json | jq -r .ProposerKey)
L2OO_ADDR=$(cat /l1-deployment/$DEPLOYMENT_CONTEXT/L2OutputOracleProxy.json | jq -r .address) L2OO_ADDR=$(cat /l1-deployment/$DEPLOYMENT_CONTEXT/.deploy | jq -r .L2OutputOracleProxy)
op-proposer \ op-proposer \
--poll-interval=12s \ --poll-interval=12s \