try to generalize op stack

This commit is contained in:
Sebastian
2024-02-17 08:27:26 +01:00
parent 714c5cb1c8
commit 0568929aa6
7 changed files with 15602 additions and 0 deletions

46
op/#Dockerfile# Normal file
View File

@@ -0,0 +1,46 @@
FROM golang:1.20 as op
WORKDIR /app
ENV REPO=https://github.com/ethereum-optimism/optimism.git
ENV VERSION=v1.4.2
# for verification:
ENV COMMIT=f2229b8b955e53408be0775a22d7f9f162b0de66
RUN git clone $REPO --branch op-node/$VERSION --single-branch . && \
git switch -c branch-$VERSION && \
bash -c '[ "$(git rev-parse HEAD)" = "$COMMIT" ]'
RUN cd op-node && \
make op-node
FROM golang:1.20 as geth
WORKDIR /app
ENV REPO=https://github.com/ethereum-optimism/op-geth.git
ENV VERSION=v1.1801304.2
# for verification:
ENV COMMIT=c6b416da212fe6713ff40b8092303d0035405a47
# avoid depth=1, so the geth build can read tags
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 golang:1.19
RUN apt-get update && \
apt-get install -y jq curl && \
rm -rf /var/lib/apt/lists
WORKDIR /app
COPY --from=op /app/op-node/bin/op-node ./
COPY --from=geth /app/build/bin/geth ./
COPY geth-entrypoint .
COPY op-node-entrypoint .
COPY goerli ./goerli
COPY mainnet ./mainnet

46
op/Dockerfile Normal file
View File

@@ -0,0 +1,46 @@
FROM golang:1.20 as op
WORKDIR /app
ENV REPO=https://github.com/ethereum-optimism/optimism.git
ENV VERSION=v1.4.2
# for verification:
ENV COMMIT=f2229b8b955e53408be0775a22d7f9f162b0de66
RUN git clone $REPO --branch op-node/$VERSION --single-branch . && \
git switch -c branch-$VERSION && \
bash -c '[ "$(git rev-parse HEAD)" = "$COMMIT" ]'
RUN cd op-node && \
make op-node
FROM golang:1.20 as geth
WORKDIR /app
ENV REPO=https://github.com/ethereum-optimism/op-geth.git
ENV VERSION=v1.101304.2
# for verification:
ENV COMMIT=c6b416da212fe6713ff40b8092303d0035405a47
# avoid depth=1, so the geth build can read tags
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 golang:1.19
RUN apt-get update && \
apt-get install -y jq curl && \
rm -rf /var/lib/apt/lists
WORKDIR /app
COPY --from=op /app/op-node/bin/op-node ./
COPY --from=geth /app/build/bin/geth ./
COPY geth-entrypoint .
COPY op-node-entrypoint .
COPY sepolia ./sepolia
COPY mainnet ./mainnet

73
op/geth-entrypoint Executable file
View File

@@ -0,0 +1,73 @@
#!/bin/bash
set -eu
VERBOSITY=${GETH_VERBOSITY:-3}
GETH_DATA_DIR=/data
GETH_CHAINDATA_DIR="$GETH_DATA_DIR/geth/chaindata"
OP_GETH_GENESIS_FILE_PATH="${OP_GETH_GENESIS_FILE_PATH:-/genesis.json}"
CHAIN_ID=$(jq -r .config.chainId < "$OP_GETH_GENESIS_FILE_PATH")
RPC_PORT="${RPC_PORT:-8545}"
WS_PORT="${WS_PORT:-8546}"
AUTHRPC_PORT="${AUTHRPC_PORT:-8551}"
METRICS_PORT="${METRICS_PORT:-6060}"
HOST_IP="0.0.0.0"
P2P_PORT="${P2P_PORT:-30303}"
ADDITIONAL_ARGS=""
if [ ! -d "$GETH_CHAINDATA_DIR" ]; then
echo "$GETH_CHAINDATA_DIR missing, running init"
echo "Initializing genesis."
./geth --verbosity="$VERBOSITY" init \
--datadir="$GETH_DATA_DIR" \
"$OP_GETH_GENESIS_FILE_PATH"
else
echo "$GETH_CHAINDATA_DIR exists."
fi
echo "$OP_NODE_L2_ENGINE_AUTH_RAW" > "$OP_NODE_L2_ENGINE_AUTH"
if [ "${OP_GETH_ETH_STATS+x}" = x ]; then
ADDITIONAL_ARGS="$ADDITIONAL_ARGS --ethstats=$OP_GETH_ETH_STATS"
fi
if [ "${OP_GETH_ALLOW_UNPROTECTED_TXS+x}" = x ]; then
ADDITIONAL_ARGS="$ADDITIONAL_ARGS --rpc.allow-unprotected-txs=$OP_GETH_ALLOW_UNPROTECTED_TXS"
fi
exec ./geth \
--datadir="$GETH_DATA_DIR" \
--verbosity="$VERBOSITY" \
--http \
--http.corsdomain="*" \
--http.vhosts="*" \
--http.addr=0.0.0.0 \
--http.port="$RPC_PORT" \
--http.api=web3,debug,eth,net,engine \
--authrpc.addr=0.0.0.0 \
--authrpc.port="$AUTHRPC_PORT" \
--authrpc.vhosts="*" \
--authrpc.jwtsecret="$OP_NODE_L2_ENGINE_AUTH" \
--ws \
--ws.addr=0.0.0.0 \
--ws.port="$WS_PORT" \
--ws.origins="*" \
--ws.api=debug,eth,net,engine \
--metrics \
--metrics.addr=0.0.0.0 \
--metrics.port="$METRICS_PORT" \
--syncmode=full \
--gcmode=${OP_GETH_GCMODE:-full} \
--state.scheme=${OP_GETH_STATE_SCHEME:-path} \
--db.engine=${GETH_DB_ENGINE:-pebble} \
--discovery.port=${P2P_PORT:-30303} \
--nodiscover \
--maxpeers=100 \
--nat=extip:$HOST_IP \
--networkid="$CHAIN_ID" \
--op-network="$CHAIN_NAME" \
--rollup.halt=major \
--rollup.sequencerhttp="$OP_GETH_SEQUENCER_HTTP" \
--port="$P2P_PORT" \
$ADDITIONAL_ARGS # intentionally unquoted

15303
op/lisk-sepolia/genesis.json Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,34 @@
{
"genesis": {
"l1": {
"hash": "0x7d9d6dcec39efe182119f41b1bd2aa7b35b82e43927522afea86d210a4eace4b",
"number": 5089851
},
"l2": {
"hash": "0xead3e6ddd08ae7e27fd952b74ceb468ba889047ac96b351dd13bd55e5faf3372",
"number": 0
},
"l2_time": 1705312992,
"system_config": {
"scalar": "0x00000000000000000000000000000000000000000000000000000000000f4240",
"gasLimit": 30000000,
"overhead": "0x0000000000000000000000000000000000000000000000000000000000000834",
"batcherAddr": "0x246e119a5bcc2875161b23e4e602e25cece96e37",
"basefeeScalar": 0,
"blobBasefeeScalar": 0
}
},
"block_time": 2,
"delta_time": 0,
"canyon_time": 0,
"l1_chain_id": 11155111,
"l2_chain_id": 4202,
"regolith_time": 0,
"channel_timeout": 300,
"seq_window_size": 3600,
"batch_inbox_address": "0xff00000000000000000000000000000000004202",
"max_sequencer_drift": 600,
"deposit_contract_address": "0xe3d90f21490686ec7ef37be788e02dfc12787264",
"l1_system_config_address": "0xf54791059df4a12ba461b881b4080ae81a1d0ac0",
"protocol_versions_address": "0x0000000000000000000000000000000000000000"
}

16
op/op-node-entrypoint Executable file
View File

@@ -0,0 +1,16 @@
#!/bin/bash
set -eu
# wait until local geth comes up (authed so will return 401 without token)
until [ "$(curl -s -w '%{http_code}' -o /dev/null "$OP_NODE_L2_ENGINE_RPC")" -eq 401 ]; do
echo "waiting for geth to be ready"
sleep 5
done
# public-facing P2P node, advertise public IP address
PUBLIC_IP=$(curl -s v4.ident.me)
export OP_NODE_P2P_ADVERTISE_IP=$PUBLIC_IP
echo "$OP_NODE_L2_ENGINE_AUTH_RAW" > "$OP_NODE_L2_ENGINE_AUTH"
exec ./op-node