From 4e3e7824453bd8b6009d6d49fb2998b761778367 Mon Sep 17 00:00:00 2001 From: Sneh Koul Date: Mon, 21 Oct 2024 18:14:14 -0500 Subject: [PATCH 1/6] Add smoke test for altlayer config --- .github/workflows/smoke-test.yml | 1 + altlayer-test-node.bash | 193 +++++++++++++++++++++++++++++ docker-compose-altlayer.yaml | 203 +++++++++++++++++++++++++++++++ smoke-test-altlayer.bash | 24 ++++ 4 files changed, 421 insertions(+) create mode 100755 altlayer-test-node.bash create mode 100644 docker-compose-altlayer.yaml create mode 100755 smoke-test-altlayer.bash diff --git a/.github/workflows/smoke-test.yml b/.github/workflows/smoke-test.yml index 9eb5933..310c34a 100644 --- a/.github/workflows/smoke-test.yml +++ b/.github/workflows/smoke-test.yml @@ -25,6 +25,7 @@ jobs: ./smoke-test-nitro-simple.bash, ./smoke-test-full-node.bash, ./smoke-test-espresso-finality-node.bash, + ./smoke-test-altlayer.bash, ] runs-on: ubuntu-24.04 diff --git a/altlayer-test-node.bash b/altlayer-test-node.bash new file mode 100755 index 0000000..cf29650 --- /dev/null +++ b/altlayer-test-node.bash @@ -0,0 +1,193 @@ +#!/usr/bin/env bash + +set -e + +NITRO_NODE_VERSION=offchainlabs/nitro-node:v3.1.0-7d1d84c-dev +DEFAULT_NITRO_CONTRACTS_REPO=https://github.com/EspressoSystems/nitro-contracts.git +NITRO_CONTRACTS_BRANCH=develop + +ESPRESSO_VERSION=ghcr.io/espressosystems/nitro-espresso-integration/nitro-node-dev:latest + +# Set default versions if not overriden by provided env vars +: ${NITRO_CONTRACTS_REPO:=$DEFAULT_NITRO_CONTRACTS_REPO} +: ${NITRO_CONTRACTS_BRANCH:=$DEFAULT_NITRO_CONTRACTS_VERSION} +export NITRO_CONTRACTS_REPO +export NITRO_CONTRACTS_BRANCH + +echo "Running espresso mode" +echo "Using NITRO_CONTRACTS_REPO: $NITRO_CONTRACTS_REPO" +echo "Using NITRO_CONTRACTS_BRANCH: $NITRO_CONTRACTS_BRANCH" + + +mydir=`dirname $0` +cd "$mydir" + +if [[ $# -gt 0 ]] && [[ $1 == "script" ]]; then + shift + docker compose run scripts "$@" + exit $? +fi + +num_volumes=`docker volume ls --filter label=com.docker.compose.project=nitro-testnode -q | wc -l` + +if [[ $num_volumes -eq 0 ]]; then + force_init=true +else + force_init=false +fi + + +detach=false +init=false +force_build=false +latest_espresso_image=false +lightClientAddr=0xb6eb235fa509e3206f959761d11e3777e16d0e98 +l1chainid=1337 +while [[ $# -gt 0 ]]; do + case $1 in + --detach) + detach=true + shift + ;; + --init) + force_init=true + shift + ;; + --build) + force_build=true + shift + ;; + --latest-espresso-image) + latest_espresso_image=true + shift + ;; + --detach) + detach=true + shift + ;; + *) + echo Usage: $0 \[OPTIONS..] + echo $0 script [SCRIPT-ARGS] + echo + echo OPTIONS: + echo --detach detach from nodes after running them + echo --init remove all data, rebuild, deploy new rollup + echo --build rebuild docker images + echo --latest-espresso-image use latest espresso image + 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 + + +NODES="sequencer redis poster validator full-node" +INITIAL_SEQ_NODES="sequencer validation_node" + +if $force_build; then + echo == Building.. + LOCAL_BUILD_NODES="scripts rollupcreator" + docker compose build --no-rm $LOCAL_BUILD_NODES +fi + +if $force_build; then + INITIAL_SEQ_NODES="$INITIAL_SEQ_NODES espresso-dev-node" +else + NODES="$NODES espresso-dev-node" +fi + + +if $latest_espresso_image; then + docker pull $ESPRESSO_VERSION + docker tag $ESPRESSO_VERSION nitro-node-dev-testnode +else + docker pull $NITRO_NODE_VERSION + docker tag $NITRO_NODE_VERSION nitro-node-dev-testnode +fi + +if $force_build; then + docker compose build --no-rm $NODES scripts +fi + +if $force_init; then + echo == Removing old data... + docker compose down + leftoverContainers=`docker container ls -a --filter label=com.docker.compose.project=nitro-testnode -q | xargs echo` + if [ `echo $leftoverContainers | wc -w` -gt 0 ]; then + docker rm $leftoverContainers + fi + docker volume prune -f --filter label=com.docker.compose.project=nitro-testnode + leftoverVolumes=`docker volume ls --filter label=com.docker.compose.project=nitro-testnode -q | xargs echo` + if [ `echo $leftoverVolumes | wc -w` -gt 0 ]; then + docker volume rm $leftoverVolumes + fi + + echo == Generating l1 keys + docker compose run scripts write-accounts + docker compose run --entrypoint sh geth -c "echo passphrase > /datadir/passphrase" + docker compose run --entrypoint sh geth -c "chown -R 1000:1000 /keystore" + docker compose run --entrypoint sh geth -c "chown -R 1000:1000 /config" + + echo == Writing geth configs + docker compose up --wait geth + docker compose run scripts write-geth-genesis-config + + echo == Funding validator, sequencer and l2owner + docker compose run scripts send-l1 --ethamount 1000 --to validator --wait + docker compose run scripts send-l1 --ethamount 1000 --to sequencer --wait + docker compose run scripts send-l1 --ethamount 1000 --to l2owner --wait + docker compose run scripts send-l1 --ethamount 10000 --to espresso-sequencer --wait + + echo == create l1 traffic + docker compose run scripts send-l1 --ethamount 1000 --to user_l1user --wait + docker compose run scripts send-l1 --ethamount 0.0001 --from user_l1user --to user_l1user_b --wait --delay 500 --times 1000000 > /dev/null & + + l2ownerAddress=`docker compose run scripts print-address --account l2owner | tail -n 1 | tr -d '\r\n'` + echo $l2ownerAddress + + echo == Writing l2 chain config + docker compose run scripts --l2owner $l2ownerAddress write-l2-chain-config --espresso + + sequenceraddress=`docker compose run scripts print-address --account sequencer | tail -n 1 | tr -d '\r\n'` + l2ownerKey=`docker compose run scripts print-private-key --account l2owner | tail -n 1 | tr -d '\r\n'` + wasmroot=`docker compose run --entrypoint sh sequencer -c "cat /home/user/target/machines/latest/module-root.txt"` + + echo == Deploying L2 chain + docker compose run -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" -e LIGHT_CLIENT_ADDR=$lightClientAddr rollupcreator create-rollup-testnode + docker compose run --entrypoint sh rollupcreator -c "jq [.[]] /config/deployed_chain_info.json > /config/l2_chain_info.json" + docker compose run --entrypoint sh rollupcreator -c "cat /config/l2_chain_info.json" + + echo == Writing config + docker compose run scripts write-config --espresso --lightClientAddress $lightClientAddr + echo == Initializing redis + docker compose up --wait redis + docker compose run scripts redis-init + + echo == Funding l2 funnel and dev key + docker compose up --wait $INITIAL_SEQ_NODES + docker compose run scripts bridge-funds --ethamount 100000 --wait + docker compose run scripts send-l2 --ethamount 10000 --to espresso-sequencer --wait + docker compose run scripts send-l2 --ethamount 100 --to l2owner --wait + + + echo == Deploy CacheManager on L2 + docker compose run -e CHILD_CHAIN_RPC="http://sequencer:8547" -e CHAIN_OWNER_PRIVKEY=$l2ownerKey rollupcreator deploy-cachemanager-testnode +fi + + +UP_FLAG="" +if $detach; then + UP_FLAG="--wait" +fi + +echo == Launching Sequencer +echo if things go wrong - use --init to create a new chain +echo $NODES + +docker compose up $UP_FLAG $NODES \ No newline at end of file diff --git a/docker-compose-altlayer.yaml b/docker-compose-altlayer.yaml new file mode 100644 index 0000000..399a9b2 --- /dev/null +++ b/docker-compose-altlayer.yaml @@ -0,0 +1,203 @@ +services: + postgres: + image: postgres:13.6 + restart: always + container_name: "postgres" + environment: + POSTGRES_PASSWORD: "" + POSTGRES_USER: "postgres" + POSTGRES_HOST_AUTH_METHOD: "trust" + volumes: + - "postgres-data:/var/lib/postgresql/data" + ports: + - "127.0.0.1:7432:5432" + + redis: + image: redis:6.2.6 + ports: + - "127.0.0.1:6379:6379" + + geth: + image: ethereum/client-go:v1.10.23 + ports: + - "127.0.0.1:8545:8545" + - "127.0.0.1:8551:8551" + - "127.0.0.1:8546:8546" + - "127.0.0.1:30303:30303" + volumes: + - "l1data:/datadir" + - "l1keystore:/keystore" + - "config:/config" + command: + - --keystore=/keystore + - --http + - --datadir=/datadir + - --http.addr=0.0.0.0 + - --authrpc.vhosts=* + - --authrpc.port=8551 + - --authrpc.addr=0.0.0.0 + - --http.vhosts=* + - --http.api=engine,personal,eth,net,web3 + - --http.corsdomain=* + - --ws + - --ws.addr=0.0.0.0 + - --ws.api=personal,eth,net,web3,debug,txpool + - --allow-insecure-unlock + - --unlock=0x3f1Eae7D46d88F08fc2F8ed27FCb2AB183EB2d0E + - --password=/datadir/passphrase + - --authrpc.jwtsecret=/config/jwt.hex + - --nodiscover + - --syncmode=full + - --dev + - --dev.period=1 + - --mine + - --miner.etherbase=0x3f1Eae7D46d88F08fc2F8ed27FCb2AB183EB2d0E + - --gcmode=archive + + sequencer: + pid: host # allow debugging + image: nitro-node-dev-testnode + entrypoint: /usr/local/bin/nitro + ports: + - "127.0.0.1:8547:8547" + - "127.0.0.1:8548:8548" + - "127.0.0.1:9642:9642" + volumes: + - "seqdata:/home/user/.arbitrum/local/nitro" + - "l1keystore:/home/user/l1keystore" + - "config:/config" + command: --conf.file /config/sequencer_config.json --node.feed.output.enable --node.feed.output.port 9642 --http.api net,web3,eth,txpool,debug --node.seq-coordinator.my-url ws://sequencer:8548 --graphql.enable --graphql.vhosts * --graphql.corsdomain * + depends_on: + - geth + + # Reads from sequencer feed, forwards transactions to sequencer + full-node: + pid: host # allow debugging + image: nitro-node-dev-testnode + ports: + - "127.0.0.1:8947:8547" + - "127.0.0.1:8948:8548" + entrypoint: /usr/local/bin/nitro + volumes: + - "config:/config" + - "l1keystore:/home/user/l1keystore" + # use the sequencer_config.json but override the sequencer settings and the forwarding settings. + command: --conf.file /config/sequencer_config.json --node.sequencer=false --node.batch-poster.enable=false --execution.sequencer.enable=false --execution.forwarding-target http://sequencer:8547 --node.delayed-sequencer.enable=false --node.feed.input.url ws://sequencer:9642 --http.port 8547 --http.api net,web3,arb,debug,net,eth --ws.port 8548 + depends_on: + - geth + - sequencer + healthcheck: + test: ["CMD-SHELL", "curl -fL http://localhost:8947 || exit 1"] + interval: 30s + timeout: 10s + retries: 5 + start_period: 40s + + poster: + pid: host # allow debugging + image: nitro-node-dev-testnode + entrypoint: /usr/local/bin/nitro + ports: + - "127.0.0.1:8147:8547" + - "127.0.0.1:8148:8548" + volumes: + - "poster-data:/home/user/.arbitrum/local/nitro" + - "l1keystore:/home/user/l1keystore" + - "config:/config" + command: --conf.file /config/poster_config.json + depends_on: + - geth + - redis + + validator: + pid: host # allow debugging + image: nitro-node-dev-testnode + entrypoint: /usr/local/bin/nitro + ports: + - "127.0.0.1:8247:8547" + - "127.0.0.1:8248:8548" + volumes: + - "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,net,eth --ws.port 8548 + depends_on: + - sequencer + - validation_node + + validation_node: + pid: host # allow debugging + image: nitro-node-dev-testnode + entrypoint: /usr/local/bin/nitro-val + ports: + - "127.0.0.1:8949:8549" + volumes: + - "config:/config" + command: --conf.file /config/validation_node_config.json + + scripts: + build: scripts/ + volumes: + - "l1keystore:/home/user/l1keystore" + - "config:/config" + + rollupcreator: + depends_on: + - geth + - sequencer + pid: host + build: + context: rollupcreator/ + args: + NITRO_CONTRACTS_REPO: ${NITRO_CONTRACTS_REPO:-} + NITRO_CONTRACTS_BRANCH: ${NITRO_CONTRACTS_BRANCH:-} + volumes: + - "config:/config" + - /var/run/docker.sock:/var/run/docker.sock + + espresso-dev-node: + # TODO: revert to `:main` tag once we are compatible with the marketplace builder + image: ghcr.io/espressosystems/espresso-sequencer/espresso-dev-node:20240919-dev-node-legacy-builder + ports: + - "$ESPRESSO_SEQUENCER_API_PORT:$ESPRESSO_SEQUENCER_API_PORT" + - "$ESPRESSO_BUILDER_PORT:$ESPRESSO_BUILDER_PORT" + - "$ESPRESSO_DEV_NODE_PORT:$ESPRESSO_DEV_NODE_PORT" + environment: + - ESPRESSO_SEQUENCER_L1_PROVIDER + - ESPRESSO_SEQUENCER_ETH_MNEMONIC + - ESPRESSO_DEPLOYER_ACCOUNT_INDEX + - ESPRESSO_SEQUENCER_API_PORT + - ESPRESSO_BUILDER_PORT + - ESPRESSO_DEV_NODE_PORT + - RUST_LOG=info + - RUST_LOG_FORMAT + - ESPRESSO_DEPLOYER_ALT_CHAIN_PROVIDERS + - ESPRESSO_DEPLOYER_ALT_MNEMONICS + - ESPRESSO_SEQUENCER_DEPLOYER_ALT_INDICES + depends_on: + - geth + - sequencer + healthcheck: + test: + [ + "CMD-SHELL", + "curl -fL http://localhost:$ESPRESSO_DEV_NODE_PORT || exit 1", + ] + interval: 30s + timeout: 10s + retries: 5 + start_period: 40s + extra_hosts: + - "host.docker.internal:host-gateway" + +# TODO add L3 + +volumes: + l1data: + consensus: + l1keystore: + seqdata: + validator-data: + poster-data: + config: + postgres-data: diff --git a/smoke-test-altlayer.bash b/smoke-test-altlayer.bash new file mode 100755 index 0000000..f8dd352 --- /dev/null +++ b/smoke-test-altlayer.bash @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +set -euo pipefail + +COMPOSE_FILE=docker-compose-altlayer.yaml + +./altlayer-test-node.bash --init --latest-espresso-image --detach + +# Sending L2 transaction through the full-node's api +user=user_l2user +./altlayer-test-node.bash script send-l2 --ethamount 100 --to $user --wait + +# Check the balance from full-node's api +userAddress=$(docker compose run scripts print-address --account $user | tail -n 1 | tr -d '\r\n') + +while true; do + balance=$(cast balance $userAddress --rpc-url http://127.0.0.1:8947) + if [ ${#balance} -gt 0 ]; then + break + fi + sleep 1 +done + +echo "Smoke test succeeded." +# docker compose down From 719004fceab4ba2a32ed9746efeaacb73d4cb118 Mon Sep 17 00:00:00 2001 From: Sneh Koul Date: Mon, 21 Oct 2024 18:19:47 -0500 Subject: [PATCH 2/6] add docker compose down --- smoke-test-altlayer.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smoke-test-altlayer.bash b/smoke-test-altlayer.bash index f8dd352..16e7da1 100755 --- a/smoke-test-altlayer.bash +++ b/smoke-test-altlayer.bash @@ -21,4 +21,4 @@ while true; do done echo "Smoke test succeeded." -# docker compose down +docker compose down From e473d68afab1c58891f6dd58d3d0f24c10ac4ce2 Mon Sep 17 00:00:00 2001 From: Sneh Koul Date: Tue, 22 Oct 2024 11:27:36 -0500 Subject: [PATCH 3/6] update docker compose --- altlayer-test-node.bash | 2 +- docker-compose-altlayer.yaml | 6 ------ smoke-test-altlayer.bash | 3 +++ 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/altlayer-test-node.bash b/altlayer-test-node.bash index cf29650..adee6fb 100755 --- a/altlayer-test-node.bash +++ b/altlayer-test-node.bash @@ -87,7 +87,7 @@ if $force_init; then fi -NODES="sequencer redis poster validator full-node" +NODES="sequencer redis poster validator" INITIAL_SEQ_NODES="sequencer validation_node" if $force_build; then diff --git a/docker-compose-altlayer.yaml b/docker-compose-altlayer.yaml index 399a9b2..0c16430 100644 --- a/docker-compose-altlayer.yaml +++ b/docker-compose-altlayer.yaml @@ -86,12 +86,6 @@ services: depends_on: - geth - sequencer - healthcheck: - test: ["CMD-SHELL", "curl -fL http://localhost:8947 || exit 1"] - interval: 30s - timeout: 10s - retries: 5 - start_period: 40s poster: pid: host # allow debugging diff --git a/smoke-test-altlayer.bash b/smoke-test-altlayer.bash index 16e7da1..c579edc 100755 --- a/smoke-test-altlayer.bash +++ b/smoke-test-altlayer.bash @@ -5,6 +5,9 @@ COMPOSE_FILE=docker-compose-altlayer.yaml ./altlayer-test-node.bash --init --latest-espresso-image --detach +docker compose up -d full-node --detach + + # Sending L2 transaction through the full-node's api user=user_l2user ./altlayer-test-node.bash script send-l2 --ethamount 100 --to $user --wait From 74f9afae50c9d199a7575a03721b114d6832d8d3 Mon Sep 17 00:00:00 2001 From: Sneh Koul Date: Tue, 22 Oct 2024 11:58:08 -0500 Subject: [PATCH 4/6] cleanup --- altlayer-test-node.bash | 2 +- docker-compose-altlayer.yaml | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/altlayer-test-node.bash b/altlayer-test-node.bash index adee6fb..456d913 100755 --- a/altlayer-test-node.bash +++ b/altlayer-test-node.bash @@ -190,4 +190,4 @@ echo == Launching Sequencer echo if things go wrong - use --init to create a new chain echo $NODES -docker compose up $UP_FLAG $NODES \ No newline at end of file +docker compose up $UP_FLAG $NODES diff --git a/docker-compose-altlayer.yaml b/docker-compose-altlayer.yaml index 0c16430..4ad17cb 100644 --- a/docker-compose-altlayer.yaml +++ b/docker-compose-altlayer.yaml @@ -184,8 +184,6 @@ services: extra_hosts: - "host.docker.internal:host-gateway" -# TODO add L3 - volumes: l1data: consensus: From b41364dfef60af181ab8c13a5bfe43e4e2ec7390 Mon Sep 17 00:00:00 2001 From: Sneh Koul Date: Tue, 22 Oct 2024 13:32:39 -0500 Subject: [PATCH 5/6] address comments --- altlayer-test-node.bash | 193 ---------------------------------- docker-compose-altlayer.yaml | 195 ----------------------------------- smoke-test-altlayer.bash | 7 +- 3 files changed, 3 insertions(+), 392 deletions(-) delete mode 100755 altlayer-test-node.bash delete mode 100644 docker-compose-altlayer.yaml diff --git a/altlayer-test-node.bash b/altlayer-test-node.bash deleted file mode 100755 index 456d913..0000000 --- a/altlayer-test-node.bash +++ /dev/null @@ -1,193 +0,0 @@ -#!/usr/bin/env bash - -set -e - -NITRO_NODE_VERSION=offchainlabs/nitro-node:v3.1.0-7d1d84c-dev -DEFAULT_NITRO_CONTRACTS_REPO=https://github.com/EspressoSystems/nitro-contracts.git -NITRO_CONTRACTS_BRANCH=develop - -ESPRESSO_VERSION=ghcr.io/espressosystems/nitro-espresso-integration/nitro-node-dev:latest - -# Set default versions if not overriden by provided env vars -: ${NITRO_CONTRACTS_REPO:=$DEFAULT_NITRO_CONTRACTS_REPO} -: ${NITRO_CONTRACTS_BRANCH:=$DEFAULT_NITRO_CONTRACTS_VERSION} -export NITRO_CONTRACTS_REPO -export NITRO_CONTRACTS_BRANCH - -echo "Running espresso mode" -echo "Using NITRO_CONTRACTS_REPO: $NITRO_CONTRACTS_REPO" -echo "Using NITRO_CONTRACTS_BRANCH: $NITRO_CONTRACTS_BRANCH" - - -mydir=`dirname $0` -cd "$mydir" - -if [[ $# -gt 0 ]] && [[ $1 == "script" ]]; then - shift - docker compose run scripts "$@" - exit $? -fi - -num_volumes=`docker volume ls --filter label=com.docker.compose.project=nitro-testnode -q | wc -l` - -if [[ $num_volumes -eq 0 ]]; then - force_init=true -else - force_init=false -fi - - -detach=false -init=false -force_build=false -latest_espresso_image=false -lightClientAddr=0xb6eb235fa509e3206f959761d11e3777e16d0e98 -l1chainid=1337 -while [[ $# -gt 0 ]]; do - case $1 in - --detach) - detach=true - shift - ;; - --init) - force_init=true - shift - ;; - --build) - force_build=true - shift - ;; - --latest-espresso-image) - latest_espresso_image=true - shift - ;; - --detach) - detach=true - shift - ;; - *) - echo Usage: $0 \[OPTIONS..] - echo $0 script [SCRIPT-ARGS] - echo - echo OPTIONS: - echo --detach detach from nodes after running them - echo --init remove all data, rebuild, deploy new rollup - echo --build rebuild docker images - echo --latest-espresso-image use latest espresso image - 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 - - -NODES="sequencer redis poster validator" -INITIAL_SEQ_NODES="sequencer validation_node" - -if $force_build; then - echo == Building.. - LOCAL_BUILD_NODES="scripts rollupcreator" - docker compose build --no-rm $LOCAL_BUILD_NODES -fi - -if $force_build; then - INITIAL_SEQ_NODES="$INITIAL_SEQ_NODES espresso-dev-node" -else - NODES="$NODES espresso-dev-node" -fi - - -if $latest_espresso_image; then - docker pull $ESPRESSO_VERSION - docker tag $ESPRESSO_VERSION nitro-node-dev-testnode -else - docker pull $NITRO_NODE_VERSION - docker tag $NITRO_NODE_VERSION nitro-node-dev-testnode -fi - -if $force_build; then - docker compose build --no-rm $NODES scripts -fi - -if $force_init; then - echo == Removing old data... - docker compose down - leftoverContainers=`docker container ls -a --filter label=com.docker.compose.project=nitro-testnode -q | xargs echo` - if [ `echo $leftoverContainers | wc -w` -gt 0 ]; then - docker rm $leftoverContainers - fi - docker volume prune -f --filter label=com.docker.compose.project=nitro-testnode - leftoverVolumes=`docker volume ls --filter label=com.docker.compose.project=nitro-testnode -q | xargs echo` - if [ `echo $leftoverVolumes | wc -w` -gt 0 ]; then - docker volume rm $leftoverVolumes - fi - - echo == Generating l1 keys - docker compose run scripts write-accounts - docker compose run --entrypoint sh geth -c "echo passphrase > /datadir/passphrase" - docker compose run --entrypoint sh geth -c "chown -R 1000:1000 /keystore" - docker compose run --entrypoint sh geth -c "chown -R 1000:1000 /config" - - echo == Writing geth configs - docker compose up --wait geth - docker compose run scripts write-geth-genesis-config - - echo == Funding validator, sequencer and l2owner - docker compose run scripts send-l1 --ethamount 1000 --to validator --wait - docker compose run scripts send-l1 --ethamount 1000 --to sequencer --wait - docker compose run scripts send-l1 --ethamount 1000 --to l2owner --wait - docker compose run scripts send-l1 --ethamount 10000 --to espresso-sequencer --wait - - echo == create l1 traffic - docker compose run scripts send-l1 --ethamount 1000 --to user_l1user --wait - docker compose run scripts send-l1 --ethamount 0.0001 --from user_l1user --to user_l1user_b --wait --delay 500 --times 1000000 > /dev/null & - - l2ownerAddress=`docker compose run scripts print-address --account l2owner | tail -n 1 | tr -d '\r\n'` - echo $l2ownerAddress - - echo == Writing l2 chain config - docker compose run scripts --l2owner $l2ownerAddress write-l2-chain-config --espresso - - sequenceraddress=`docker compose run scripts print-address --account sequencer | tail -n 1 | tr -d '\r\n'` - l2ownerKey=`docker compose run scripts print-private-key --account l2owner | tail -n 1 | tr -d '\r\n'` - wasmroot=`docker compose run --entrypoint sh sequencer -c "cat /home/user/target/machines/latest/module-root.txt"` - - echo == Deploying L2 chain - docker compose run -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" -e LIGHT_CLIENT_ADDR=$lightClientAddr rollupcreator create-rollup-testnode - docker compose run --entrypoint sh rollupcreator -c "jq [.[]] /config/deployed_chain_info.json > /config/l2_chain_info.json" - docker compose run --entrypoint sh rollupcreator -c "cat /config/l2_chain_info.json" - - echo == Writing config - docker compose run scripts write-config --espresso --lightClientAddress $lightClientAddr - echo == Initializing redis - docker compose up --wait redis - docker compose run scripts redis-init - - echo == Funding l2 funnel and dev key - docker compose up --wait $INITIAL_SEQ_NODES - docker compose run scripts bridge-funds --ethamount 100000 --wait - docker compose run scripts send-l2 --ethamount 10000 --to espresso-sequencer --wait - docker compose run scripts send-l2 --ethamount 100 --to l2owner --wait - - - echo == Deploy CacheManager on L2 - docker compose run -e CHILD_CHAIN_RPC="http://sequencer:8547" -e CHAIN_OWNER_PRIVKEY=$l2ownerKey rollupcreator deploy-cachemanager-testnode -fi - - -UP_FLAG="" -if $detach; then - UP_FLAG="--wait" -fi - -echo == Launching Sequencer -echo if things go wrong - use --init to create a new chain -echo $NODES - -docker compose up $UP_FLAG $NODES diff --git a/docker-compose-altlayer.yaml b/docker-compose-altlayer.yaml deleted file mode 100644 index 4ad17cb..0000000 --- a/docker-compose-altlayer.yaml +++ /dev/null @@ -1,195 +0,0 @@ -services: - postgres: - image: postgres:13.6 - restart: always - container_name: "postgres" - environment: - POSTGRES_PASSWORD: "" - POSTGRES_USER: "postgres" - POSTGRES_HOST_AUTH_METHOD: "trust" - volumes: - - "postgres-data:/var/lib/postgresql/data" - ports: - - "127.0.0.1:7432:5432" - - redis: - image: redis:6.2.6 - ports: - - "127.0.0.1:6379:6379" - - geth: - image: ethereum/client-go:v1.10.23 - ports: - - "127.0.0.1:8545:8545" - - "127.0.0.1:8551:8551" - - "127.0.0.1:8546:8546" - - "127.0.0.1:30303:30303" - volumes: - - "l1data:/datadir" - - "l1keystore:/keystore" - - "config:/config" - command: - - --keystore=/keystore - - --http - - --datadir=/datadir - - --http.addr=0.0.0.0 - - --authrpc.vhosts=* - - --authrpc.port=8551 - - --authrpc.addr=0.0.0.0 - - --http.vhosts=* - - --http.api=engine,personal,eth,net,web3 - - --http.corsdomain=* - - --ws - - --ws.addr=0.0.0.0 - - --ws.api=personal,eth,net,web3,debug,txpool - - --allow-insecure-unlock - - --unlock=0x3f1Eae7D46d88F08fc2F8ed27FCb2AB183EB2d0E - - --password=/datadir/passphrase - - --authrpc.jwtsecret=/config/jwt.hex - - --nodiscover - - --syncmode=full - - --dev - - --dev.period=1 - - --mine - - --miner.etherbase=0x3f1Eae7D46d88F08fc2F8ed27FCb2AB183EB2d0E - - --gcmode=archive - - sequencer: - pid: host # allow debugging - image: nitro-node-dev-testnode - entrypoint: /usr/local/bin/nitro - ports: - - "127.0.0.1:8547:8547" - - "127.0.0.1:8548:8548" - - "127.0.0.1:9642:9642" - volumes: - - "seqdata:/home/user/.arbitrum/local/nitro" - - "l1keystore:/home/user/l1keystore" - - "config:/config" - command: --conf.file /config/sequencer_config.json --node.feed.output.enable --node.feed.output.port 9642 --http.api net,web3,eth,txpool,debug --node.seq-coordinator.my-url ws://sequencer:8548 --graphql.enable --graphql.vhosts * --graphql.corsdomain * - depends_on: - - geth - - # Reads from sequencer feed, forwards transactions to sequencer - full-node: - pid: host # allow debugging - image: nitro-node-dev-testnode - ports: - - "127.0.0.1:8947:8547" - - "127.0.0.1:8948:8548" - entrypoint: /usr/local/bin/nitro - volumes: - - "config:/config" - - "l1keystore:/home/user/l1keystore" - # use the sequencer_config.json but override the sequencer settings and the forwarding settings. - command: --conf.file /config/sequencer_config.json --node.sequencer=false --node.batch-poster.enable=false --execution.sequencer.enable=false --execution.forwarding-target http://sequencer:8547 --node.delayed-sequencer.enable=false --node.feed.input.url ws://sequencer:9642 --http.port 8547 --http.api net,web3,arb,debug,net,eth --ws.port 8548 - depends_on: - - geth - - sequencer - - poster: - pid: host # allow debugging - image: nitro-node-dev-testnode - entrypoint: /usr/local/bin/nitro - ports: - - "127.0.0.1:8147:8547" - - "127.0.0.1:8148:8548" - volumes: - - "poster-data:/home/user/.arbitrum/local/nitro" - - "l1keystore:/home/user/l1keystore" - - "config:/config" - command: --conf.file /config/poster_config.json - depends_on: - - geth - - redis - - validator: - pid: host # allow debugging - image: nitro-node-dev-testnode - entrypoint: /usr/local/bin/nitro - ports: - - "127.0.0.1:8247:8547" - - "127.0.0.1:8248:8548" - volumes: - - "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,net,eth --ws.port 8548 - depends_on: - - sequencer - - validation_node - - validation_node: - pid: host # allow debugging - image: nitro-node-dev-testnode - entrypoint: /usr/local/bin/nitro-val - ports: - - "127.0.0.1:8949:8549" - volumes: - - "config:/config" - command: --conf.file /config/validation_node_config.json - - scripts: - build: scripts/ - volumes: - - "l1keystore:/home/user/l1keystore" - - "config:/config" - - rollupcreator: - depends_on: - - geth - - sequencer - pid: host - build: - context: rollupcreator/ - args: - NITRO_CONTRACTS_REPO: ${NITRO_CONTRACTS_REPO:-} - NITRO_CONTRACTS_BRANCH: ${NITRO_CONTRACTS_BRANCH:-} - volumes: - - "config:/config" - - /var/run/docker.sock:/var/run/docker.sock - - espresso-dev-node: - # TODO: revert to `:main` tag once we are compatible with the marketplace builder - image: ghcr.io/espressosystems/espresso-sequencer/espresso-dev-node:20240919-dev-node-legacy-builder - ports: - - "$ESPRESSO_SEQUENCER_API_PORT:$ESPRESSO_SEQUENCER_API_PORT" - - "$ESPRESSO_BUILDER_PORT:$ESPRESSO_BUILDER_PORT" - - "$ESPRESSO_DEV_NODE_PORT:$ESPRESSO_DEV_NODE_PORT" - environment: - - ESPRESSO_SEQUENCER_L1_PROVIDER - - ESPRESSO_SEQUENCER_ETH_MNEMONIC - - ESPRESSO_DEPLOYER_ACCOUNT_INDEX - - ESPRESSO_SEQUENCER_API_PORT - - ESPRESSO_BUILDER_PORT - - ESPRESSO_DEV_NODE_PORT - - RUST_LOG=info - - RUST_LOG_FORMAT - - ESPRESSO_DEPLOYER_ALT_CHAIN_PROVIDERS - - ESPRESSO_DEPLOYER_ALT_MNEMONICS - - ESPRESSO_SEQUENCER_DEPLOYER_ALT_INDICES - depends_on: - - geth - - sequencer - healthcheck: - test: - [ - "CMD-SHELL", - "curl -fL http://localhost:$ESPRESSO_DEV_NODE_PORT || exit 1", - ] - interval: 30s - timeout: 10s - retries: 5 - start_period: 40s - extra_hosts: - - "host.docker.internal:host-gateway" - -volumes: - l1data: - consensus: - l1keystore: - seqdata: - validator-data: - poster-data: - config: - postgres-data: diff --git a/smoke-test-altlayer.bash b/smoke-test-altlayer.bash index c579edc..6d3afde 100755 --- a/smoke-test-altlayer.bash +++ b/smoke-test-altlayer.bash @@ -1,16 +1,15 @@ #!/usr/bin/env bash set -euo pipefail -COMPOSE_FILE=docker-compose-altlayer.yaml -./altlayer-test-node.bash --init --latest-espresso-image --detach +# Run altlayer config with batch poster, sequencer, full node and validator +./test-node.bash --init-force --validate --batchposters 1 --latest-espresso-image --detach docker compose up -d full-node --detach - # Sending L2 transaction through the full-node's api user=user_l2user -./altlayer-test-node.bash script send-l2 --ethamount 100 --to $user --wait +./test-node.bash script send-l2 --ethamount 100 --to $user --wait # Check the balance from full-node's api userAddress=$(docker compose run scripts print-address --account $user | tail -n 1 | tr -d '\r\n') From 1e6e2b43984682b894a6bcf3153db79c632f0124 Mon Sep 17 00:00:00 2001 From: Sneh Koul Date: Wed, 23 Oct 2024 09:35:39 -0500 Subject: [PATCH 6/6] use full node as l2 url --- smoke-test-altlayer.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smoke-test-altlayer.bash b/smoke-test-altlayer.bash index 6d3afde..c4875ec 100755 --- a/smoke-test-altlayer.bash +++ b/smoke-test-altlayer.bash @@ -9,7 +9,7 @@ docker compose up -d full-node --detach # Sending L2 transaction through the full-node's api user=user_l2user -./test-node.bash script send-l2 --ethamount 100 --to $user --wait +./test-node.bash script send-l2 --l2url ws://full-node:8548 --ethamount 100 --to $user --wait # Check the balance from full-node's api userAddress=$(docker compose run scripts print-address --account $user | tail -n 1 | tr -d '\r\n')