WIP: Upgrade Optimism for Granite fork #6

Draft
roysc wants to merge 13 commits from roysc/upgrade-to-granite into main
4 changed files with 17 additions and 32 deletions
Showing only changes of commit 2939d549cd - Show all commits

View File

@ -20,14 +20,15 @@ services:
CERC_PROPOSER_AMOUNT: ${CERC_PROPOSER_AMOUNT}
CERC_BATCHER_AMOUNT: ${CERC_BATCHER_AMOUNT}
volumes:
- ../config/network/wait-for-it.sh:/app/packages/contracts-bedrock/wait-for-it.sh
- ../config/fixturenet-optimism/optimism-contracts/deploy-contracts.sh:/app/packages/contracts-bedrock/deploy-contracts.sh
- ../config/network/wait-for-it.sh:/wait-for-it.sh
- ../config/fixturenet-optimism/optimism-contracts/deploy-contracts.sh:/deploy-contracts.sh
- l2_accounts:/l2-accounts
- l1_deployment:/l1-deployment
- l2_config:/l2-config
entrypoint: ["sh", "-c"]
# Waits for L1 endpoint to be up before running the contract deploy script
command: |
"./wait-for-it.sh -h ${CERC_L1_HOST:-$${DEFAULT_CERC_L1_HOST}} -p ${CERC_L1_PORT:-$${DEFAULT_CERC_L1_PORT}} -s -t 60 -- ./deploy-contracts.sh"
"/wait-for-it.sh -h ${CERC_L1_HOST:-$${DEFAULT_CERC_L1_HOST}} -p ${CERC_L1_PORT:-$${DEFAULT_CERC_L1_PORT}} -s -t 60 -- /deploy-contracts.sh"
extra_hosts:
- "host.docker.internal:host-gateway"

View File

@ -157,7 +157,7 @@ if [ "$create2CodeSize" -eq 0 ]; then
fi
# Create the L2 deployment
# Writes out artifact to /app/packages/contracts-bedrock/deployments/$DEPLOYMENT_CONTEXT-deploy.json
# Writes out artifact to $OPTIMISM_ROOT/packages/contracts-bedrock/deployments/$DEPLOYMENT_CONTEXT-deploy.json
echo "Deploying L1 Optimism contracts..."
DEPLOY_CONFIG_PATH=$deploy_config_file forge script scripts/deploy/Deploy.s.sol:Deploy --private-key $ADMIN_KEY --broadcast --rpc-url $CERC_L1_RPC
echo "Done deploying contracts."
@ -168,14 +168,16 @@ DEPLOY_CONFIG_PATH=$deploy_config_file \
CONTRACT_ADDRESSES_PATH=deployments/$DEPLOYMENT_CONTEXT-deploy.json \
forge script --chain-id $L2_CHAIN_ID scripts/L2Genesis.s.sol:L2Genesis --sig 'runWithAllUpgrades()' --private-key $ADMIN_KEY
cp /app/packages/contracts-bedrock/state-dump-$L2_CHAIN_ID.json allocs-l2.json
OPTIMISM_ROOT=/opt/optimism
cp $OPTIMISM_ROOT/contracts-bedrock/state-dump-$L2_CHAIN_ID.json allocs-l2.json
echo "Done."
echo "*************************************"
# 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"
cp /app/packages/contracts-bedrock/deployments/$DEPLOYMENT_CONTEXT-deploy.json /l1-deployment
cp /app/packages/contracts-bedrock/deploy-config/$DEPLOYMENT_CONTEXT.json /l2-config
cp $OPTIMISM_ROOT/packages/contracts-bedrock/deployments/$DEPLOYMENT_CONTEXT-deploy.json /l1-deployment
cp $OPTIMISM_ROOT/packages/contracts-bedrock/deploy-config/$DEPLOYMENT_CONTEXT.json /l2-config
cp allocs-l2.json /l2-config
echo "Deployment successful. Exiting"

View File

@ -1,24 +0,0 @@
# TODO: Make work for arm64/Apple Silicon
FROM ghcr.io/foundry-rs/foundry:nightly-c4a984fbf2c48b793c8cd53af84f56009dd1070c
RUN apk update
# Install node (use edge repo to get latest version)
RUN apk add --update --no-cache curl wget bash git busybox jq openssl \
&& apk add nodejs --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/main --allow-untrusted \
&& apk add npm \
&& node -v
# Add corepack for yarn and pnpm
RUN npm install -g corepack && corepack enable \
&& yarn --version
WORKDIR /app
# Copy optimism repo contents
COPY . .
RUN echo "Building optimism" && \
pnpm install && pnpm build
WORKDIR /app/packages/contracts-bedrock

View File

@ -6,4 +6,10 @@ source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
# See: https://stackoverflow.com/a/246128/1701505
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
docker build -t cerc/optimism-contracts:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/optimism
# The optimism contracts image has dependencies with no aarch64 support, so on aarch64 use an
# emulated amd64 image
if [[ $(docker info --format='{{ .Architecture }}') == "aarch64" ]]; then
PLATFORM_ARG="--platform linux/amd64"
fi
docker build -t cerc/optimism-contracts:local -f ${CERC_REPO_BASE_DIR}/optimism/ops/docker/Dockerfile.packages ${build_command_args} ${CERC_REPO_BASE_DIR}/optimism $PLATFORM_ARG