Skip to content

Commit

Permalink
Merge pull request #82 from OffchainLabs/merge-master-v3.1.2-into-rel…
Browse files Browse the repository at this point in the history
…ease

Merge master v3.1.2 into release
  • Loading branch information
tsahee authored Sep 17, 2024
2 parents 91b59a8 + 148b8cb commit 00548dd
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 54 deletions.
2 changes: 1 addition & 1 deletion blockscout
4 changes: 2 additions & 2 deletions scripts/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ function writeL2ChainConfig(argv: any) {
"EnableArbOS": true,
"AllowDebugPrecompiles": true,
"DataAvailabilityCommittee": false,
"InitialArbOSVersion": 30,
"InitialArbOSVersion": 31,
"InitialChainOwner": argv.l2owner,
"GenesisBlockNum": 0
}
Expand Down Expand Up @@ -387,7 +387,7 @@ function writeL3ChainConfig(argv: any) {
"EnableArbOS": true,
"AllowDebugPrecompiles": true,
"DataAvailabilityCommittee": false,
"InitialArbOSVersion": 30,
"InitialArbOSVersion": 31,
"InitialChainOwner": argv.l2owner,
"GenesisBlockNum": 0
}
Expand Down
155 changes: 104 additions & 51 deletions test-node.bash
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash

set -e
set -eu

NITRO_NODE_VERSION=offchainlabs/nitro-node:v3.0.1-cf4b74e-dev
BLOCKSCOUT_VERSION=offchainlabs/blockscout:v1.0.0-c8db5b1
NITRO_NODE_VERSION=offchainlabs/nitro-node:v3.1.2-309340a-dev
BLOCKSCOUT_VERSION=offchainlabs/blockscout:v1.1.0-0e716c8

# This commit matches v2.1.0 release of nitro-contracts, with additional support to set arb owner through upgrade executor
DEFAULT_NITRO_CONTRACTS_VERSION="99c07a7db2fcce75b751c5a2bd4936e898cda065"
Expand Down Expand Up @@ -36,23 +36,32 @@ else
fi

run=true
force_build=false
validate=false
detach=false
blockscout=false
tokenbridge=false
l3node=false
consensusclient=false
redundantsequencers=0
dev_build_nitro=false
dev_build_blockscout=false
l3_custom_fee_token=false
l3_token_bridge=false
l3_custom_fee_token_decimals=18
batchposters=1
devprivkey=b6b15c8cb491557369f3c7d2c287b053eb229daa9c22138887752191c9520659
l1chainid=1337
simple=true

# Use the dev versions of nitro/blockscout
dev_nitro=false
dev_blockscout=false

# Rebuild docker images
build_dev_nitro=false
build_dev_blockscout=false
build_utils=false
force_build_utils=false
build_node_images=false

while [[ $# -gt 0 ]]; do
case $1 in
--init)
Expand All @@ -61,6 +70,8 @@ while [[ $# -gt 0 ]]; do
read -p "are you sure? [y/n]" -n 1 response
if [[ $response == "y" ]] || [[ $response == "Y" ]]; then
force_init=true
build_utils=true
build_node_images=true
echo
else
exit 0
Expand All @@ -70,28 +81,72 @@ while [[ $# -gt 0 ]]; do
;;
--init-force)
force_init=true
build_utils=true
build_node_images=true
shift
;;
--dev)
simple=false
shift
if [[ $# -eq 0 || $1 == -* ]]; then
# If no argument after --dev, set both flags to true
dev_build_nitro=true
dev_build_blockscout=true
dev_nitro=true
build_dev_nitro=true
dev_blockscout=true
build_dev_blockscout=true
else
while [[ $# -gt 0 && $1 != -* ]]; do
if [[ $1 == "nitro" ]]; then
dev_build_nitro=true
dev_nitro=true
build_dev_nitro=true
elif [[ $1 == "blockscout" ]]; then
dev_build_blockscout=true
dev_blockscout=true
build_dev_blockscout=true
fi
shift
done
fi
;;
--build)
force_build=true
build_dev_nitro=true
build_dev_blockscout=true
build_utils=true
build_node_images=true
shift
;;
--no-build)
build_dev_nitro=false
build_dev_blockscout=false
build_utils=false
build_node_images=false
shift
;;
--build-dev-nitro)
build_dev_nitro=true
shift
;;
--no-build-dev-nitro)
build_dev_nitro=false
shift
;;
--build-dev-blockscout)
build_dev_blockscout=true
shift
;;
--no-build-dev-blockscout)
build_dev_blockscout=false
shift
;;
--build-utils)
build_utils=true
shift
;;
--no-build-utils)
build_utils=false
shift
;;
--force-build-utils)
force_build_utils=true
shift
;;
--validate)
Expand Down Expand Up @@ -191,6 +246,7 @@ while [[ $# -gt 0 ]]; do
echo
echo OPTIONS:
echo --build rebuild docker images
echo --no-build don\'t rebuild docker images
echo --dev build nitro and blockscout dockers from source instead of pulling them. Disables simple mode
echo --init remove all data, rebuild, deploy new rollup
echo --pos l1 is a proof-of-stake chain \(using prysm for consensus\)
Expand All @@ -208,28 +264,19 @@ while [[ $# -gt 0 ]]; do
echo --no-tokenbridge don\'t build or launch tokenbridge
echo --no-run does not launch nodes \(useful with build or init\)
echo --no-simple run a full configuration with separate sequencer/batch-poster/validator/relayer
echo --build-dev-nitro rebuild dev nitro docker image
echo --no-build-dev-nitro don\'t rebuild dev nitro docker image
echo --build-dev-blockscout rebuild dev blockscout docker image
echo --no-build-dev-blockscout don\'t rebuild dev blockscout docker image
echo --build-utils rebuild scripts, rollupcreator, token bridge docker images
echo --no-build-utils don\'t rebuild scripts, rollupcreator, token bridge docker images
echo --force-build-utils force rebuilding utils, useful if NITRO_CONTRACTS_ or TOKEN_BRIDGE_BRANCH changes
echo
echo script runs inside a separate docker. For SCRIPT-ARGS, run $0 script --help
exit 0
esac
done

if $force_init; then
force_build=true
fi

if $dev_build_nitro; then
if [[ "$(docker images -q nitro-node-dev:latest 2> /dev/null)" == "" ]]; then
force_build=true
fi
fi

if $dev_build_blockscout; then
if [[ "$(docker images -q blockscout:latest 2> /dev/null)" == "" ]]; then
force_build=true
fi
fi

NODES="sequencer"
INITIAL_SEQ_NODES="sequencer"

Expand Down Expand Up @@ -269,51 +316,56 @@ fi
if $blockscout; then
NODES="$NODES blockscout"
fi
if $force_build; then
echo == Building..
if $dev_build_nitro; then
if ! [ -n "${NITRO_SRC+set}" ]; then
NITRO_SRC=`dirname $PWD`
fi
if ! grep ^FROM "${NITRO_SRC}/Dockerfile" | grep nitro-node 2>&1 > /dev/null; then
echo nitro source not found in "$NITRO_SRC"
echo execute from a sub-directory of nitro or use NITRO_SRC environment variable
exit 1
fi
docker build "$NITRO_SRC" -t nitro-node-dev --target nitro-node-dev


if $dev_nitro && $build_dev_nitro; then
echo == Building Nitro
if ! [ -n "${NITRO_SRC+set}" ]; then
NITRO_SRC=`dirname $PWD`
fi
if $dev_build_blockscout; then
if $blockscout; then
docker build blockscout -t blockscout -f blockscout/docker/Dockerfile
fi
if ! grep ^FROM "${NITRO_SRC}/Dockerfile" | grep nitro-node 2>&1 > /dev/null; then
echo nitro source not found in "$NITRO_SRC"
echo execute from a sub-directory of nitro or use NITRO_SRC environment variable
exit 1
fi
docker build "$NITRO_SRC" -t nitro-node-dev --target nitro-node-dev
fi
if $dev_blockscout && $build_dev_blockscout; then
if $blockscout; then
echo == Building Blockscout
docker build blockscout -t blockscout -f blockscout/docker/Dockerfile
fi
fi

if $build_utils; then
LOCAL_BUILD_NODES="scripts rollupcreator"
if $tokenbridge || $l3_token_bridge; then
LOCAL_BUILD_NODES="$LOCAL_BUILD_NODES tokenbridge"
fi
docker compose build --no-rm $LOCAL_BUILD_NODES
UTILS_NOCACHE=""
if $force_build_utils; then
UTILS_NOCACHE="--no-cache"
fi
docker compose build --no-rm $UTILS_NOCACHE $LOCAL_BUILD_NODES
fi

if $dev_build_nitro; then
if $dev_nitro; then
docker tag nitro-node-dev:latest nitro-node-dev-testnode
else
docker pull $NITRO_NODE_VERSION
docker tag $NITRO_NODE_VERSION nitro-node-dev-testnode
fi

if $dev_build_blockscout; then
if $blockscout; then
if $blockscout; then
if $dev_blockscout; then
docker tag blockscout:latest blockscout-testnode
fi
else
if $blockscout; then
else
docker pull $BLOCKSCOUT_VERSION
docker tag $BLOCKSCOUT_VERSION blockscout-testnode
fi
fi

if $force_build; then
if $build_node_images; then
docker compose build --no-rm $NODES scripts
fi

Expand Down Expand Up @@ -436,6 +488,7 @@ if $force_init; then
echo l3owneraddress $l3owneraddress
docker compose run scripts --l2owner $l3owneraddress write-l3-chain-config

EXTRA_L3_DEPLOY_FLAG=""
if $l3_custom_fee_token; then
echo == Deploying custom fee token
nativeTokenAddress=`docker compose run scripts create-erc20 --deployer user_fee_token_deployer --bridgeable $tokenbridge --decimals $l3_custom_fee_token_decimals | tail -n 1 | awk '{ print $NF }'`
Expand Down

0 comments on commit 00548dd

Please sign in to comment.