Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

op-contracts: Add script to upgrade from 1.8.0 L2OO to 1.8.0 permissioned. #13315

Open
wants to merge 19 commits into
base: proposal/op-contracts/v1.8.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
##############################################
# ↓ Required ↓ #
##############################################

# Can be "mainnet" or "sepolia"
NETWORK=

# Etherscan API key used to verify contract bytecode
ETHERSCAN_API_KEY=

# RPC URL for the L1 network that matches $NETWORK
ETH_RPC_URL=

# Private key used to deploy the new contracts for this upgrade
PRIVATE_KEY=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Use a base image with necessary tools
FROM ubuntu:20.04

ARG REV
ARG RELEASE=op-contracts/v$REV

# Install required packages
RUN apt-get update && apt-get install -y \
git \
bash \
curl \
build-essential \
jq \
&& rm -rf /var/lib/apt/lists/*

# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"

# Install just
RUN curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin

# Install foundryup
RUN curl -L https://foundry.paradigm.xyz | bash
ENV PATH="/root/.foundry/bin:${PATH}"

# Set the working directory
WORKDIR /app

# Clone the repository at the target branch
RUN git clone -b $RELEASE https://github.com/ethereum-optimism/optimism.git .

# Set the working directory to the root of the monorepo
WORKDIR /app

# Install correct foundry version
RUN just update-foundry

# Set the working directory to the root of the contracts package
WORKDIR /app/packages/contracts-bedrock

# Install dependencies
RUN just install

# Build the contracts package
RUN just prebuild forge-build

COPY . ./scripts/upgrades/v1.8.0-permissioned

# Deliberately run the upgrade script with invalid args to trigger a build
RUN forge script ./scripts/upgrades/v1.8.0-permissioned/DeployUpgrade.s.sol || true

# Set the working directory to where upgrade.sh is located
WORKDIR /app/packages/contracts-bedrock/scripts/upgrades/v1.8.0-permissioned

ENV CONTRACTS_VERSION=$REV

# Set the entrypoint to the main.sh script
ENTRYPOINT ["./scripts/main.sh"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# v1.8.0 L2OO to Permissioned Fault Proofs Upgrader

This directory contains a repeatable task for upgrading a chain running `op-contracts/v1.8.0` in L2OO configuration
to `op-contracts/v1.8.0` in permissioned fault proofs configuration.

## Dependencies

- [`docker`](https://docs.docker.com/engine/install/)
- [`just`](https://github.com/casey/just)
- [`foundry`](https://getfoundry.sh/)

## Usage

For full instructions, including the required preparation and infrastructure changes to perform this upgrade, refer to
the [full runbook](https://github.com/ethereum-optimism/superchain-ops/blob/a8a3f2a1aeda8d916081be3f4e2a8526286faa4d/runbooks/1.8.0-l2oo-to-permissioned-fps.md).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll need to update this link one the runbook is merged.

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Default recipe to list help menu.
default:
@just --list

# Run the deployment / upgrade generation image. If the image is not present locally,
# it will be built.
run deploy-config-path deployment-path output-folder-path="$(pwd)/output/" *args='':
#!/bin/bash
if [ ! "$(docker images -q op-v1.8.0-permissioned:local 2> /dev/null)" ]; then
just build-image
fi

mkdir -p {{output-folder-path}}

# Run the deployment.
docker run -it \
--rm \
-v $(realpath {{output-folder-path}}):/outputs \
-v $(realpath {{deploy-config-path}}):/deploy_config.json \
-v $(realpath {{deployment-path}}):/deployment.json \
--env-file=.env \
op-v1.8.0-permissioned:local /deploy_config.json /deployment.json {{args}}

# Build the image locally.
build-image contracts-version="1.8.0":
docker build \
-t op-v1.8.0-permissioned:local \
-f Dockerfile \
--build-arg REV={{contracts-version}} \
.
Loading