Skip to content

Commit 05891f6

Browse files
zjg555543Vui-Chee
andauthored
Pre release v4 (#107)
* update * Drop debug * Restore L2 num + hash after migrate * Revert to allow deploy contracts to succeed * Omit debug from build script * Pull out game factory adress from .env * update * update --------- Co-authored-by: Vui-Chee <[email protected]>
1 parent de4c489 commit 05891f6

File tree

6 files changed

+85
-4
lines changed

6 files changed

+85
-4
lines changed

Dockerfile-contracts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ RUN --mount=type=cache,target=/root/.cache \
2929
# Create final contracts image with artifacts, foundry tools, and op-deployer
3030
FROM debian:bookworm-slim
3131
WORKDIR /app
32-
# RUN apt-get update && apt-get install -y ca-certificates && update-ca-certificates
32+
RUN apt-get update && apt-get install -y ca-certificates && update-ca-certificates
3333

3434
# Set environment variables for Go
3535
ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt

test-pp-op/4-migrate-op.sh

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

test-pp-op/build_images.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/bin/bash
22
set -e
3-
set -x
43

54
# =============================================================================
65
# Build Images Script

test-pp-op/m2-migrate.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ extract_configuration_fields() {
284284
echo 'DISPUTE_GAME_FINALITY_DELAY_SECONDS='\$(grep '^DISPUTE_GAME_FINALITY_DELAY_SECONDS=' .env | cut -d'=' -f2) && \
285285
echo 'CHALLENGE_PERIOD_SECONDS='\$(grep '^CHALLENGE_PERIOD_SECONDS=' .env | cut -d'=' -f2) && \
286286
echo 'WITHDRAWAL_DELAY_SECONDS='\$(grep '^WITHDRAWAL_DELAY_SECONDS=' .env | cut -d'=' -f2) && \
287+
echo 'DISPUTE_GAME_FACTORY_ADDRESS='\$(grep '^DISPUTE_GAME_FACTORY_ADDRESS=' .env | cut -d'=' -f2) && \
287288
echo 'TRANSACTOR='\$(grep '^TRANSACTOR=' .env | cut -d'=' -f2)"
288289

289290
echo ""
@@ -585,6 +586,24 @@ echo "Step 7: Review Configuration After Copy"
585586
echo "=============================================="
586587
extract_configuration_fields "after"
587588

589+
echo ""
590+
echo "=============================================="
591+
echo "Step 8: Copy diff.genesis.json from container"
592+
echo "=============================================="
593+
594+
# Check if diff.genesis.json exists in container
595+
if docker exec ${CONTAINER_NAME} test -f /app/test-pp-op/diff.genesis.json; then
596+
echo "Copying diff.genesis.json from container..."
597+
if docker cp ${CONTAINER_NAME}:/app/test-pp-op/diff.genesis.json ${BACKUP_DIR}/diff.genesis.json; then
598+
echo "✅ diff.genesis.json copied successfully to ${BACKUP_DIR}/diff.genesis.json"
599+
else
600+
echo "⚠️ Warning: Failed to copy diff.genesis.json"
601+
fi
602+
else
603+
echo "⚠️ Warning: diff.genesis.json not found in container"
604+
echo " Expected location: /app/test-pp-op/diff.genesis.json"
605+
fi
606+
588607
echo ""
589608
echo "=============================================="
590609
echo "✅ Migration process completed successfully!"

test-pp-op/m3-verify.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
set -e
3+
set -x
4+
5+
IMAGE_NAME="op-geth-migrate:latest"
6+
CONTAINER_NAME="op-verify-container"
7+
RAMDISK_PATH="${RAMDISK_PATH:-/mnt/ramdisk_op}"
8+
ERIGON_DATA_DIR="${ERIGON_DATA_DIR:-/data/erigon-data}"
9+
OP_GETH_DATA_DIR="${RAMDISK_PATH}/test-pp-op/data/op-geth-seq"
10+
11+
echo "Verifying migration in ramdisk..."
12+
echo " Erigon: ${ERIGON_DATA_DIR}/chaindata"
13+
echo " OP-Geth: ${OP_GETH_DATA_DIR}"
14+
15+
# Basic checks
16+
[ -d "${ERIGON_DATA_DIR}/chaindata" ] || { echo "❌ Erigon chaindata not found at ${ERIGON_DATA_DIR}/chaindata"; exit 1; }
17+
[ -d "${OP_GETH_DATA_DIR}" ] || { echo "❌ OP-Geth data not found at ${OP_GETH_DATA_DIR}"; exit 1; }
18+
19+
# Cleanup old container
20+
docker rm -f ${CONTAINER_NAME} 2>/dev/null || true
21+
22+
# Start container
23+
docker run -d --name ${CONTAINER_NAME} \
24+
-v ${ERIGON_DATA_DIR}:/data/erigon-data \
25+
-v ${RAMDISK_PATH}:${RAMDISK_PATH} \
26+
${IMAGE_NAME} sleep infinity
27+
28+
sleep 2
29+
30+
# Run verification
31+
echo "Running verification..."
32+
docker exec -it ${CONTAINER_NAME} geth verifyMigrate \
33+
--chaindata=/data/erigon-data/chaindata \
34+
--datadir=${OP_GETH_DATA_DIR} \
35+
--standalone-smt=true
36+
37+
RESULT=$?
38+
39+
# Cleanup
40+
docker rm -f ${CONTAINER_NAME} 2>/dev/null || true
41+
42+
exit $RESULT
43+

test-pp-op/utils.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/bin/bash
22
set -e
3-
set -x
43

54
# init-erigon.sh runs outside the container.
65
ROOT_DIR=$(which git &>/dev/null && git rev-parse --show-toplevel || echo "/data")

0 commit comments

Comments
 (0)