Skip to content

Commit

Permalink
Add testnet infra
Browse files Browse the repository at this point in the history
  • Loading branch information
mdehoog committed Oct 7, 2024
1 parent 320d086 commit f4f9e3a
Show file tree
Hide file tree
Showing 12 changed files with 753 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
/out/
/cache/
/broadcast/
/testnet/data/
/testnet/.env
/deployments/*-*-*.json
/bin/
32 changes: 32 additions & 0 deletions deployments/84532-deploy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"AddressManager": "0x42dffe88Be465d26a8858701252b7aa203bB242E",
"AnchorStateRegistryProxy": "0x0000000000000000000000000000000000000001",
"DelayedWETHProxy": "0x0000000000000000000000000000000000000001",
"DeployChain": "0x7caf66E61504FA8E72a261a14b29c815Aa7977D0",
"DisputeGameFactoryProxy": "0x0000000000000000000000000000000000000001",
"L1CrossDomainMessenger": "0x4894Ad99C394cCd9a15fCB883fb46701fE228E52",
"L1CrossDomainMessengerProxy": "0x081415893317739FA0BdE509E5C13E54Aef23a0a",
"L1ERC721Bridge": "0x7452f40900BbF77105bDB7e7b02F06302Bff31c4",
"L1ERC721BridgeProxy": "0xe48337852f6081867E2AfC265b3E5d0475f9d9E5",
"L1StandardBridge": "0xae1840eC043cbdB6be8940b5358545888c09E096",
"L1StandardBridgeProxy": "0xfADd9d89fdE7ba0D6053552820A5fEF42b5Fb2Af",
"L2OutputOracle": "0xfd232ec44005Eed9287a8911cB24b491f642D344",
"L2OutputOracleProxy": "0xe3047c1cFbc2C748DA9cdc9AF973cD74c14c4122",
"OptimismMintableERC20Factory": "0x89ba073Ab54679d50b9660194875900171Ad1C4c",
"OptimismMintableERC20FactoryProxy": "0x1025E8ee4f74743e4DC6acA35387A50d9A1e30A7",
"OptimismPortal": "0x95a59D257723aABfe18b0C52e775ff98866a23f7",
"OptimismPortalProxy": "0x6837dEf8B12Ea8EfB7E2605B435172f6c657d859",
"PermissionedDelayedWETHProxy": "0x0000000000000000000000000000000000000001",
"ProtocolVersions": "0xA78F5256a06c1F811D3F318eCc5F61cbf9467eAD",
"ProtocolVersionsProxy": "0xc572623Fe2045A8d4A6a8065b8F985124d859B4c",
"ProxyAdmin": "0x07D583226bE1636d1b00B479F994a264E183298E",
"SafeProxyFactory": "0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2",
"SafeSingleton": "0xd9Db270c1B5E3Bd161E8c8503c55cEABeE709552",
"SuperchainConfig": "0x3A04210D5c1f6dbDD728349994ed43613d214B8f",
"SuperchainConfigProxy": "0xC3846e5765816020F32E1C5FE6bb90330A28A2Ed",
"SystemConfig": "0xE4bCB6c86320dfC68e41f14C0781Dc847B2B4413",
"SystemConfigGlobal": "0x5695fCCf07aC3aBf2cB11429bB462e710fea08f5",
"SystemConfigGlobalProxy": "0xE03709F06832724b1d562a53F8498A8E4E19Cdd7",
"SystemConfigProxy": "0x8E248445a3943f5c680707dEf0AFAd8D24A29248",
"SystemOwnerSafe": "0xFfe2Ae7C40F70fEa4773F58d39A67526238c2750"
}
64 changes: 64 additions & 0 deletions testnet/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# per deploy
OP_GETH_GENESIS_FILE_PATH=./deployments/84532-<INSERT_CHAIN_ID>-genesis.json
OP_NODE_ROLLUP_CONFIG=./deployments/84532-<INSERT_CHAIN_ID>-rollup-config.json
DEPLOYED_JSON=./deployments/84532-<INSERT_CHAIN_ID>-deployed.json

OP_NODE_P2P_SEQUENCER_KEY=TODO
OP_BATCHER_PRIVATE_KEY=TODO
OP_PROPOSER_PRIVATE_KEY=TODO
OP_ENCLAVE_SIGNER_KEY=TODO

# common
L2_ENGINE_JWT=688f5d737bad920bdfb2fc2f488d6b6209eebda1dae949a8de91398d932c517a

# L1 node URL
OP_NODE_L1_ETH_RPC=https://base-sepolia.rpc.host.url
OP_BATCHER_L1_ETH_RPC=https://base-sepolia.rpc.host.url
OP_PROPOSER_L1_ETH_RPC=https://base-sepolia.rpc.host.url

# op-geth
GETH_DATA_DIR=/data

# op-node
OP_NODE_L1_BEACON_IGNORE=true
OP_NODE_L2_ENGINE_RPC=http://op-geth:8551
OP_NODE_L1_HTTP_POLL_INTERVAL=2s
OP_NODE_L1_TRUST_RPC=true
OP_NODE_RPC_PORT=8545
OP_NODE_RPC_ADDR=0.0.0.0
OP_NODE_SEQUENCER_ENABLED=true
OP_NODE_SEQUENCER_L1_CONFS=0
OP_NODE_ALTDA_ENABLED=true
OP_NODE_ALTDA_DA_SERVICE=true
OP_NODE_ALTDA_DA_SERVER=http://op-da:2583
OP_NODE_LOG_LEVEL=debug

# op-da
OP_DA_DA_URL=file:///data
OP_DA_PORT=2583

# op-batcher
OP_BATCHER_L2_ETH_RPC=http://op-geth:8545
OP_BATCHER_ROLLUP_RPC=http://op-node:8545
OP_BATCHER_MAX_CHANNEL_DURATION=30
OP_BATCHER_NUM_CONFIRMATIONS=1
OP_BATCHER_POLL_INTERVAL=500ms
OP_BATCHER_RPC_PORT=8545
OP_BATCHER_RPC_ENABLE_ADMIN=true
OP_BATCHER_DATA_AVAILABILITY_TYPE=calldata
OP_BATCHER_ALTDA_ENABLED=true
OP_BATCHER_ALTDA_DA_SERVICE=true
OP_BATCHER_ALTDA_DA_SERVER=http://op-da:2583
OP_BATCHER_TXMGR_RECEIPT_QUERY_INTERVAL=1s

# op-proposer
OP_PROPOSER_L2_ETH_RPC=http://op-geth:8545
OP_PROPOSER_ROLLUP_RPC=http://op-node:8545
OP_PROPOSER_ENCLAVE_RPC=http://op-enclave:1234
OP_PROPOSER_ALLOW_NON_FINALIZED=true
OP_PROPOSER_NUM_CONFIRMATIONS=1
OP_PROPOSER_POLL_INTERVAL=500ms
OP_PROPOSER_MIN_PROPOSAL_INTERVAL=100
OP_PROPOSER_TXMGR_RECEIPT_QUERY_INTERVAL=1s
OP_PROPOSER_RPC_PORT=8545
OP_PROPOSER_RPC_ENABLE_ADMIN=true
67 changes: 67 additions & 0 deletions testnet/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
FROM golang:1.22 AS op-node

WORKDIR /app

ENV REPO=https://github.com/mdehoog/optimism.git
ENV VERSION=l3
ENV COMMIT=445adf498c862eaef12e650909938d2abad9d143
RUN git clone $REPO --branch $VERSION --single-branch . && \
git switch -c branch-$VERSION && \
bash -c '[ "$(git rev-parse HEAD)" = "$COMMIT" ]'

RUN cd op-node && \
make VERSION=$VERSION op-node


FROM golang:1.22 AS op-enclave

WORKDIR /app

COPY go.mod go.sum ./
RUN go mod download

COPY bindings/ bindings/
COPY op-enclave/ op-enclave/
COPY op-batcher/ op-batcher/
COPY op-da/ op-da/
COPY op-proposer/ op-proposer/

RUN go build -o bin/op-enclave ./op-enclave/cmd/enclave
RUN go build -o bin/op-batcher ./op-batcher/cmd
RUN go build -o bin/op-proposer ./op-proposer/cmd
RUN go build -o bin/op-da ./op-da/cmd


FROM golang:1.22 AS op-geth

WORKDIR /app

ENV REPO=https://github.com/mdehoog/op-geth.git
ENV VERSION=witness2
ENV COMMIT=d8f4cde5a85265a258dfcd21f0c735d8aefaa07d
RUN git clone $REPO --branch $VERSION --single-branch . && \
git switch -c branch-$VERSION && \
bash -c '[ "$(git rev-parse HEAD)" = "$COMMIT" ]'

RUN go run build/ci.go install -static ./cmd/geth


FROM ubuntu:22.04

RUN apt-get update && apt-get install -y curl jq

WORKDIR /app

COPY --from=op-node /app/op-node/bin/op-node ./
COPY --from=op-geth /app/build/bin/geth ./
COPY --from=op-enclave /app/bin/op-enclave ./
COPY --from=op-enclave /app/bin/op-batcher ./
COPY --from=op-enclave /app/bin/op-proposer ./
COPY --from=op-enclave /app/bin/op-da ./
COPY testnet/entrypoint-batcher.sh ./
COPY testnet/entrypoint-da.sh ./
COPY testnet/entrypoint-enclave.sh ./
COPY testnet/entrypoint-geth.sh ./
COPY testnet/entrypoint-node.sh ./
COPY testnet/entrypoint-proposer.sh ./
COPY deployments/ deployments/
60 changes: 60 additions & 0 deletions testnet/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
services:
op-geth:
build:
context: ..
dockerfile: /Dockerfile
ports:
- "8545:8545"
command: [ "bash", "./entrypoint-geth.sh" ]
volumes:
- ./data/geth:/data
env_file:
- .env
op-node:
build:
context: ..
dockerfile: /Dockerfile
depends_on:
- op-geth
- op-da
ports:
- "7545:8545"
command: [ "bash", "./entrypoint-node.sh" ]
env_file:
- .env
op-da:
build:
context: ..
dockerfile: /Dockerfile
command: [ "bash", "./entrypoint-da.sh" ]
volumes:
- ./data/da:/data
env_file:
- .env
op-batcher:
build:
context: ..
dockerfile: /Dockerfile
depends_on:
- op-geth
- op-node
command: [ "bash", "./entrypoint-batcher.sh" ]
env_file:
- .env
op-proposer:
build:
context: ..
dockerfile: /Dockerfile
depends_on:
- op-geth
- op-node
command: [ "bash", "./entrypoint-proposer.sh" ]
env_file:
- .env
op-enclave:
build:
context: ..
dockerfile: /Dockerfile
command: [ "bash", "./entrypoint-enclave.sh" ]
env_file:
- .env
8 changes: 8 additions & 0 deletions testnet/entrypoint-batcher.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

until [ "$(curl -s -w '%{http_code}' -o /dev/null "$OP_BATCHER_ROLLUP_RPC")" -eq 200 ]; do
echo "waiting for op-node to be ready"
sleep 5
done

exec ./op-batcher
3 changes: 3 additions & 0 deletions testnet/entrypoint-da.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

exec ./op-da
3 changes: 3 additions & 0 deletions testnet/entrypoint-enclave.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

exec ./op-enclave
36 changes: 36 additions & 0 deletions testnet/entrypoint-geth.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

GETH_DATA_DIR=${GETH_DATA_DIR:-/data}
GETH_CHAINDATA_DIR="$GETH_DATA_DIR/geth/chaindata"

mkdir -p $GETH_DATA_DIR
if [ ! -d "$GETH_CHAINDATA_DIR" ]; then
echo "$GETH_CHAINDATA_DIR missing, running init"
echo "Initializing genesis."
./geth init \
--datadir="$GETH_DATA_DIR" \
--state.scheme=hash \
"$OP_GETH_GENESIS_FILE_PATH"
else
echo "$GETH_CHAINDATA_DIR exists."
fi

echo "$L2_ENGINE_JWT" > /tmp/engine.jwt

exec ./geth \
--datadir=/data \
--http \
--http.corsdomain="*" \
--http.vhosts="*" \
--http.addr=0.0.0.0 \
--http.port=8545 \
--http.api=web3,debug,eth,net,engine \
--authrpc.addr=0.0.0.0 \
--authrpc.port=8551 \
--authrpc.vhosts="*" \
--authrpc.jwtsecret=/tmp/engine.jwt \
--syncmode=full \
--gcmode=archive \
--port=30303 \
--state.scheme=hash \
--rollup.disabletxpoolgossip=true
6 changes: 6 additions & 0 deletions testnet/entrypoint-node.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

echo "$L2_ENGINE_JWT" > /tmp/engine.jwt

exec ./op-node \
--l2.jwt-secret=/tmp/engine.jwt
11 changes: 11 additions & 0 deletions testnet/entrypoint-proposer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

OP_PROPOSER_L2OO_ADDRESS=$(jq -r ".Addresses.L2OutputOracle" "$DEPLOYED_JSON")
export OP_PROPOSER_L2OO_ADDRESS

until [ "$(curl -s -w '%{http_code}' -o /dev/null "$OP_PROPOSER_ROLLUP_RPC")" -eq 200 ]; do
echo "waiting for op-node to be ready"
sleep 5
done

exec ./op-proposer
Loading

0 comments on commit f4f9e3a

Please sign in to comment.