22
33set -eu
44
5- NITRO_NODE_VERSION=offchainlabs/nitro-node:v3.7.4-9244576
5+ NITRO_NODE_VERSION=offchainlabs/nitro-node:v3.9.2-52e8959
66BLOCKSCOUT_VERSION=offchainlabs/blockscout:v1.1.0-0e716c8
77
88# nitro-contract workaround for testnode
@@ -60,6 +60,7 @@ devprivkey=b6b15c8cb491557369f3c7d2c287b053eb229daa9c22138887752191c9520659
6060l1chainid=1337
6161simple=true
6262l2anytrust=false
63+ l2referenceda=false
6364l2timeboost=false
6465
6566# Use the dev versions of nitro/blockscout
@@ -266,6 +267,10 @@ while [[ $# -gt 0 ]]; do
266267 l2anytrust=true
267268 shift
268269 ;;
270+ --l2-referenceda)
271+ l2referenceda=true
272+ shift
273+ ;;
269274 --l2-timeboost)
270275 l2timeboost=true
271276 shift
@@ -313,6 +318,7 @@ while [[ $# -gt 0 ]]; do
313318 echo --l3-fee-token-decimals Number of decimals to use for custom fee token. Only valid if also ' --l3-fee-token' is provided
314319 echo --l3-token-bridge Deploy L2-L3 token bridge. Only valid if also ' --l3node' is provided
315320 echo --l2-anytrust run the L2 as an AnyTrust chain
321+ echo --l2-referenceda run the L2 with reference external data availability provider
316322 echo --l2-timeboost run the L2 with Timeboost enabled, including auctioneer and bid validator
317323 echo --batchposters batch posters [0-3]
318324 echo --redundantsequencers redundant sequencers [0-3]
@@ -331,7 +337,7 @@ while [[ $# -gt 0 ]]; do
331337 echo --no-build-dev-blockscout don\' t rebuild dev blockscout docker image
332338 echo --build-utils rebuild scripts, rollupcreator, token bridge docker images
333339 echo --no-build-utils don\' t rebuild scripts, rollupcreator, token bridge docker images
334- echo --force-build-utils force rebuilding utils, useful if NITRO_CONTRACTS_ or TOKEN_BRIDGE_BRANCH changes
340+ echo --force-build-utils force rebuilding utils, useful if NITRO_CONTRACTS_BRANCH or TOKEN_BRIDGE_BRANCH changes
335341 echo
336342 echo script runs inside a separate docker. For SCRIPT-ARGS, run $0 script --help
337343 exit 0
@@ -365,6 +371,10 @@ if [ $batchposters -gt 2 ]; then
365371 NODES=" $NODES poster_c"
366372fi
367373
374+ if $l2anytrust && $l2referenceda ; then
375+ echo " Error: --l2-anytrust and --l2-referenceda cannot be enabled at the same time."
376+ exit 1
377+ fi
368378
369379if $validate ; then
370380 NODES=" $NODES validator"
@@ -497,27 +507,44 @@ if $force_init; then
497507
498508 if $l2anytrust ; then
499509 echo " == Writing l2 chain config (anytrust enabled)"
500- run_script --l2owner $l2ownerAddress write-l2-chain-config --anytrust
510+ run_script --l2owner $l2ownerAddress write-l2-chain-config --anytrust
501511 else
502- echo == Writing l2 chain config
503- run_script --l2owner $l2ownerAddress write-l2-chain-config
512+ echo " == Writing l2 chain config"
513+ run_script --l2owner $l2ownerAddress write-l2-chain-config
504514 fi
505515
506516 sequenceraddress=` run_script print-address --account sequencer | tail -n 1 | tr -d ' \r\n' `
507517 l2ownerKey=` run_script print-private-key --account l2owner | tail -n 1 | tr -d ' \r\n' `
508518 wasmroot=` docker compose run --rm --entrypoint sh sequencer -c " cat /home/user/target/machines/latest/module-root.txt" `
509519
510- echo == Deploying L2 chain
520+ echo " == Deploying L2 chain"
511521 docker compose run --rm -e PARENT_CHAIN_RPC=" http://geth:8545" -e DEPLOYER_PRIVKEY=$l2ownerKey -e PARENT_CHAIN_ID=$l1chainid -e CHILD_CHAIN_NAME=" arb-dev-test" -e MAX_DATA_SIZE=117964 -e OWNER_ADDRESS=$l2ownerAddress -e WASM_MODULE_ROOT=$wasmroot -e SEQUENCER_ADDRESS=$sequenceraddress -e AUTHORIZE_VALIDATORS=10 -e CHILD_CHAIN_CONFIG_PATH=" /config/l2_chain_config.json" -e CHAIN_DEPLOYMENT_INFO=" /config/deployment.json" -e CHILD_CHAIN_INFO=" /config/deployed_chain_info.json" rollupcreator create-rollup-testnode
512522 if $l2timeboost ; then
513523 docker compose run --rm --entrypoint sh rollupcreator -c ' jq ".[] | .\"track-block-metadata-from\"=1 | [.]" /config/deployed_chain_info.json > /config/l2_chain_info.json'
514524 else
515525 docker compose run --rm --entrypoint sh rollupcreator -c " jq [.[]] /config/deployed_chain_info.json > /config/l2_chain_info.json"
516526 fi
517527
528+ if $l2referenceda ; then
529+ docker compose run --rm --entrypoint sh referenceda-provider -c " true" # Noop to mount shared volumes with contracts for manual build and deployment
530+
531+ echo " == Generating Reference DA keys"
532+ docker compose run --rm --user root --entrypoint sh datool -c " mkdir /referenceda-provider/keys && chown -R 1000:1000 /referenceda-provider*"
533+ docker compose run --rm datool keygen --dir /referenceda-provider/keys --ecdsa
534+
535+ referenceDASignerAddress=` docker compose run --rm --entrypoint sh rollupcreator -c " cat /referenceda-provider/keys/ecdsa.pub | sed 's/^04/0x/' | tr -d '\n' | cast keccak | tail -c 41 | cast to-check-sum-address" `
536+
537+ echo " == Deploying Reference DA Proof Validator contract on L2"
538+ l2referenceDAValidatorAddress=` docker compose run --rm --entrypoint sh rollupcreator -c " cd /contracts-local && forge create src/osp/ReferenceDAProofValidator.sol:ReferenceDAProofValidator --rpc-url http://geth:8545 --private-key $l2ownerKey --broadcast --constructor-args [$referenceDASignerAddress ]" | awk ' /Deployed to:/ {print $NF}' `
539+
540+ echo " == Generating Reference DA Config"
541+ run_script write-l2-referenceda-config --validator-address $l2referenceDAValidatorAddress
542+ fi
543+
518544fi # $force_init
519545
520546anytrustNodeConfigLine=" "
547+ referenceDaNodeConfigLine=" "
521548timeboostNodeConfigLine=" "
522549
523550# Remaining init may require AnyTrust committee/mirrors to have been started
@@ -547,16 +574,24 @@ if $l2anytrust; then
547574 fi
548575fi
549576
577+ if $l2referenceda && $run ; then
578+ echo " == Starting Reference DA service"
579+ docker compose up --wait referenceda-provider
580+ fi
581+
550582if $force_init ; then
551583 if $l2timeboost ; then
552584 timeboostNodeConfigLine=" --timeboost"
553585 fi
586+ if $l2referenceda ; then
587+ referenceDaNodeConfigLine=" --referenceDA"
588+ fi
589+
590+ echo " == Writing configs"
554591 if $simple ; then
555- echo == Writing configs
556- run_script write-config --simple $anytrustNodeConfigLine $timeboostNodeConfigLine
592+ run_script write-config --simple $anytrustNodeConfigLine $referenceDaNodeConfigLine $timeboostNodeConfigLine
557593 else
558- echo == Writing configs
559- run_script write-config $anytrustNodeConfigLine $timeboostNodeConfigLine
594+ run_script write-config $anytrustNodeConfigLine $referenceDaNodeConfigLine $timeboostNodeConfigLine
560595
561596 echo == Initializing redis
562597 docker compose up --wait redis
@@ -565,6 +600,7 @@ if $force_init; then
565600
566601 echo == Funding l2 funnel and dev key
567602 docker compose up --wait $INITIAL_SEQ_NODES
603+ sleep 45 # in case we need to create a smart contract wallet, allow for parent chain to recieve the contract creation tx and process it
568604 run_script bridge-funds --ethamount 100000 --wait
569605 run_script send-l2 --ethamount 100 --to l2owner --wait
570606 rollupAddress=` docker compose run --rm --entrypoint sh poster -c " jq -r '.[0].rollup.rollup' /config/deployed_chain_info.json | tail -n 1 | tr -d '\r\n'" `
@@ -656,6 +692,7 @@ if $force_init; then
656692
657693 echo == Funding l3 funnel and dev key
658694 docker compose up --wait l3node sequencer
695+ sleep 45 # in case we need to create a smart contract wallet, allow for parent chain to recieve the contract creation tx and process it
659696
660697 if $l3_token_bridge ; then
661698 echo == Deploying L2-L3 token bridge
0 commit comments