Skip to content

Commit

Permalink
Merge pull request #110 from Chomtana/main
Browse files Browse the repository at this point in the history
feat: op-sepolia support
  • Loading branch information
Chomtana authored Dec 30, 2023
2 parents c07bf09 + 8c0719f commit 504d96b
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 22 deletions.
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ services:
dockerfile: Dockerfile.bedrock-init
entrypoint: /scripts/init-bedrock.sh
env_file:
- ./envs/${NETWORK_NAME}/op-geth.env
- .env
volumes:
- ./scripts/:/scripts
Expand Down
2 changes: 2 additions & 0 deletions envs/op-sepolia/op-geth.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BEDROCK_SEQUENCER_HTTP=https://sepolia-sequencer.optimism.io
BEDROCK_DATADIR=/geth
Empty file added envs/op-sepolia/op-node.env
Empty file.
32 changes: 16 additions & 16 deletions scripts/init-bedrock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ source ./scripts/utils.sh
# Common variables.
INITIALIZED_FLAG=/shared/initialized.txt
BEDROCK_JWT_PATH=/shared/jwt.txt
GETH_DATA_DIR=/geth
GETH_DATA_DIR=$BEDROCK_DATADIR
TORRENTS_DIR=/torrents/$NETWORK_NAME
BEDROCK_TAR_PATH=/downloads/bedrock.tar
BEDROCK_TMP_PATH=/bedrock-tmp
Expand All @@ -27,26 +27,26 @@ if [ "$NETWORK_NAME" = "op-mainnet" ]; then
BEDROCK_TAR_DOWNLOAD="https://datadirs.optimism.io/mainnet-bedrock.tar.zst"
elif [ "$NETWORK_NAME" = "op-goerli" ]; then
BEDROCK_TAR_DOWNLOAD="https://datadirs.optimism.io/goerli-bedrock.tar.zst"
else
BEDROCK_TAR_DOWNLOAD=$(config "bedrock/$NETWORK_NAME/bedrock-download")
fi

if [[ "$BEDROCK_TAR_DOWNLOAD" == *.zst ]]; then
BEDROCK_TAR_PATH+=".zst"
fi
if [ -n "${BEDROCK_TAR_DOWNLOAD+x}" ]; then
if [[ "$BEDROCK_TAR_DOWNLOAD" == *.zst ]]; then
BEDROCK_TAR_PATH+=".zst"
fi

echo "Downloading bedrock.tar..."
download $BEDROCK_TAR_DOWNLOAD $BEDROCK_TAR_PATH
echo "Downloading bedrock.tar..."
download $BEDROCK_TAR_DOWNLOAD $BEDROCK_TAR_PATH

echo "Extracting bedrock.tar..."
if [[ "$BEDROCK_TAR_DOWNLOAD" == *.zst ]]; then
extractzst $BEDROCK_TAR_PATH $GETH_DATA_DIR
else
extract $BEDROCK_TAR_PATH $GETH_DATA_DIR
fi
echo "Extracting bedrock.tar..."
if [[ "$BEDROCK_TAR_DOWNLOAD" == *.zst ]]; then
extractzst $BEDROCK_TAR_PATH $GETH_DATA_DIR
else
extract $BEDROCK_TAR_PATH $GETH_DATA_DIR
fi

# Remove tar file to save disk space
rm $BEDROCK_TAR_PATH
# Remove tar file to save disk space
rm $BEDROCK_TAR_PATH
fi

echo "Creating JWT..."
mkdir -p $(dirname $BEDROCK_JWT_PATH)
Expand Down
6 changes: 3 additions & 3 deletions scripts/start-op-geth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ set -eou
# Wait for the Bedrock flag for this network to be set.
while [ ! -f /shared/initialized.txt ]; do
echo "Waiting for Bedrock node to initialize..."
sleep 60
sleep 1
done

if [ -z "${IS_CUSTOM_CHAIN+x}" ]; then
if [ "$NETWORK_NAME" == "op-mainnet" ] || [ "$NETWORK_NAME" == "op-goerli" ]; then
export EXTENDED_ARG="--rollup.historicalrpc=${OP_GETH__HISTORICAL_RPC:-http://l2geth:8545} --op-network=$NETWORK_NAME"
export EXTENDED_ARG="${EXTENDED_ARG:-} --rollup.historicalrpc=${OP_GETH__HISTORICAL_RPC:-http://l2geth:8545} --op-network=$NETWORK_NAME"
else
export EXTENDED_ARG="--op-network=$NETWORK_NAME"
export EXTENDED_ARG="${EXTENDED_ARG:-} --op-network=$NETWORK_NAME"
fi
fi

Expand Down
6 changes: 3 additions & 3 deletions scripts/start-op-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ set -eou
# Wait for the Bedrock flag for this network to be set.
while [ ! -f /shared/initialized.txt ]; do
echo "Waiting for Bedrock node to initialize..."
sleep 60
sleep 1
done

if [ -n "${IS_CUSTOM_CHAIN+x}" ]; then
export EXTENDED_ARG="--rollup.config=/chainconfig/rollup.json"
export EXTENDED_ARG="${EXTENDED_ARG:-} --rollup.config=/chainconfig/rollup.json"
else
export EXTENDED_ARG="--network=$NETWORK_NAME --rollup.load-protocol-versions=true"
export EXTENDED_ARG="${EXTENDED_ARG:-} --network=$NETWORK_NAME --rollup.load-protocol-versions=true"
fi

# Start op-node.
Expand Down

0 comments on commit 504d96b

Please sign in to comment.