Cross check existing L2 config against L1 deployment config

This commit is contained in:
Prathamesh Musale 2023-04-04 18:13:59 +05:30
parent 2a2e52751a
commit 0de7365b48
2 changed files with 21 additions and 5 deletions

View File

@ -4,10 +4,25 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x
fi
# Skip if /app/jwt.txt exists
if [ -f /app/jwt.txt ]; then
echo "Found existing config, exiting"
exit 0
# Check existing config if it exists
if [ -f /app/jwt.txt ] && [ -f /app/rollup.json ]; then
echo "Found existing L2 config, cross-checking with L1 deployment config"
SOURCE_L1_CONF=$(cat /contracts-bedrock/deploy-config/getting-started.json)
EXP_L1_BLOCKHASH=$(echo "$SOURCE_L1_CONF" | jq -r '.l1StartingBlockTag')
EXP_BATCHER=$(echo "$SOURCE_L1_CONF" | jq -r '.batchSenderAddress')
GEN_L2_CONF=$(cat /app/rollup.json)
GEN_L1_BLOCKHASH=$(echo "$GEN_L2_CONF" | jq -r '.genesis.l1.hash')
GEN_BATCHER=$(echo "$GEN_L2_CONF" | jq -r '.genesis.system_config.batcherAddr')
if [ "$EXP_L1_BLOCKHASH" = "$GEN_L1_BLOCKHASH" ] && [ "$EXP_BATCHER" = "$GEN_BATCHER" ]; then
echo "Config cross-checked, exiting"
exit 0
fi
echo "Existing L2 config doesn't match the L1 deployment config, please clear L2 config volume before starting"
exit 1
fi
op-node genesis l2 \

View File

@ -36,7 +36,8 @@ if [ -d "deployments/getting-started" ]; then
echo "Deployment verfication successful, exiting"
exit 0
else
echo "Deployment verfication failed"
echo "Deployment verfication failed, please clear L1 deployment volume before starting"
exit 1
fi
fi