diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb74a23a..e1dfb81f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,6 +26,12 @@ jobs: l3node: [l3node, l3node-token-6, no-l3node] tokenbridge: [tokenbridge, no-tokenbridge] simple: [simple, no-simple] + include: + # One extra job that starts pre-MEL chains. Its l3node value is not in the list above, so it is added as a new job + - pos: no-pos + l3node: l3node-pre-mel + tokenbridge: no-tokenbridge + simple: simple steps: - name: Checkout @@ -46,4 +52,7 @@ jobs: restore-keys: ${{ runner.os }}-buildx- - name: Startup Nitro testnode - run: ${{ github.workspace }}/.github/workflows/testnode.bash --init-force ${{ (matrix.l3node == 'l3node' && '--l3node') || (matrix.l3node == 'l3node-token-6' && '--l3node --l3-fee-token --l3-token-bridge --l3-fee-token-decimals 6') || '' }} ${{ matrix.tokenbridge == 'tokenbridge' && '--tokenbridge' || '--no-tokenbridge' }} --detach ${{ matrix.pos == 'pos' && '--pos' || '' }} --simple ${{ (matrix.simple == 'simple' && '--simple') || (matrix.simple == 'no-simple' && '--no-simple') || '' }} + env: + # Empty keeps the testnode's default contracts + NITRO_CONTRACTS_BRANCH: ${{ matrix.l3node == 'l3node-pre-mel' && 'v3.2.0' || '' }} + run: ${{ github.workspace }}/.github/workflows/testnode.bash --init-force ${{ (matrix.l3node == 'l3node' && '--l3node') || (matrix.l3node == 'l3node-token-6' && '--l3node --l3-fee-token --l3-token-bridge --l3-fee-token-decimals 6') || (matrix.l3node == 'l3node-pre-mel' && '--l3node --wasm-module-root 0xc10cd7ec6acaf1c441a3f6bd0900ad20f15855ba775a96f1939118cbc629dc97') || '' }} ${{ matrix.tokenbridge == 'tokenbridge' && '--tokenbridge' || '--no-tokenbridge' }} --detach ${{ matrix.pos == 'pos' && '--pos' || '' }} --simple ${{ (matrix.simple == 'simple' && '--simple') || (matrix.simple == 'no-simple' && '--no-simple') || '' }} diff --git a/README.md b/README.md index 66656653..6ddd1546 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,14 @@ Initialize the node in dev-mode (this will build the docker images from source) ``` To see more options, use `--help`. +## Starting a pre-MEL chain + +The chains are created with MEL enabled. To create chains that start before MEL, pass pre-MEL contracts together with a pre-MEL root from the image's `target/machines`. The following example uses the wasm module root of ArbOS v61: + +```bash +NITRO_CONTRACTS_BRANCH=v3.2.0 ./test-node.bash --init --l3node --wasm-module-root 0xc10cd7ec6acaf1c441a3f6bd0900ad20f15855ba775a96f1939118cbc629dc97 +``` + ## Further information ### Branch Selection Guide (for devs working *on* nitro-testnode) diff --git a/docker-compose.yaml b/docker-compose.yaml index 7baca0b1..acb2e431 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -309,10 +309,11 @@ services: - "validator-data:/home/user/.arbitrum/local/nitro" - "l1keystore:/home/user/l1keystore" - "config:/config" - command: --conf.file /config/validator_config.json --http.port 8547 --http.api net,web3,arb,debug --ws.port 8548 + command: --conf.file /config/validator_config.json --http.port 8547 --http.api net,web3,arb,debug --ws.port 8548 --node.mel.client.url http://mel_provider_l2:8549 depends_on: - sequencer - validation_node + - mel_provider_l2 l3node: pid: host # allow debugging @@ -322,13 +323,31 @@ services: - "127.0.0.1:3347:3347" - "127.0.0.1:3348:3348" volumes: - - "validator-data:/home/user/.arbitrum/local/nitro" + - "l3-validator-data:/home/user/.arbitrum/local/nitro" - "l1keystore:/home/user/l1keystore" - "config:/config" - command: --conf.file /config/l3node_config.json --http.port 3347 --http.api net,web3,arb,debug,eth --ws.port 3348 + command: --conf.file /config/l3node_config.json --http.port 3347 --http.api net,web3,arb,debug,eth --ws.port 3348 --node.mel.client.url http://mel_provider_l3:8549 depends_on: - sequencer - validation_node + - mel_provider_l3 + + # MEL proof data providers (nitro-reth mel-provider) + mel_provider_l2: + image: nitro-node-dev-testnode + entrypoint: /usr/local/bin/mel-provider + command: --parent-chain-rpc-url http://geth:8545 --rpc-addr 0.0.0.0:8549 + stop_signal: SIGINT + depends_on: + - geth + + mel_provider_l3: + image: nitro-node-dev-testnode + entrypoint: /usr/local/bin/mel-provider + command: --parent-chain-rpc-url http://sequencer:8547 --rpc-addr 0.0.0.0:8549 + stop_signal: SIGINT + depends_on: + - sequencer validation_node: pid: host # allow debugging @@ -568,6 +587,7 @@ volumes: poster-data: poster-data-b: poster-data-c: + l3-validator-data: config: postgres-data: tokenbridge-data: diff --git a/scripts/config.ts b/scripts/config.ts index 0dc39c89..1cf85bbf 100644 --- a/scripts/config.ts +++ b/scripts/config.ts @@ -390,6 +390,8 @@ function writeConfigs(argv: any) { simpleConfig.node["batch-poster"].enable = true simpleConfig.node["batch-poster"]["redis-url"] = "" simpleConfig.execution["sequencer"].enable = true + // mel_provider_l3 requests proofs at past blocks of this chain, so this node has to keep their state + simpleConfig.execution["caching"] = { "archive": true } if (argv.anytrust) { simpleConfig.node["da"]["anytrust"]["rpc-aggregator"].enable = true } @@ -416,6 +418,8 @@ function writeConfigs(argv: any) { sequencerConfig.node["seq-coordinator"].enable = true sequencerConfig.execution["sequencer"].enable = true sequencerConfig.node["delayed-sequencer"].enable = true + // mel_provider_l3 requests proofs at past blocks of this chain, so this node has to keep their state + sequencerConfig.execution["caching"] = { "archive": true } if (argv.timeboost) { sequencerConfig.execution.sequencer.timeboost = { "enable": false, // Create it false initially, turn it on with sed in test-node.bash after contract setup. @@ -477,6 +481,7 @@ function writeConfigs(argv: any) { "validation": { "api-auth": true, "api-public": false, + "use-jit": false // The image's mel0 machine lacks the wasm libraries the JIT needs }, "auth": { "jwtsecret": valJwtSecret, diff --git a/test-node.bash b/test-node.bash index 09867391..4f846cfc 100755 --- a/test-node.bash +++ b/test-node.bash @@ -8,7 +8,7 @@ BLOCKSCOUT_VERSION=offchainlabs/blockscout:v1.1.0-0e716c8 # nitro-contract workaround for testnode # 1. authorizing validator signer key since validator wallet is buggy # - gas estimation sent from 0x0000 lead to balance and permission error -DEFAULT_NITRO_CONTRACTS_VERSION="v3.2.0" +DEFAULT_NITRO_CONTRACTS_VERSION="feat/mel-0-melconfig-contract" DEFAULT_TOKEN_BRIDGE_VERSION="v1.2.5" # Set default versions if not overriden by provided env vars @@ -366,7 +366,7 @@ while [[ $# -gt 0 ]]; do 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_BRANCH or TOKEN_BRIDGE_BRANCH changes - echo --wasm-module-root initial WASM module root of the L2 and L3 rollups, one of the nitro image\'s machines \(default: the latest\). Needs an init, and a machine that supports the ArbOS version the chains start on. The nitro-legacy machines can\'t run challenges + echo --wasm-module-root initial WASM module root of the L2 and L3 rollups, one of the machines in the nitro image\'s target/machines \(default: the latest mel0 machine\). Needs an init, a machine that supports the ArbOS version the chains start on, and contracts of the same kind: a classic root for pre-MEL contracts, a mel0 root for MEL contracts echo echo script runs inside a separate docker. For SCRIPT-ARGS, run $0 script --help exit 0 @@ -485,13 +485,17 @@ else docker tag $NITRO_NODE_VERSION nitro-node-dev-testnode fi -# Validate the specified Wasm module root against the available machines in the nitro image +# Validate the wasm module root against the image's target/machines (the arbitrator can't load the nitro-legacy ones), +# or default to its latest mel0 machine if [ -n "$wasmroot" ]; then - image_roots=`docker run --rm --entrypoint sh nitro-node-dev-testnode -c "cat /home/user/*/machines/*/module-root.txt"` + image_roots=`docker run --rm --entrypoint sh nitro-node-dev-testnode -c "find /home/user/target/machines -name module-root.txt -exec cat {} +"` if ! grep -qxiF "$wasmroot" <<< "$image_roots"; then - echo "Error: $wasmroot is not a machine of the nitro image." + echo "Error: $wasmroot is not a machine in target/machines of the nitro image." exit 1 fi +elif $force_init; then + # Read before the old data is removed, so an image without the mel0 machine fails first + wasmroot=`docker run --rm --entrypoint sh nitro-node-dev-testnode -c "cat /home/user/target/machines/mel0/latest/module-root.txt"` fi if $blockscout; then @@ -592,9 +596,6 @@ if $force_init; then sequenceraddress=`run_script print-address --account sequencer | tail -n 1 | tr -d '\r\n'` l2ownerKey=`run_script print-private-key --account l2owner | tail -n 1 | tr -d '\r\n'` - if [ -z "$wasmroot" ]; then - wasmroot=`docker compose run --rm --entrypoint sh sequencer -c "cat /home/user/target/machines/latest/module-root.txt"` - fi echo "== Deploying L2 chain" 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