support base

This commit is contained in:
Sebastian
2023-08-26 09:49:18 +02:00
parent 1d956f2ffb
commit 6ca3aa2d4b
12 changed files with 30007 additions and 5 deletions

46
base/Dockerfile Normal file
View File

@@ -0,0 +1,46 @@
FROM golang:1.19 as op
WORKDIR /app
ENV REPO=https://github.com/ethereum-optimism/optimism.git
ENV VERSION=v1.1.1
# for verification:
ENV COMMIT=89ed69d80bbec7f2b1dd69e7e48cb7119839d58a
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.19 as geth
WORKDIR /app
ENV REPO=https://github.com/ethereum-optimism/op-geth.git
ENV VERSION=v1.101200.1-rc.2
# for verification:
ENV COMMIT=368310232f16b7697d3a79ea7f946f0b2b21ab3f
# 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

68
base/geth-entrypoint Executable file
View File

@@ -0,0 +1,68 @@
#!/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=""
mkdir -p $GETH_DATA_DIR
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=archive \
--nodiscover \
--maxpeers=100 \
--nat=extip:$HOST_IP \
--networkid="$CHAIN_ID" \
--rollup.sequencerhttp="$OP_GETH_SEQUENCER_HTTP" \
--port="$P2P_PORT" \
$ADDITIONAL_ARGS # intentionally unquoted

15253
base/goerli/genesis-l2.json Executable file

File diff suppressed because one or more lines are too long

29
base/goerli/rollup.json Executable file
View File

@@ -0,0 +1,29 @@
{
"genesis": {
"l1": {
"hash": "0x73d89754a1e0387b89520d989d3be9c37c1f32495a88faf1ea05c61121ab0d19",
"number": 8410981
},
"l2": {
"hash": "0xa3ab140f15ea7f7443a4702da64c10314eb04d488e72974e02e2d728096b4f76",
"number": 0
},
"l2_time": 1675193616,
"system_config": {
"batcherAddr": "0x2d679b567db6187c0c8323fa982cfb88b74dbcc7",
"overhead": "0x0000000000000000000000000000000000000000000000000000000000000834",
"scalar": "0x00000000000000000000000000000000000000000000000000000000000f4240",
"gasLimit": 25000000
}
},
"block_time": 2,
"max_sequencer_drift": 600,
"seq_window_size": 3600,
"channel_timeout": 300,
"l1_chain_id": 5,
"l2_chain_id": 84531,
"batch_inbox_address": "0x8453100000000000000000000000000000000000",
"deposit_contract_address": "0xe93c8cd0d409341205a592f8c4ac1a5fe5585cfa",
"l1_system_config_address": "0xb15eea247ece011c68a614e4a77ad648ff495bc1",
"regolith_time": 1683219600
}

14472
base/mainnet/genesis-l2.json Executable file

File diff suppressed because one or more lines are too long

29
base/mainnet/rollup.json Executable file
View File

@@ -0,0 +1,29 @@
{
"genesis": {
"l1": {
"hash": "0x5c13d307623a926cd31415036c8b7fa14572f9dac64528e857a470511fc30771",
"number": 17481768
},
"l2": {
"hash": "0xf712aa9241cc24369b143cf6dce85f0902a9731e70d66818a3a5845b296c73dd",
"number": 0
},
"l2_time": 1686789347,
"system_config": {
"batcherAddr": "0x5050f69a9786f081509234f1a7f4684b5e5b76c9",
"overhead": "0x00000000000000000000000000000000000000000000000000000000000000bc",
"scalar": "0x00000000000000000000000000000000000000000000000000000000000a6fe0",
"gasLimit": 30000000
}
},
"block_time": 2,
"max_sequencer_drift": 600,
"seq_window_size": 3600,
"channel_timeout": 300,
"l1_chain_id": 1,
"l2_chain_id": 8453,
"regolith_time": 0,
"batch_inbox_address": "0xff00000000000000000000000000000000008453",
"deposit_contract_address": "0x49048044d57e1c92a77f79988d21fa8faf74e97e",
"l1_system_config_address": "0x73a79fab69143498ed3712e519a88a918e1f4072"
}

16
base/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