@@ -149,14 +149,35 @@ migrate() {
149149 fi
150150
151151 echo " GETH_CMD: $GETH_CMD "
152- ${GETH_CMD} --datadir=${OP_DATA_DIR} --gcmode=archive migrate --state.scheme=hash --ignore-addresses=0x000000000000000000000000000000005ca1ab1e --chaindata=${ERIGON_CHAINDATA_DIR} --smt-db-path=${ERIGON_SMTDATA_DIR} --output merged.genesis.json ${OP_GENESIS_PATH} 2>&1 | tee migrate.log
152+ # Build the base command
153+ MIGRATE_CMD=" ${GETH_CMD} --datadir=${OP_DATA_DIR} --gcmode=archive migrate --state.scheme=hash --ignore-addresses=0x000000000000000000000000000000005ca1ab1e --chaindata=${ERIGON_CHAINDATA_DIR} --smt-db-path=${ERIGON_SMTDATA_DIR} --output merged.genesis.json"
154+
155+ # Add --override-proposer if TIMELOCK_OVERRIDE_PROPOSER_ADDRESS is set and non-empty
156+ if [ -n " ${TIMELOCK_OVERRIDE_PROPOSER_ADDRESS:- } " ]; then
157+ MIGRATE_CMD=" $MIGRATE_CMD --override-proposer=${TIMELOCK_OVERRIDE_PROPOSER_ADDRESS} "
158+ fi
159+
160+ # Add --override-executor if TIMELOCK_OVERRIDE_EXECUTOR_ADDRESS is set and non-empty
161+ if [ -n " ${TIMELOCK_OVERRIDE_EXECUTOR_ADDRESS:- } " ]; then
162+ MIGRATE_CMD=" $MIGRATE_CMD --override-executor=${TIMELOCK_OVERRIDE_EXECUTOR_ADDRESS} "
163+ fi
164+
165+ # Add the genesis path at the end
166+ MIGRATE_CMD=" $MIGRATE_CMD ${OP_GENESIS_PATH} "
167+
168+ # Execute the command
169+ $MIGRATE_CMD 2>&1 | tee migrate.log
153170
154171 LOG_BLOCK=$( grep -A 5 " Update rollup.json file with the following information l2" migrate.log | tail -n 5)
155172 L2_NUMBER=$( echo " $LOG_BLOCK " | grep ' "number"' | sed ' s/[^0-9]*\([0-9]*\).*/\1/' )
156173 L2_HASH=$( echo " $LOG_BLOCK " | grep ' "hash"' | sed ' s/.*"\(0x[0-9a-fA-F]*\)".*/\1/' )
157174 echo " L2_NUMBER: $L2_NUMBER "
158175 echo " L2_HASH: $L2_HASH "
159176
177+ jq --argjson num " $L2_NUMBER " --arg hash " $L2_HASH " \
178+ ' .genesis.l2.number = $num | .genesis.l2.hash = $hash' \
179+ config-op/rollup.json > config-op/rollup.json.tmp && mv config-op/rollup.json.tmp config-op/rollup.json
180+
160181 # Update eip1559DenominatorCanyon to match eip1559Denominator in rollup.json
161182 echo " 🔧 Updating eip1559DenominatorCanyon to match eip1559Denominator..."
162183
0 commit comments