Skip to content

Commit 26cb18a

Browse files
Merge branch 'release' into add-metrics-compose-file
2 parents ed820b8 + 30ca89e commit 26cb18a

File tree

5 files changed

+136
-19
lines changed

5 files changed

+136
-19
lines changed

docker-compose.yaml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ services:
8383
- --mine
8484
- --miner.etherbase=0x3f1Eae7D46d88F08fc2F8ed27FCb2AB183EB2d0E
8585
- --gcmode=archive
86+
- --rpc.allow-unprotected-txs
8687

8788
# Creates a genesis state for the beacon chain using a YAML configuration file and
8889
# a deterministic set of validators
@@ -381,7 +382,10 @@ services:
381382
NITRO_CONTRACTS_BRANCH: ${NITRO_CONTRACTS_BRANCH:-}
382383
volumes:
383384
- "config:/config"
384-
- /var/run/docker.sock:/var/run/docker.sock
385+
- "/var/run/docker.sock:/var/run/docker.sock"
386+
- "contracts:/contracts"
387+
- "contracts-local:/contracts-local"
388+
- "referenceda-provider-data:/referenceda-provider"
385389

386390
datool:
387391
image: nitro-node-dev-testnode
@@ -391,7 +395,7 @@ services:
391395
- "das-committee-a-data:/das-committee-a"
392396
- "das-committee-b-data:/das-committee-b"
393397
- "das-mirror-data:/das-mirror"
394-
command:
398+
- "referenceda-provider-data:/referenceda-provider"
395399

396400
das-committee-a:
397401
pid: host # allow debugging
@@ -431,6 +435,20 @@ services:
431435
command:
432436
- --conf.file=/config/l2_das_mirror.json
433437

438+
referenceda-provider:
439+
pid: host # allow debugging
440+
image: nitro-node-dev-testnode
441+
entrypoint: /usr/local/bin/daprovider
442+
ports:
443+
- "127.0.0.1:9880:9880"
444+
volumes:
445+
- "config:/config"
446+
- "referenceda-provider-data:/data"
447+
- "contracts:/contracts"
448+
- "contracts-local:/contracts-local"
449+
command:
450+
- --conf.file=/config/referenceda_provider.json
451+
434452
timeboost-auctioneer:
435453
pid: host # allow debugging
436454
image: nitro-node-dev-testnode
@@ -481,4 +499,7 @@ volumes:
481499
das-committee-a-data:
482500
das-committee-b-data:
483501
das-mirror-data:
502+
referenceda-provider-data:
484503
timeboost-auctioneer-data:
504+
contracts:
505+
contracts-local:

scripts/config.ts

Lines changed: 63 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as fs from 'fs';
22
import * as consts from './consts'
33
import { ethers } from "ethers";
4-
import { namedAccount, namedAddress } from './accounts'
4+
import { namedAddress } from './accounts'
55

66
const path = require("path");
77

@@ -201,7 +201,9 @@ function writeConfigs(argv: any) {
201201
"node": {
202202
"bold": {
203203
"rpc-block-number": "latest",
204-
"assertion-posting-interval": "10s"
204+
"assertion-posting-interval": "10s",
205+
"assertion-confirming-interval": "10s",
206+
"parent-chain-block-time": 1,
205207
},
206208
"staker": {
207209
"dangerous": {
@@ -292,12 +294,25 @@ function writeConfigs(argv: any) {
292294

293295
baseConfig.node["data-availability"]["sequencer-inbox-address"] = ethers.utils.hexlify(getChainInfo()[0]["rollup"]["sequencer-inbox"]);
294296

297+
if (argv.referenceDA) {
298+
(baseConfig as any).node["da"] = {
299+
"mode": "external",
300+
"external-provider": {
301+
"enable": true,
302+
"with-writer": false,
303+
"rpc": {
304+
"url": "http://referenceda-provider:9880"
305+
}
306+
}
307+
}
308+
}
309+
295310
const baseConfJSON = JSON.stringify(baseConfig)
296311

297312
if (argv.simple) {
298313
let simpleConfig = JSON.parse(baseConfJSON)
299314
simpleConfig.node.staker.enable = true
300-
simpleConfig.node.staker["use-smart-contract-wallet"] = false // TODO: set to true when fixed
315+
simpleConfig.node.staker["use-smart-contract-wallet"] = true
301316
simpleConfig.node.staker.dangerous["without-block-validator"] = true
302317
simpleConfig.node.sequencer = true
303318
simpleConfig.node.dangerous["no-sequencer-coordinator"] = true
@@ -312,7 +327,7 @@ function writeConfigs(argv: any) {
312327
} else {
313328
let validatorConfig = JSON.parse(baseConfJSON)
314329
validatorConfig.node.staker.enable = true
315-
validatorConfig.node.staker["use-smart-contract-wallet"] = false // TODO: set to true when fixed
330+
validatorConfig.node.staker["use-smart-contract-wallet"] = true
316331
let validconfJSON = JSON.stringify(validatorConfig)
317332
fs.writeFileSync(path.join(consts.configpath, "validator_config.json"), validconfJSON)
318333

@@ -339,6 +354,9 @@ function writeConfigs(argv: any) {
339354
if (argv.anytrust) {
340355
posterConfig.node["data-availability"]["rpc-aggregator"].enable = true
341356
}
357+
if (argv.referenceDA) {
358+
posterConfig.node["da"]["external-provider"]["with-writer"] = true
359+
}
342360
fs.writeFileSync(path.join(consts.configpath, "poster_config.json"), JSON.stringify(posterConfig))
343361
}
344362

@@ -351,7 +369,7 @@ function writeConfigs(argv: any) {
351369
const l3ChainInfoFile = path.join(consts.configpath, "l3_chain_info.json")
352370
l3Config.chain["info-files"] = [l3ChainInfoFile]
353371
l3Config.node.staker.enable = true
354-
l3Config.node.staker["use-smart-contract-wallet"] = false // TODO: set to true when fixed
372+
l3Config.node.staker["use-smart-contract-wallet"] = true
355373
l3Config.node.sequencer = true
356374
l3Config.execution["sequencer"].enable = true
357375
l3Config.node["dangerous"]["no-sequencer-coordinator"] = true
@@ -519,6 +537,26 @@ function writeL2DASKeysetConfig(argv: any) {
519537
fs.writeFileSync(path.join(consts.configpath, "l2_das_keyset.json"), l2DASKeysetConfigJSON)
520538
}
521539

540+
function writeL2ReferenceDAConfig(argv: any) {
541+
const l2ReferenceDAConfig = {
542+
"mode": "referenceda",
543+
"referenceda": {
544+
"enable": true,
545+
"signing-key": {
546+
"key-file": "/data/keys/ecdsa"
547+
},
548+
"validator-contract": argv.validatorAddress,
549+
"parent-chain-node-url": argv.l1url,
550+
},
551+
"provider-server": {
552+
"addr": "0.0.0.0",
553+
"enable-da-writer": true,
554+
},
555+
}
556+
const l2ReferenceDAConfigJSON = JSON.stringify(l2ReferenceDAConfig)
557+
fs.writeFileSync(path.join(consts.configpath, "referenceda_provider.json"), l2ReferenceDAConfigJSON)
558+
}
559+
522560
function dasBackendsJsonConfig(argv: any) {
523561
const backends = {
524562
"enable": false,
@@ -614,6 +652,11 @@ export const writeConfigCommand = {
614652
describe: "DAS committee member B BLS pub key",
615653
default: ""
616654
},
655+
referenceDA: {
656+
boolean: true,
657+
describe: "run nodes in reference DA mode",
658+
default: false
659+
},
617660
timeboost: {
618661
boolean: true,
619662
describe: "run sequencer in timeboost mode",
@@ -649,7 +692,7 @@ export const writeL2ChainConfigCommand = {
649692
boolean: true,
650693
describe: "enable anytrust in chainconfig",
651694
default: false
652-
},
695+
}
653696
},
654697
handler: (argv: any) => {
655698
writeL2ChainConfig(argv)
@@ -701,3 +744,17 @@ export const writeL2DASKeysetConfigCommand = {
701744
}
702745
}
703746

747+
export const writeL2ReferenceDAConfigCommand = {
748+
command: "write-l2-referenceda-config",
749+
describe: "writes reference DA config file",
750+
builder: {
751+
validatorAddress: {
752+
string: true,
753+
describe: "L2 validator contract address",
754+
demandOption: true
755+
},
756+
},
757+
handler: (argv: any) => {
758+
writeL2ReferenceDAConfig(argv)
759+
}
760+
}

scripts/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
writeL2DASCommitteeConfigCommand,
1212
writeL2DASMirrorConfigCommand,
1313
writeL2DASKeysetConfigCommand,
14+
writeL2ReferenceDAConfigCommand,
1415
writeTimeboostConfigsCommand
1516
} from "./config";
1617
import {
@@ -72,6 +73,7 @@ async function main() {
7273
.command(writeL2DASCommitteeConfigCommand)
7374
.command(writeL2DASMirrorConfigCommand)
7475
.command(writeL2DASKeysetConfigCommand)
76+
.command(writeL2ReferenceDAConfigCommand)
7577
.command(writePrysmCommand)
7678
.command(writeAccountsCommand)
7779
.command(writeTimeboostConfigsCommand)

test-node.bash

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -eu
44

5-
NITRO_NODE_VERSION=offchainlabs/nitro-node:v3.7.4-9244576
5+
NITRO_NODE_VERSION=offchainlabs/nitro-node:v3.9.2-52e8959
66
BLOCKSCOUT_VERSION=offchainlabs/blockscout:v1.1.0-0e716c8
77

88
# nitro-contract workaround for testnode
@@ -60,6 +60,7 @@ devprivkey=b6b15c8cb491557369f3c7d2c287b053eb229daa9c22138887752191c9520659
6060
l1chainid=1337
6161
simple=true
6262
l2anytrust=false
63+
l2referenceda=false
6364
l2timeboost=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"
366372
fi
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

369379
if $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+
518544
fi # $force_init
519545

520546
anytrustNodeConfigLine=""
547+
referenceDaNodeConfigLine=""
521548
timeboostNodeConfigLine=""
522549

523550
# Remaining init may require AnyTrust committee/mirrors to have been started
@@ -547,16 +574,24 @@ if $l2anytrust; then
547574
fi
548575
fi
549576

577+
if $l2referenceda && $run; then
578+
echo "== Starting Reference DA service"
579+
docker compose up --wait referenceda-provider
580+
fi
581+
550582
if $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

Comments
 (0)