diff --git a/test-pp-op/2-deploy-op-contracts.sh b/test-pp-op/2-deploy-op-contracts.sh index 8cff9bdba187e..a9bd6038bc2e3 100755 --- a/test-pp-op/2-deploy-op-contracts.sh +++ b/test-pp-op/2-deploy-op-contracts.sh @@ -240,6 +240,31 @@ deploy_custom_gas_token() { echo "🔧 Setting up Custom Gas Token (CGT) configuration..." echo "" + # Extract parameters from intent.toml BEFORE changing directory + GAS_LIMIT=$(grep -E "^[[:space:]]*gasLimit[[:space:]]*=" "$CONFIG_DIR/intent.toml" | sed -E 's/^[[:space:]]*gasLimit[[:space:]]*=[[:space:]]*([0-9]+).*/\1/') + EIP1559_DENOMINATOR=$(grep -E "^[[:space:]]*eip1559Denominator[[:space:]]*=" "$CONFIG_DIR/intent.toml" | sed -E 's/^[[:space:]]*eip1559Denominator[[:space:]]*=[[:space:]]*([0-9]+).*/\1/') + EIP1559_ELASTICITY=$(grep -E "^[[:space:]]*eip1559Elasticity[[:space:]]*=" "$CONFIG_DIR/intent.toml" | sed -E 's/^[[:space:]]*eip1559Elasticity[[:space:]]*=[[:space:]]*([0-9]+).*/\1/') + + echo "📋 Configuration from intent.toml:" + echo " Gas Limit: $GAS_LIMIT" + echo " EIP1559 Denominator: $EIP1559_DENOMINATOR" + echo " EIP1559 Elasticity: $EIP1559_ELASTICITY" + echo "" + + # Validate extracted parameters + if [ -z "$GAS_LIMIT" ]; then + echo "❌ Failed to extract gasLimit from intent.toml" + exit 1 + fi + if [ -z "$EIP1559_DENOMINATOR" ]; then + echo "❌ Failed to extract eip1559Denominator from intent.toml" + exit 1 + fi + if [ -z "$EIP1559_ELASTICITY" ]; then + echo "❌ Failed to extract eip1559Elasticity from intent.toml" + exit 1 + fi + SYSTEM_CONFIG_PROXY_ADDRESS=$(jq -r '.opChainDeployments[0].SystemConfigProxy' "$CONFIG_DIR/state.json") OPTIMISM_PORTAL_PROXY_ADDRESS=$(jq -r '.opChainDeployments[0].OptimismPortalProxy' "$CONFIG_DIR/state.json") @@ -282,6 +307,38 @@ deploy_custom_gas_token() { echo " Adapter: $ADAPTER_ADDRESS" echo "" + # Set gas config to 0 for custom gas token (Ecotone upgrade) + echo "🔧 Setting gas config for Ecotone (Custom Gas Token)..." + cast send "$SYSTEM_CONFIG_PROXY_ADDRESS" \ + "setGasConfigEcotone(uint32,uint32)" \ + 0 \ + 0 \ + --rpc-url "$L1_RPC_URL" \ + --private-key "$DEPLOYER_PRIVATE_KEY" + echo "✅ Gas config set to (0, 0) for Custom Gas Token" + echo "" + + # Set gas limit + echo "🔧 Setting gas limit to $GAS_LIMIT..." + cast send "$SYSTEM_CONFIG_PROXY_ADDRESS" \ + "setGasLimit(uint64)" \ + "$GAS_LIMIT" \ + --rpc-url "$L1_RPC_URL" \ + --private-key "$DEPLOYER_PRIVATE_KEY" + echo "✅ Gas limit set successfully" + echo "" + + # Set EIP-1559 parameters + echo "🔧 Setting EIP-1559 parameters (denominator: $EIP1559_DENOMINATOR, elasticity: $EIP1559_ELASTICITY)..." + cast send "$SYSTEM_CONFIG_PROXY_ADDRESS" \ + "setEIP1559Params(uint32,uint32)" \ + "$EIP1559_DENOMINATOR" \ + "$EIP1559_ELASTICITY" \ + --rpc-url "$L1_RPC_URL" \ + --private-key "$DEPLOYER_PRIVATE_KEY" + echo "✅ EIP-1559 parameters set successfully" + echo "" + # Transfer SystemConfig ownership echo "🔧 Transferring SystemConfig ownership..." echo "" diff --git a/test-pp-op/4-migrate-op.sh b/test-pp-op/4-migrate-op.sh index 4a51fb3e8c612..53391e527c828 100755 --- a/test-pp-op/4-migrate-op.sh +++ b/test-pp-op/4-migrate-op.sh @@ -1,11 +1,17 @@ #!/bin/bash -set -x set -e + +# Debug mode - set to true to enable verbose output +DEBUG=${DEBUG:-false} + +if [ "$DEBUG" = "true" ]; then + set -x +fi + source .env source tools.sh source utils.sh - prepare() { # Check required files exist if [ ! -f "./config-op/genesis.json" ]; then @@ -151,10 +157,29 @@ migrate() { echo "L2_NUMBER: $L2_NUMBER" echo "L2_HASH: $L2_HASH" - jq --argjson num "$L2_NUMBER" --arg hash "$L2_HASH" \ - '.genesis.l2.number = $num | .genesis.l2.hash = $hash' \ + # Update eip1559DenominatorCanyon to match eip1559Denominator in rollup.json + echo "🔧 Updating eip1559DenominatorCanyon to match eip1559Denominator..." + + # Extract eip1559Denominator from rollup.json + EIP1559_DENOMINATOR=$(jq -r '.chain_op_config.eip1559Denominator' config-op/rollup.json) + echo "eip1559Denominator value from rollup.json: $EIP1559_DENOMINATOR" + + # Debug: Check current rollup.json structure + echo "🔍 Current rollup.json chain_op_config structure:" + jq '.chain_op_config' config-op/rollup.json + + # Update rollup.json with the eip1559DenominatorCanyon value + echo "🔧 Updating rollup.json chain_op_config..." + jq --argjson denominator "$EIP1559_DENOMINATOR" \ + '.chain_op_config.eip1559DenominatorCanyon = $denominator' \ config-op/rollup.json > config-op/rollup.json.tmp && mv config-op/rollup.json.tmp config-op/rollup.json + # Verify the update + echo "🔍 Updated rollup.json chain_op_config structure:" + jq '.chain_op_config' config-op/rollup.json + + echo "✅ Updated eip1559DenominatorCanyon to $EIP1559_DENOMINATOR in rollup.json" + echo "finished migrate op-geth" } diff --git a/test-pp-op/config-op/intent.fakemainnet.toml.bak b/test-pp-op/config-op/intent.fakemainnet.toml.bak index 5b59e0075860b..0d95190ff3fa2 100644 --- a/test-pp-op/config-op/intent.fakemainnet.toml.bak +++ b/test-pp-op/config-op/intent.fakemainnet.toml.bak @@ -18,7 +18,7 @@ l2ContractsLocator = "file:///app/packages/contracts-bedrock/forge-artifacts" gasLimit = 30000000 [chains.deployOverrides] l2GenesisBlockGasLimit = "0x1C9C380" - l2GenesisBlockBaseFeePerGas = "0x5F5E100" + l2GenesisBlockBaseFeePerGas = "0x5FC01C5" l2BlockTime = 1 [chains.customGasToken] enabled = true @@ -31,5 +31,5 @@ l2ContractsLocator = "file:///app/packages/contracts-bedrock/forge-artifacts" systemConfigOwner = "0x1183f158515091c94188C13Cd16923cee663d4c4" unsafeBlockSigner = "0xe44FaF74D0EA83D962BB8cE077F69e449c6D8c4a" batcher = "0x02E0eF87B04FD60E7F2215D1932420a80Cc35c55" - proposer = "0x8E2e2C0fB70A26d94a9B29f75F9449c09F8CCc5A" - challenger = "0x2ada62d4B0581896c26b8627d46285A3C3078CCf" + proposer = "0xe43944421681170648e10007f73816e04f74394f" + challenger = "0x736e68af2cbf2ab0e46e4310fe5ae568b3642ff6" diff --git a/test-pp-op/config-op/intent.mainnet.toml.bak b/test-pp-op/config-op/intent.mainnet.toml.bak index bcc5c72f6e70d..5bec9131a2ff3 100644 --- a/test-pp-op/config-op/intent.mainnet.toml.bak +++ b/test-pp-op/config-op/intent.mainnet.toml.bak @@ -18,7 +18,7 @@ l2ContractsLocator = "file:///app/packages/contracts-bedrock/forge-artifacts" gasLimit = 30000000 [chains.deployOverrides] l2GenesisBlockGasLimit = "0x1C9C380" - l2GenesisBlockBaseFeePerGas = "0x5F5E100" + l2GenesisBlockBaseFeePerGas = "0x5FC01C5" l2BlockTime = 1 [chains.customGasToken] enabled = true diff --git a/test-pp-op/config-op/intent.testnet.toml.bak b/test-pp-op/config-op/intent.testnet.toml.bak index 4d7ccc8fd1228..44b5ea978ea98 100644 --- a/test-pp-op/config-op/intent.testnet.toml.bak +++ b/test-pp-op/config-op/intent.testnet.toml.bak @@ -18,7 +18,7 @@ l2ContractsLocator = "file:///app/packages/contracts-bedrock/forge-artifacts" gasLimit = 30000000 [chains.deployOverrides] l2GenesisBlockGasLimit = "0x1C9C380" - l2GenesisBlockBaseFeePerGas = "0x5F5E100" + l2GenesisBlockBaseFeePerGas = "0x5FC01C5" l2BlockTime = 1 [chains.customGasToken] enabled = true diff --git a/test-pp-op/m1-deploy-and-upload.sh b/test-pp-op/m1-deploy-and-upload.sh index b5563d2a06601..18ccc005873b1 100755 --- a/test-pp-op/m1-deploy-and-upload.sh +++ b/test-pp-op/m1-deploy-and-upload.sh @@ -1,6 +1,5 @@ #!/bin/bash set -e -set -x if [ ! -f .env ];then echo "Please create .env file." @@ -32,6 +31,11 @@ echo "" echo "==============================================" echo "Step 2: Build op-migrate image" echo "==============================================" + +# Remove previous uploads to keep size of docker image small. +echo "🗑️ Removing existing container ${UPLOAD_DIR}..." +rm -rf $UPLOAD_DIR ${UPLOAD_DIR}.tar.gz + if [ "$SKIP_BUILD_GETH" = true ]; then echo "⏭️ Skipping build_images.sh (--skip-geth flag detected)" else @@ -50,7 +54,6 @@ echo "" echo "==============================================" echo "Step 4: Create folder to store upload files" echo "==============================================" -rm -rf $UPLOAD_DIR mkdir -p $UPLOAD_DIR mv ${IMAGE_NAME}.tar.gz $UPLOAD_DIR cp ./m2-migrate.sh $UPLOAD_DIR @@ -73,4 +76,4 @@ echo "" echo "==============================================" echo "Step 6: Upload to OSS" echo "==============================================" -echo "Please create an OSS ticket with the MD5 hash: ${MD5_HASH}." +echo "Please create an OSS ticket using ${TAR_FILE} and its MD5 hash: ${MD5_HASH}." diff --git a/test-pp-op/m2-migrate.sh b/test-pp-op/m2-migrate.sh index 98efbfec610a0..9f16f4071d47a 100755 --- a/test-pp-op/m2-migrate.sh +++ b/test-pp-op/m2-migrate.sh @@ -1,6 +1,11 @@ #!/bin/bash set -e -set -x + +# Debug mode - set to true to enable verbose output +DEBUG=${DEBUG:-false} +if [ "$DEBUG" = "true" ]; then + set -x +fi FORK_BLOCK=$1 @@ -10,11 +15,11 @@ RAMDISK_PATH="/mnt/ramdisk_op" DATA_DIR="/data" ERIGON_DATA_DIR="/data/erigon-data" BACKUP_DIR="${DATA_DIR}/migration-backup-$(date +%Y%m%d)" -L2_RPC_URL="${L2_RPC_URL:-http://10.2.29.232:8545}" +L2_RPC_URL="${L2_RPC_URL:-http://10.2.29.232:18545}" ENV=${ENV:-mainnet} # Set expected chain ID based on ENV variable EXPECTED_CHAIN=$([ "$ENV" = "testnet" ] && echo "1952" || echo "196") -EXPECTED_L1_CHAIN_ID=$([ "$ENV" = "testnet" ] && echo "11155111" || echo "1") +EXPECTED_L1_CHAIN_ID=$([ "$ENV" = "testnet" ] && echo "11155111" || ([ "$ENV" = "fakemainnet" ] && echo "11155111" || echo "1")) CHECK_BLOCK=${CHECK_BLOCK:-true} # Check required tools @@ -25,6 +30,24 @@ for cmd in docker jq curl sed grep; do fi done +# Prompt to delete ${BACKUP_DIR} contents +if [ -d $BACKUP_DIR ];then + echo "" + echo "=============================================" + echo "Existing ${BACKUP_DIR}" + echo "=============================================" + ls -la $BACKUP_DIR + echo "" + read -p "Do you want to delete the contents of ${BACKUP_DIR}? (y/n): " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + echo "${BACKUP_DIR} contents are DELETED..." + rm -rf ${BACKUP_DIR}/* + else + echo "${BACKUP_DIR} contents are NOT deleted..." + fi +fi + # Create and verify backup directory mkdir -p ${BACKUP_DIR} if ! touch ${BACKUP_DIR}/.write_test 2>/dev/null; then @@ -239,46 +262,98 @@ wait_for_enter() { fi } -# Function to review configuration files interactively -review_configuration_files() { - # 1. Check .env file - echo "==============================================" - echo "1. Checking .env file" - echo "==============================================" - docker exec ${CONTAINER_NAME} bash -c "set -e && cd /app/test-pp-op && cat .env" - wait_for_enter "Press ENTER to continue to next check..." +# Function to extract and display configuration fields +extract_configuration_fields() { + local phase="$1" # "before" or "after" + + # Extract .env values + echo "=== .env Configuration ===" + docker exec ${CONTAINER_NAME} bash -c "set -e && cd /app/test-pp-op && \ + echo 'CHAIN_ID='\$(grep '^CHAIN_ID=' .env | cut -d'=' -f2) && \ + echo 'OKB_TOKEN_ADDRESS='\$(grep '^OKB_TOKEN_ADDRESS=' .env | cut -d'=' -f2) && \ + echo 'BATCHER_ADDRESS='\$(grep '^BATCHER_ADDRESS=' .env | cut -d'=' -f2) && \ + echo 'PROPOSER_ADDRESS='\$(grep '^PROPOSER_ADDRESS=' .env | cut -d'=' -f2) && \ + echo 'CHALLENGER_ADDRESS='\$(grep '^CHALLENGER_ADDRESS=' .env | cut -d'=' -f2) && \ + echo 'ADMIN_OWNER_ADDRESS='\$(grep '^ADMIN_OWNER_ADDRESS=' .env | cut -d'=' -f2) && \ + echo 'TIME_LOCK_DELAY='\$(grep '^TIME_LOCK_DELAY=' .env | cut -d'=' -f2) && \ + echo 'TEMP_MAX_CLOCK_DURATION='\$(grep '^TEMP_MAX_CLOCK_DURATION=' .env | cut -d'=' -f2) && \ + echo 'TEMP_CLOCK_EXTENSION='\$(grep '^TEMP_CLOCK_EXTENSION=' .env | cut -d'=' -f2) && \ + echo 'PROOF_MATURITY_DELAY_SECONDS='\$(grep '^PROOF_MATURITY_DELAY_SECONDS=' .env | cut -d'=' -f2) && \ + echo 'MAX_CLOCK_DURATION='\$(grep '^MAX_CLOCK_DURATION=' .env | cut -d'=' -f2) && \ + echo 'CLOCK_EXTENSION='\$(grep '^CLOCK_EXTENSION=' .env | cut -d'=' -f2) && \ + echo 'DISPUTE_GAME_FINALITY_DELAY_SECONDS='\$(grep '^DISPUTE_GAME_FINALITY_DELAY_SECONDS=' .env | cut -d'=' -f2) && \ + echo 'CHALLENGE_PERIOD_SECONDS='\$(grep '^CHALLENGE_PERIOD_SECONDS=' .env | cut -d'=' -f2) && \ + echo 'WITHDRAWAL_DELAY_SECONDS='\$(grep '^WITHDRAWAL_DELAY_SECONDS=' .env | cut -d'=' -f2) && \ + echo 'TRANSACTOR='\$(grep '^TRANSACTOR=' .env | cut -d'=' -f2)" - # 2. Check genesis.json - echo "" - echo "==============================================" - echo "2. Checking config-op/genesis.json" - echo "==============================================" - echo "First 50 lines:" - docker exec ${CONTAINER_NAME} bash -c "set -e && cd /app/test-pp-op && cat config-op/genesis.json | head -50" echo "" - echo "---" - echo "Last 10 lines:" - docker exec ${CONTAINER_NAME} bash -c "set -e && cd /app/test-pp-op && cat config-op/genesis.json | tail -10" - wait_for_enter "Press ENTER to continue to next check..." + echo "=== intent.toml Configuration ===" + docker exec ${CONTAINER_NAME} bash -c "set -e && cd /app/test-pp-op && \ + echo 'l1ChainID='\$(grep '^l1ChainID' config-op/intent.toml | head -1 | sed 's/.*=[[:space:]]*\\([0-9]*\\).*/\\1/') && \ + echo 'opcmAddress='\$(grep '^opcmAddress' config-op/intent.toml | sed 's/.*\"\\(.*\\)\".*/\\1/') && \ + echo 'id='\$(grep '^[[:space:]]*id[[:space:]]*=' config-op/intent.toml | head -1 | sed 's/.*\"\\(.*\\)\".*/\\1/') && \ + echo 'baseFeeVaultRecipient='\$(grep 'baseFeeVaultRecipient' config-op/intent.toml | sed 's/.*\"\\(.*\\)\".*/\\1/') && \ + echo 'l1FeeVaultRecipient='\$(grep 'l1FeeVaultRecipient' config-op/intent.toml | sed 's/.*\"\\(.*\\)\".*/\\1/') && \ + echo 'sequencerFeeVaultRecipient='\$(grep 'sequencerFeeVaultRecipient' config-op/intent.toml | sed 's/.*\"\\(.*\\)\".*/\\1/') && \ + echo 'l2GenesisBlockGasLimit='\$(grep 'l2GenesisBlockGasLimit' config-op/intent.toml | sed 's/.*\"\\(.*\\)\".*/\\1/') && \ + echo 'l2GenesisBlockBaseFeePerGas='\$(grep 'l2GenesisBlockBaseFeePerGas' config-op/intent.toml | sed 's/.*\"\\(.*\\)\".*/\\1/') && \ + echo 'eip1559DenominatorCanyon='\$(grep 'eip1559DenominatorCanyon' config-op/intent.toml | cut -d'=' -f2 | tr -d ' ') && \ + echo 'eip1559Denominator='\$(grep 'eip1559Denominator' config-op/intent.toml | head -1 | cut -d'=' -f2 | tr -d ' ') && \ + echo 'eip1559Elasticity='\$(grep 'eip1559Elasticity' config-op/intent.toml | cut -d'=' -f2 | tr -d ' ') && \ + echo 'operatorFeeScalar='\$(grep 'operatorFeeScalar' config-op/intent.toml | cut -d'=' -f2 | tr -d ' ') && \ + echo 'operatorFeeConstant='\$(grep 'operatorFeeConstant' config-op/intent.toml | cut -d'=' -f2 | tr -d ' ') && \ + echo 'gasLimit='\$(grep 'gasLimit' config-op/intent.toml | cut -d'=' -f2 | tr -d ' ') && \ + echo 'l1ProxyAdminOwner='\$(grep 'l1ProxyAdminOwner' config-op/intent.toml | sed 's/.*\"\\(.*\\)\".*/\\1/') && \ + echo 'l2ProxyAdminOwner='\$(grep 'l2ProxyAdminOwner' config-op/intent.toml | sed 's/.*\"\\(.*\\)\".*/\\1/') && \ + echo 'systemConfigOwner='\$(grep 'systemConfigOwner' config-op/intent.toml | sed 's/.*\"\\(.*\\)\".*/\\1/') && \ + echo 'unsafeBlockSigner='\$(grep 'unsafeBlockSigner' config-op/intent.toml | sed 's/.*\"\\(.*\\)\".*/\\1/') && \ + echo 'batcher='\$(grep 'batcher' config-op/intent.toml | sed 's/.*\"\\(.*\\)\".*/\\1/') && \ + echo 'proposer='\$(grep 'proposer' config-op/intent.toml | sed 's/.*\"\\(.*\\)\".*/\\1/') && \ + echo 'challenger='\$(grep 'challenger' config-op/intent.toml | sed 's/.*\"\\(.*\\)\".*/\\1/')" - # 3. Check intent.toml echo "" - echo "==============================================" - echo "3. Checking config-op/intent.toml" - echo "==============================================" - docker exec ${CONTAINER_NAME} bash -c "set -e && cd /app/test-pp-op && cat config-op/intent.toml" - wait_for_enter "Press ENTER to continue to next check..." + echo "=== rollup.json Configuration ===" + docker exec ${CONTAINER_NAME} bash -c "set -e && cd /app/test-pp-op && \ + echo 'hash='\$(jq -r '.genesis.l2.hash' config-op/rollup.json 2>/dev/null || echo 'N/A') && \ + echo 'number='\$(jq -r '.genesis.l2.number' config-op/rollup.json 2>/dev/null || echo 'N/A') && \ + echo 'l1_chain_id='\$(jq -r '.l1_chain_id' config-op/rollup.json 2>/dev/null || echo 'N/A') && \ + echo 'l2_chain_id='\$(jq -r '.l2_chain_id' config-op/rollup.json 2>/dev/null || echo 'N/A') && \ + echo 'batch_inbox_address='\$(jq -r '.batch_inbox_address' config-op/rollup.json 2>/dev/null || echo 'N/A') && \ + echo 'deposit_contract_address='\$(jq -r '.deposit_contract_address' config-op/rollup.json 2>/dev/null || echo 'N/A') && \ + echo 'l1_system_config_address='\$(jq -r '.l1_system_config_address' config-op/rollup.json 2>/dev/null || echo 'N/A') && \ + echo 'protocol_versions_address='\$(jq -r '.protocol_versions_address' config-op/rollup.json 2>/dev/null || echo 'N/A')" + + # Only show merged.genesis.json if it exists (after migration) + if [ "$phase" = "after" ]; then + echo "" + echo "=== merged.genesis.json Configuration ===" + docker exec ${CONTAINER_NAME} bash -c "set -e && cd /app/test-pp-op && \ + echo 'chainId='\$(head -n 20 merged.genesis.json | grep -o '\"chainId\":[[:space:]]*[0-9]*' | cut -d':' -f2 | tr -d ' ' || echo 'N/A') && \ + echo 'legacyXLayerBlock='\$(head -n 20 merged.genesis.json | grep -o '\"legacyXLayerBlock\":[[:space:]]*[0-9]*' | cut -d':' -f2 | tr -d ' ' || echo 'N/A') && \ + echo 'eip1559Elasticity='\$(head -n 50 merged.genesis.json | grep 'eip1559Elasticity' | head -1 | cut -d':' -f2 | tr -d ' ,' || echo 'N/A') && \ + echo 'eip1559Denominator='\$(head -n 50 merged.genesis.json | grep 'eip1559Denominator' | head -1 | cut -d':' -f2 | tr -d ' ,' || echo 'N/A') && \ + echo 'eip1559DenominatorCanyon='\$(head -n 50 merged.genesis.json | grep 'eip1559DenominatorCanyon' | head -1 | cut -d':' -f2 | tr -d ' ,' || echo 'N/A') && \ + echo 'parentHash='\$(tail -n 20 merged.genesis.json | grep -o '\"parentHash\":[[:space:]]*\"0x[0-9a-fA-F]*\"' | cut -d':' -f2 | tr -d ' \"' || echo 'N/A') && \ + echo 'baseFeePerGas='\$(tail -n 20 merged.genesis.json | grep -o '\"baseFeePerGas\":[[:space:]]*\"0x[0-9a-fA-F]*\"' | cut -d':' -f2 | tr -d ' \"' || echo 'N/A') && \ + echo 'timestamp='\$(head -n 50 merged.genesis.json | grep 'timestamp' | head -1 | cut -d':' -f2 | tr -d ' ,' || echo 'N/A')" + + echo "" + echo "=== state.json Configuration ===" + docker exec ${CONTAINER_NAME} bash -c "set -e && cd /app/test-pp-op && \ + echo 'SystemConfigProxy='\$(head -n 200 config-op/state.json | grep 'SystemConfigProxy' | head -1 | cut -d':' -f2 | tr -d ' ,' || echo 'N/A')" + else + echo "" + echo "=== merged.genesis.json Configuration ===" + echo "⚠️ merged.genesis.json will be created during migration" + echo " This file contains the final genesis configuration after migration" + fi - # 4. Check rollup.json echo "" echo "==============================================" - echo "4. Checking config-op/rollup.json" - echo "==============================================" - docker exec ${CONTAINER_NAME} bash -c "set -e && cd /app/test-pp-op && cat config-op/rollup.json" - wait_for_enter "Press ENTER to start migration..." + wait_for_enter "Press ENTER to continue..." echo "" - echo "✅ Configuration verification completed" + echo "✅ Configuration fields extracted and reviewed" } # Function to execute migration @@ -368,9 +443,9 @@ mkdir -p ${SOURCE_PATH} if docker ps -a --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then echo "🗑️ Removing existing container ${CONTAINER_NAME} for clean migration..." - # Give container time to gracefully shutdown (30 seconds) + # Stop container if docker ps --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then - echo " Stopping container (graceful shutdown, timeout 30s)..." + echo " Stopping container..." docker stop ${CONTAINER_NAME} 2>/dev/null || true fi @@ -401,7 +476,7 @@ fi echo "" echo "==============================================" -echo "Step 3: Update ForkBlock And Check" +echo "Step 3: Check configuration" echo "==============================================" if [ "$CHECK_BLOCK" = "true" ]; then @@ -416,25 +491,15 @@ if [ "$CHECK_BLOCK" = "true" ]; then validate_configuration $FETCHED_TIMESTAMP fi -# Call the review function -echo "" -echo "==============================================" -echo "Step 4: Configuration Verification" -echo "==============================================" -echo "Please review the configuration files before migration" -echo "Press ENTER to continue, any other key to abort" -echo "" -review_configuration_files - -# Execute migration and copy results echo "" echo "==============================================" -echo "Step 5: Clean Previous Data" +echo "Step 4: Review Configuration Before Migration" echo "==============================================" +extract_configuration_fields "before" echo "" echo "==============================================" -echo "Step 6: Execute Migration" +echo "Step 5: Execute Migration" echo "==============================================" echo "Executing ./4-migrate-op.sh inside container..." echo "" @@ -442,7 +507,7 @@ execute_migration echo "" echo "==============================================" -echo "Step 7: Copy results to disk" +echo "Step 6: Copy results to disk" echo "==============================================" TEMP_DIR="${BACKUP_DIR}.tmp" @@ -514,10 +579,23 @@ rm -rf "$TEMP_DIR" echo "✅ Files copied successfully" +echo "" +echo "==============================================" +echo "Step 7: Review Configuration After Copy" +echo "==============================================" +extract_configuration_fields "after" + echo "" echo "==============================================" echo "✅ Migration process completed successfully!" echo "==============================================" echo "Backup directory: ${BACKUP_DIR}" +if docker ps --format '{{.Names}}' | grep -q "^${CONTAINER_NAME}$"; then + echo "" + echo "Stopping migration container at last." + echo "" + docker stop ${CONTAINER_NAME} 2>/dev/null || true +fi + echo "=============================================="