forked from cerc-io/stack-orchestrator
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf0e0c5d94 | ||
|
|
7f3a33564a | ||
|
|
10337e77f6 | ||
|
|
7a1ec3f196 | ||
|
|
4beb889e9f |
@@ -95,6 +95,9 @@ def command(ctx, include, exclude, force_rebuild, extra_build_args):
|
||||
container_build_env.update({"CERC_SCRIPT_DEBUG": "true"} if debug else {})
|
||||
container_build_env.update({"CERC_FORCE_REBUILD": "true"} if force_rebuild else {})
|
||||
container_build_env.update({"CERC_CONTAINER_EXTRA_BUILD_ARGS": extra_build_args} if extra_build_args else {})
|
||||
docker_host_env = os.getenv("DOCKER_HOST")
|
||||
if docker_host_env:
|
||||
container_build_env.update({"DOCKER_HOST": docker_host_env})
|
||||
|
||||
def process_container(container):
|
||||
if not quiet:
|
||||
|
||||
@@ -31,7 +31,7 @@ services:
|
||||
- l2_accounts:/l2-accounts
|
||||
- l1_deployment:/app/packages/contracts-bedrock
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
# Generates the config files required for L2 (outputs to volume l2_config)
|
||||
op-node-l2-config-gen:
|
||||
@@ -50,7 +50,7 @@ services:
|
||||
- l2_config:/app
|
||||
command: ["sh", "/app/generate-l2-config.sh"]
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
# Initializes and runs the L2 execution client (outputs to volume l2_geth_data)
|
||||
op-geth:
|
||||
@@ -123,7 +123,30 @@ services:
|
||||
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-batcher.sh"
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
- "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:
|
||||
|
||||
@@ -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
@@ -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
|
||||
@@ -48,7 +48,7 @@ CERC_L2_GETH_PORT="${CERC_L2_GETH_PORT:-${DEFAULT_CERC_L2_GETH_PORT}}"
|
||||
CERC_L2_NODE_HOST="${CERC_L2_NODE_HOST:-${DEFAULT_CERC_L2_NODE_HOST}}"
|
||||
CERC_L2_NODE_PORT="${CERC_L2_NODE_PORT:-${DEFAULT_CERC_L2_NODE_PORT}}"
|
||||
./wait-for-it.sh -h "${CERC_L2_GETH_HOST}" -p "${CERC_L2_GETH_PORT}" -s -t 0
|
||||
./wait-for-it.sh -h "${CERC_L2_GETH_PORT}" -p "${CERC_L2_NODE_PORT}" -s -t 0
|
||||
./wait-for-it.sh -h "${CERC_L2_NODE_HOST}" -p "${CERC_L2_NODE_PORT}" -s -t 0
|
||||
|
||||
export RPC_URL="${CERC_L2_GETH_RPC}"
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ RUN yarn global add http-server
|
||||
# Install old version of MobyMask web app
|
||||
RUN yarn global add @cerc-io/mobymask-ui@0.1.3
|
||||
# Install the LXDAO version of MobyMask web app
|
||||
RUN yarn global add @cerc-io/mobymask-ui-lxdao@npm:@cerc-io/mobymask-ui@0.1.3-lxdao-0.1.0
|
||||
RUN yarn global add @cerc-io/mobymask-ui-lxdao@npm:@cerc-io/mobymask-ui@0.1.3-lxdao-0.1.1
|
||||
|
||||
# Expose port for http
|
||||
EXPOSE 80
|
||||
|
||||
@@ -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"]
|
||||
@@ -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
|
||||
@@ -14,7 +14,7 @@ WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN echo "Building watcher-ts" && \
|
||||
RUN echo "Building mobymask-v2-watcher-ts" && \
|
||||
yarn && yarn build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -69,7 +70,7 @@ docker logs -f <CONTAINER_ID>
|
||||
Stop all services running in the background:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-optimism deploy down
|
||||
laconic-so --stack fixturenet-optimism deploy down 30
|
||||
```
|
||||
|
||||
Clear volumes created by this stack:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -89,7 +90,7 @@ docker logs -f <CONTAINER_ID>
|
||||
Stop all services running in the background:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-optimism deploy --include fixturenet-optimism down
|
||||
laconic-so --stack fixturenet-optimism deploy --include fixturenet-optimism down 30
|
||||
```
|
||||
|
||||
Clear volumes created by this stack:
|
||||
|
||||
@@ -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:
|
||||
@@ -111,7 +111,7 @@ Follow the [demo](./demo.md) to try out the MobyMask app with L2 chain
|
||||
Stop all the services running in background run:
|
||||
|
||||
```bash
|
||||
laconic-so --stack mobymask-v2 deploy-system down
|
||||
laconic-so --stack mobymask-v2 deploy-system down 30
|
||||
```
|
||||
|
||||
Clear volumes created by this stack:
|
||||
|
||||
@@ -99,9 +99,8 @@ laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 --include watcher-mo
|
||||
|
||||
# Expected output (ignore the "The X variable is not set. Defaulting to a blank string." warnings):
|
||||
|
||||
# [+] Running 10/10
|
||||
# [+] Running 9/9
|
||||
# ✔ Network mobymask_v2_default Created 0.1s
|
||||
# ✔ Volume "mobymask_v2_fixturenet_geth_accounts" Created 0.0s
|
||||
# ✔ Volume "mobymask_v2_peers_ids" Created 0.0s
|
||||
# ✔ Volume "mobymask_v2_mobymask_watcher_db_data" Created 0.0s
|
||||
# ✔ Volume "mobymask_v2_mobymask_deployment" Created 0.0s
|
||||
@@ -291,7 +290,6 @@ Clear volumes created by this stack:
|
||||
|
||||
# Expected output:
|
||||
|
||||
# mobymask_v2_fixturenet_geth_accounts
|
||||
# mobymask_v2_mobymask_deployment
|
||||
# mobymask_v2_mobymask_watcher_db_data
|
||||
# mobymask_v2_peers_ids
|
||||
|
||||
@@ -74,7 +74,13 @@ def command(ctx, include, exclude, env_file, cluster, command, extra_args):
|
||||
elif command == "down":
|
||||
if verbose:
|
||||
print("Running compose down")
|
||||
docker.compose.down()
|
||||
|
||||
timeout_arg = None
|
||||
if extra_args_list:
|
||||
timeout_arg=extra_args_list[0]
|
||||
|
||||
# Specify shutdown timeout (default 10s) to give services enough time to shutdown gracefully
|
||||
docker.compose.down(timeout=timeout_arg)
|
||||
elif command == "exec":
|
||||
if extra_args_list is None or len(extra_args_list) < 2:
|
||||
print("Usage: exec <service> <cmd>")
|
||||
|
||||
Reference in New Issue
Block a user