forked from cerc-io/stack-orchestrator
Upgrade Optimism and add op-proposer (#364)
* Use the latest stable optimism release * Remove unnecessary repos from repo-list * Add op-proposer service to fixturenet-optimism stack * Add jq and bash to op-proposer image * Update instructions * Update op-batcher and op-geth commands
This commit is contained in:
parent
d7ea874268
commit
988be0ef9a
@ -125,6 +125,29 @@ services:
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
# Runs the proposer (periodically submits new state roots to L1)
|
||||
op-proposer:
|
||||
image: cerc/optimism-op-proposer:local
|
||||
depends_on:
|
||||
op-node:
|
||||
condition: service_healthy
|
||||
env_file:
|
||||
- ../config/fixturenet-optimism/l1-params.env
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
CERC_L1_RPC: ${CERC_L1_RPC}
|
||||
volumes:
|
||||
- ../config/wait-for-it.sh:/wait-for-it.sh
|
||||
- ../config/fixturenet-optimism/run-op-proposer.sh:/run-op-proposer.sh
|
||||
- l1_deployment:/contracts-bedrock:ro
|
||||
- l2_accounts:/l2-accounts:ro
|
||||
entrypoint: ["sh", "-c"]
|
||||
# Waits for L1 endpoint to be up before running the proposer
|
||||
command: |
|
||||
"/wait-for-it.sh -h ${CERC_L1_HOST:-$${DEFAULT_CERC_L1_HOST}} -p ${CERC_L1_PORT:-$${DEFAULT_CERC_L1_PORT}} -s -t 60 -- /run-op-proposer.sh"
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
volumes:
|
||||
l1_deployment:
|
||||
l2_accounts:
|
||||
|
@ -76,6 +76,13 @@ else
|
||||
echo "Couldn't fetch L1 account credentials, using them from env"
|
||||
fi
|
||||
|
||||
# Send balances to the above L2 addresses
|
||||
yarn hardhat send-balance --to "${ADMIN_ADDRESS}" --amount 2 --private-key "${CERC_L1_PRIV_KEY}" --network getting-started
|
||||
yarn hardhat send-balance --to "${PROPOSER_ADDRESS}" --amount 5 --private-key "${CERC_L1_PRIV_KEY}" --network getting-started
|
||||
yarn hardhat send-balance --to "${BATCHER_ADDRESS}" --amount 1000 --private-key "${CERC_L1_PRIV_KEY}" --network getting-started
|
||||
|
||||
echo "Balances sent to L2 accounts"
|
||||
|
||||
# Select a finalized L1 block as the starting point for roll ups
|
||||
until FINALIZED_BLOCK=$(cast block finalized --rpc-url "$CERC_L1_RPC"); do
|
||||
echo "Waiting for a finalized L1 block to exist, retrying after 10s"
|
||||
@ -88,13 +95,6 @@ L1_BLOCKTIMESTAMP=$(echo "$FINALIZED_BLOCK" | awk '/timestamp/{print $2}')
|
||||
|
||||
echo "Selected L1 block ${L1_BLOCKNUMBER} as the starting block for roll ups"
|
||||
|
||||
# Send balances to the above L2 addresses
|
||||
yarn hardhat send-balance --to "${ADMIN_ADDRESS}" --amount 2 --private-key "${CERC_L1_PRIV_KEY}" --network getting-started
|
||||
yarn hardhat send-balance --to "${PROPOSER_ADDRESS}" --amount 5 --private-key "${CERC_L1_PRIV_KEY}" --network getting-started
|
||||
yarn hardhat send-balance --to "${BATCHER_ADDRESS}" --amount 1000 --private-key "${CERC_L1_PRIV_KEY}" --network getting-started
|
||||
|
||||
echo "Balances sent to L2 accounts"
|
||||
|
||||
# Update the deployment config
|
||||
sed -i 's/"l2OutputOracleStartingTimestamp": TIMESTAMP/"l2OutputOracleStartingTimestamp": '"$L1_BLOCKTIMESTAMP"'/g' deploy-config/getting-started.json
|
||||
jq --arg chainid "$CERC_L1_CHAIN_ID" '.l1ChainID = ($chainid | tonumber)' deploy-config/getting-started.json > tmp.json && mv tmp.json deploy-config/getting-started.json
|
||||
@ -110,7 +110,7 @@ echo "PRIVATE_KEY_DEPLOYER=$ADMIN_PRIV_KEY" >> .env
|
||||
echo "Deploying the L1 smart contracts, this will take a while..."
|
||||
|
||||
# Deploy the L1 smart contracts
|
||||
yarn hardhat deploy --network getting-started
|
||||
yarn hardhat deploy --network getting-started --tags l1
|
||||
|
||||
echo "Deployed the L1 smart contracts"
|
||||
|
||||
|
@ -6,7 +6,7 @@ fi
|
||||
|
||||
CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
|
||||
|
||||
# Get BACTHER_KEY from keys.json
|
||||
# Get Batcher key from keys.json
|
||||
BATCHER_KEY=$(jq -r '.Batcher.privateKey' /l2-accounts/keys.json | tr -d '"')
|
||||
|
||||
cleanup() {
|
||||
@ -18,6 +18,7 @@ cleanup() {
|
||||
}
|
||||
trap 'cleanup' INT TERM
|
||||
|
||||
# Run op-batcher
|
||||
op-batcher \
|
||||
--l2-eth-rpc=http://op-geth:8545 \
|
||||
--rollup-rpc=http://op-node:8547 \
|
||||
@ -30,7 +31,6 @@ op-batcher \
|
||||
--rpc.port=8548 \
|
||||
--rpc.enable-admin \
|
||||
--max-channel-duration=1 \
|
||||
--target-l1-tx-size-bytes=2048 \
|
||||
--l1-eth-rpc=$CERC_L1_RPC \
|
||||
--private-key=$BATCHER_KEY \
|
||||
&
|
||||
|
@ -8,7 +8,7 @@ fi
|
||||
echo "Installing jq"
|
||||
apk update && apk add jq
|
||||
|
||||
# Get SEQUENCER key from keys.json
|
||||
# Get Sequencer key from keys.json
|
||||
SEQUENCER_KEY=$(jq -r '.Sequencer.privateKey' /l2-accounts/keys.json | tr -d '"')
|
||||
|
||||
# Initialize op-geth if datadir/geth not found
|
||||
@ -70,7 +70,7 @@ geth \
|
||||
--ws.origins="*" \
|
||||
--ws.api=debug,eth,txpool,net,engine \
|
||||
--syncmode=full \
|
||||
--gcmode=full \
|
||||
--gcmode=archive \
|
||||
--nodiscover \
|
||||
--maxpeers=0 \
|
||||
--networkid=42069 \
|
||||
|
@ -6,9 +6,10 @@ fi
|
||||
|
||||
CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
|
||||
|
||||
# Get SEQUENCER KEY from keys.json
|
||||
# Get Sequencer key from keys.json
|
||||
SEQUENCER_KEY=$(jq -r '.Sequencer.privateKey' /l2-accounts/keys.json | tr -d '"')
|
||||
|
||||
# Run op-node
|
||||
op-node \
|
||||
--l2=http://op-geth:8551 \
|
||||
--l2.jwt-secret=/op-node-data/jwt.txt \
|
||||
|
36
app/data/config/fixturenet-optimism/run-op-proposer.sh
Executable file
36
app/data/config/fixturenet-optimism/run-op-proposer.sh
Executable file
@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
|
||||
|
||||
# Read the L2OutputOracle contract address from the deployment
|
||||
L2OO_DEPLOYMENT=$(cat /contracts-bedrock/deployments/getting-started/L2OutputOracle.json)
|
||||
L2OO_ADDR=$(echo "$L2OO_DEPLOYMENT" | jq -r '.address')
|
||||
|
||||
# Get Proposer key from keys.json
|
||||
PROPOSER_KEY=$(jq -r '.Proposer.privateKey' /l2-accounts/keys.json | tr -d '"')
|
||||
|
||||
cleanup() {
|
||||
echo "Signal received, cleaning up..."
|
||||
kill ${proposer_pid}
|
||||
|
||||
wait
|
||||
echo "Done"
|
||||
}
|
||||
trap 'cleanup' INT TERM
|
||||
|
||||
# Run op-proposer
|
||||
op-proposer \
|
||||
--poll-interval 12s \
|
||||
--rpc.port 8560 \
|
||||
--rollup-rpc http://op-node:8547 \
|
||||
--l2oo-address $L2OO_ADDR \
|
||||
--private-key $PROPOSER_KEY \
|
||||
--l1-eth-rpc $CERC_L1_RPC \
|
||||
&
|
||||
|
||||
proposer_pid=$!
|
||||
wait $proposer_pid
|
@ -1,4 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Build cerc/optimism-l2geth
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
docker build -t cerc/optimism-l2geth:local ${build_command_args} ${CERC_REPO_BASE_DIR}/op-geth
|
||||
|
@ -1,6 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Build cerc/optimism-op-batcher
|
||||
# TODO: use upstream Dockerfile once its buildx-specific content has been removed
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
docker build -t cerc/optimism-op-batcher:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/optimism
|
||||
|
@ -1,6 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Build cerc/optimism-op-node
|
||||
# TODO: use upstream Dockerfile once its buildx-specific content has been removed
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
docker build -t cerc/optimism-op-node:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/optimism
|
||||
|
@ -0,0 +1,31 @@
|
||||
FROM golang:1.19.0-alpine3.15 as builder
|
||||
|
||||
ARG VERSION=v0.0.0
|
||||
|
||||
RUN apk add --no-cache make gcc musl-dev linux-headers git jq bash
|
||||
|
||||
# build op-proposer with the shared go.mod & go.sum files
|
||||
COPY ./op-proposer /app/op-proposer
|
||||
COPY ./op-bindings /app/op-bindings
|
||||
COPY ./op-node /app/op-node
|
||||
COPY ./op-service /app/op-service
|
||||
COPY ./op-signer /app/op-signer
|
||||
COPY ./go.mod /app/go.mod
|
||||
COPY ./go.sum /app/go.sum
|
||||
COPY ./.git /app/.git
|
||||
|
||||
WORKDIR /app/op-proposer
|
||||
|
||||
RUN go mod download
|
||||
|
||||
ARG TARGETOS TARGETARCH
|
||||
|
||||
RUN make op-proposer VERSION="$VERSION" GOOS=$TARGETOS GOARCH=$TARGETARCH
|
||||
|
||||
FROM alpine:3.15
|
||||
|
||||
RUN apk add --no-cache jq bash
|
||||
|
||||
COPY --from=builder /app/op-proposer/bin/op-proposer /usr/local/bin
|
||||
|
||||
CMD ["op-proposer"]
|
8
app/data/container-build/cerc-optimism-op-proposer/build.sh
Executable file
8
app/data/container-build/cerc-optimism-op-proposer/build.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Build cerc/optimism-op-proposer
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
docker build -t cerc/optimism-op-proposer:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/optimism
|
@ -35,3 +35,4 @@ cerc/act-runner-task-executor
|
||||
cerc/optimism-l2geth
|
||||
cerc/optimism-op-batcher
|
||||
cerc/optimism-op-node
|
||||
cerc/optimism-op-proposer
|
||||
|
@ -10,7 +10,6 @@ laconicd
|
||||
fixturenet-laconicd
|
||||
fixturenet-eth
|
||||
fixturenet-eth-metrics
|
||||
watcher-ts
|
||||
watcher-mobymask
|
||||
watcher-erc20
|
||||
watcher-erc721
|
||||
|
@ -13,8 +13,6 @@ cerc-io/laconic-console
|
||||
cerc-io/mobymask-watcher
|
||||
cerc-io/watcher-ts
|
||||
cerc-io/mobymask-v2-watcher-ts
|
||||
cerc-io/react-peer
|
||||
cerc-io/mobymask-ui
|
||||
cerc-io/MobyMask
|
||||
vulcanize/uniswap-watcher-ts
|
||||
vulcanize/uniswap-v3-info
|
||||
|
@ -19,7 +19,7 @@ Checkout to the required versions and branches in repos:
|
||||
```bash
|
||||
# Optimism
|
||||
cd ~/cerc/optimism
|
||||
git checkout @eth-optimism/sdk@0.0.0-20230329025055
|
||||
git checkout v1.0.3
|
||||
```
|
||||
|
||||
Build the container images:
|
||||
@ -36,8 +36,9 @@ This should create the required docker images in the local image registry:
|
||||
* `cerc/foundry`
|
||||
* `cerc/optimism-contracts`
|
||||
* `cerc/optimism-l2geth`
|
||||
* `cerc/optimism-op-batcher`
|
||||
* `cerc/optimism-op-node`
|
||||
* `cerc/optimism-op-batcher`
|
||||
* `cerc/optimism-op-proposer`
|
||||
|
||||
## Deploy
|
||||
|
||||
|
@ -19,21 +19,22 @@ Checkout to the required versions and branches in repos:
|
||||
```bash
|
||||
# Optimism
|
||||
cd ~/cerc/optimism
|
||||
git checkout @eth-optimism/sdk@0.0.0-20230329025055
|
||||
git checkout v1.0.3
|
||||
```
|
||||
|
||||
Build the container images:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-optimism build-containers --include cerc/foundry,cerc/optimism-contracts,cerc/optimism-op-node,cerc/optimism-l2geth,cerc/optimism-op-batcher
|
||||
laconic-so --stack fixturenet-optimism build-containers --include cerc/foundry,cerc/optimism-contracts,cerc/optimism-op-node,cerc/optimism-l2geth,cerc/optimism-op-batcher,cerc/optimism-op-proposer
|
||||
```
|
||||
|
||||
This should create the required docker images in the local image registry:
|
||||
* `cerc/foundry`
|
||||
* `cerc/optimism-contracts`
|
||||
* `cerc/optimism-l2geth`
|
||||
* `cerc/optimism-op-batcher`
|
||||
* `cerc/optimism-op-node`
|
||||
* `cerc/optimism-op-batcher`
|
||||
* `cerc/optimism-op-proposer`
|
||||
|
||||
## Deploy
|
||||
|
||||
|
@ -16,6 +16,7 @@ containers:
|
||||
- cerc/optimism-op-node
|
||||
- cerc/optimism-l2geth
|
||||
- cerc/optimism-op-batcher
|
||||
- cerc/optimism-op-proposer
|
||||
pods:
|
||||
- fixturenet-eth
|
||||
- fixturenet-optimism
|
||||
|
@ -35,7 +35,7 @@ git checkout v0.1.2
|
||||
|
||||
# Optimism
|
||||
cd ~/cerc/optimism
|
||||
git checkout @eth-optimism/sdk@0.0.0-20230329025055
|
||||
git checkout v1.0.3
|
||||
```
|
||||
|
||||
Build the container images:
|
||||
|
Loading…
Reference in New Issue
Block a user