├── .github ├── CODEOWNERS └── workflows │ └── integration.yml ├── .gitignore ├── .gitmodules ├── Makefile ├── README.md ├── build-local.sh ├── docker-compose.build.yml ├── docker-compose.env.yml ├── docker-compose.local.yml ├── docker-compose.yml ├── optional ├── replica-service.yml ├── verifier-service.local.yml ├── verifier-service.yml └── x-domain-service.yml ├── pull.sh ├── test.sh ├── up-replica.sh ├── up-verifier.sh └── up.sh /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @tynes 2 | -------------------------------------------------------------------------------- /.github/workflows/integration.yml: -------------------------------------------------------------------------------- 1 | name: Setup & Run Integration Test Suite 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | build: 13 | name: Setup & Run Integration Tests 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v2 18 | 19 | - name: Submodules 20 | run: | 21 | sed -i -Ee's#git@github.com:([^/]*)/(.*).git#https://github.com/\1/\2.git#' .gitmodules 22 | git submodule init 23 | git submodule update 24 | 25 | - name: Build 26 | run: | 27 | make all 28 | 29 | - name: Test 30 | run: | 31 | ./test.sh -l --suppress-output 32 | 33 | - name: Upload Log Artifacts 34 | uses: actions/upload-artifact@v2 35 | with: 36 | name: integration-test-artifacts 37 | path: ./artifacts 38 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "go-ethereum"] 2 | path = go-ethereum 3 | url = git@github.com:ethereum-optimism/go-ethereum.git 4 | [submodule "integration-tests"] 5 | path = integration-tests 6 | url = git@github.com:ethereum-optimism/integration-tests.git 7 | [submodule "docker"] 8 | path = docker 9 | url = git@github.com:ethereum-optimism/docker.git 10 | [submodule "batch-submitter"] 11 | path = batch-submitter 12 | url = git@github.com:ethereum-optimism/batch-submitter.git 13 | [submodule "data-transport-layer"] 14 | path = data-transport-layer 15 | url = git@github.com:ethereum-optimism/data-transport-layer.git 16 | [submodule "contracts"] 17 | path = contracts 18 | url = git@github.com:ethereum-optimism/contracts.git 19 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all integration-tests deployer geth-l2 batch-submitter data-transport-layer test 2 | 3 | SHELL := /bin/bash 4 | 5 | all: 6 | @echo "Building in parallel in the background" 7 | ./build-local.sh 8 | @while :; do [ $$(docker ps --format='{{.Image}}' | grep builder | wc -l) == 0 ] && exit 0; sleep 2; done; 9 | 10 | up-local: 11 | ./up.sh -l 12 | 13 | integration-tests: 14 | ./build-local.sh -s integration_tests 15 | 16 | deployer: 17 | ./build-local.sh -s deployer 18 | 19 | geth-l2: 20 | ./build-local.sh -s geth_l2 21 | 22 | batch-submitter: 23 | ./build-local.sh -s batch_submitter 24 | 25 | data-transport-layer: 26 | ./build-local.sh -s data_transport_layer 27 | 28 | # For developing against published docker images 29 | up: 30 | ./up.sh 31 | 32 | test: 33 | ./test.sh 34 | 35 | test-%: 36 | ./test.sh -p $@ 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **[DEPRECATED]** This repository is now deprecated in favour of the new development [monorepo](https://github.com/ethereum-optimism/optimism-monorepo). 2 | 3 | # Optimism Integration 4 | 5 | A single repository intended to provide the ability to run a local 6 | Optimistic Ethereum environment including both L1 & L2 chains. This 7 | can be used to rapidly iterate over the many Optimism repositories and 8 | run integration tests. 9 | 10 | ## Requirements 11 | 12 | - [docker](https://docs.docker.com/get-docker/) 13 | - At least version 19.03.12 14 | - [docker-compose](https://docs.docker.com/compose/install/) 15 | - At least version 1.27.3 16 | - Recommended Docker memory allocation of >=8 GB. 17 | 18 | 19 | ## Usage 20 | This package can be used to run tests, or even just spin up an easy-to-edit 21 | optimism system. 22 | 23 | ```bash 24 | # Git clone with submodules 25 | $ git clone git@github.com:ethereum-optimism/optimism-integration.git --recurse-submodules 26 | 27 | $ cd optimism-integration 28 | 29 | # The `docker` submodule is a one stop shop for building containers 30 | $ ./docker/build.sh 31 | 32 | # Run tests 33 | $ make test 34 | 35 | # Run published images of full system 36 | $ make up 37 | ``` 38 | 39 | Submodules are updated automatically as commits land in `master` in the 40 | respective repositories through a Github action. 41 | 42 | The submodules can be updated with: 43 | 44 | ```bash 45 | $ git submodule update 46 | ``` 47 | 48 | ## Scripts 49 | 50 | ### up.sh 51 | 52 | There are two ways to run `up.sh`. 53 | 54 | #### Running with Published Docker Images 55 | 56 | This is the recommended way to use this repository for building an application 57 | on the Optimistic Ethereum protocol. 58 | 59 | Docker images are built and automatically published to [Dockerhub](https://hub.docker.com/u/ethereumoptimism). 60 | Docker will automaticaly use images found locally. To pull the latest images, 61 | use the command: 62 | 63 | ```bash 64 | $ docker-compose pull 65 | ``` 66 | 67 | To start all of the services, run the command: 68 | 69 | ```bash 70 | $ make up 71 | ``` 72 | 73 | Particular Docker images can be used by specifying an environment variable at 74 | runtime. `_TAG` will be templated into the `docker-compose.yml` 75 | files at runtime. 76 | 77 | To run the docker image `ethereumoptimism/go-ethereum:myfeature`, use the 78 | command: 79 | 80 | ``` 81 | $ GETH_L2_TAG=myfeature make up 82 | ``` 83 | 84 | This is helpful when making changes to multiple repositories and testing the 85 | changes across the whole system. See the [docker](https://github.com/ethereum-optimism/docker) 86 | repository for instructions on building custom images locally. 87 | 88 | #### Running with Local Code 89 | 90 | This is the recommended way to use this repository when developing the 91 | Optimistic Ethereum protocol itself. 92 | 93 | The submodules can be mounted in at runtime so that any changes to the 94 | submodules can be observed in the context of the whole system. 95 | Any compiled code must be built inside of a Docker container so that 96 | it is compiled correctly. The Makefile is used for this 97 | purpose. 98 | 99 | To build all local submodules, run the command: 100 | 101 | ```bash 102 | $ make all 103 | ``` 104 | 105 | To compile only a specific service, the `-s` flag can be used. The possible 106 | services can be found in the `docker-compose.build.yml` file. 107 | 108 | To build only `go-ethereum`, run the command: 109 | 110 | ```bash 111 | $ make geth-l2 112 | ``` 113 | 114 | To specify using the submodules with `up.sh`, use the `-l` flag: 115 | 116 | ```bash 117 | $ make up-local 118 | ``` 119 | 120 | ### Testing 121 | 122 | To run all of the tests: 123 | 124 | ```bash 125 | $ make test 126 | ``` 127 | 128 | This script is used to run each of the `integration-tests` test suites 129 | against the whole system. Each package in the `integration-tests` repo 130 | gets its own fresh state, meaning that the tests cannot run in parallel 131 | unless each test suite has its own instances of each of the Optimistic 132 | Ethereum services. 133 | 134 | To run only a specific test suite: 135 | 136 | ```bash 137 | $ make test- 138 | ``` 139 | 140 | The `-p` flag is used to set the `PKGS` environment variable and is 141 | used to specify which test suite runs. The possible test suites are found 142 | in the [integration tests](https://github.com/ethereum-optimism/integration-tests) 143 | repository, in the `packages` directory. 144 | 145 | Set `PKGS` to the package name to run a particular package. If `PKGS` is unset, 146 | each test suite will run in sequence. The name of a test suite can be found 147 | in its `package.json` as the `.name` property without the `@eth-optimism` 148 | prefix. Note that the name must match the name of the directory containing 149 | the test suite for the automation to work. If `PKGS` contains 150 | multiple packages delimated by a comma, the results will be non-deterministic 151 | and the tests should be expected to fail. 152 | 153 | The `optional` directory contains additional service files that will be used 154 | if the name of the test suite has a corresponding file 155 | `optional/-service.yml`. This is useful for adding additional 156 | services that are not required for all test suites. 157 | 158 | -------------------------------------------------------------------------------- /build-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # build-local.sh - build inside docker image 4 | # for local development 5 | # Copyright 2020 Optimism PBC 6 | # MIT License 7 | 8 | # This script uses docker-compose to manage the different 9 | # commands and entrypoints for building the different services. 10 | # The possible services are in docker-compose.local.yml 11 | 12 | USAGE=" 13 | $ ./scripts/build-local.sh 14 | Build docker images from git branches. 15 | All images will be built if no service 16 | is specificed. 17 | 18 | CLI Arguments: 19 | -s|--service - service to build 20 | -h|--help - help message 21 | " 22 | 23 | # run all of the services except for the integration_tests 24 | SERVICES=$(docker-compose -f docker-compose.build.yml config --services \ 25 | | tr '\n' ' ') 26 | SERVICE="" 27 | 28 | while (( "$#" )); do 29 | case "$1" in 30 | -s|--service) 31 | if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then 32 | SERVICE="$2" 33 | shift 2 34 | else 35 | echo "Error: Argument for $1 is missing" >&2 36 | exit 1 37 | fi 38 | ;; 39 | -h|--help) 40 | echo "$USAGE" 41 | exit 0 42 | ;; 43 | *) 44 | echo "Unknown argument $1" >&2 45 | shift 46 | ;; 47 | esac 48 | done 49 | 50 | docker-compose -f docker-compose.build.yml down --remove-orphans 51 | 52 | # Remove all volumes except for the go-modules volume 53 | docker volume ls --format='{{.Name}}' \ 54 | | grep optimism-integration \ 55 | | grep -v go-modules \ 56 | | xargs docker volume rm -f \ 57 | > /dev/null 2>&1 58 | 59 | if [ -z $SERVICE ]; then 60 | for SERVICE in $SERVICES; do 61 | docker-compose -f docker-compose.build.yml run --rm -d $SERVICE 62 | done 63 | else 64 | docker-compose -f docker-compose.build.yml run --rm $SERVICE 65 | fi 66 | -------------------------------------------------------------------------------- /docker-compose.build.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | volumes: 4 | go-modules: # Define a volume for Go modules 5 | 6 | services: 7 | integration_tests: 8 | image: ethereumoptimism/builder:latest 9 | network_mode: host 10 | volumes: 11 | - ./:/mnt 12 | working_dir: /mnt/integration-tests 13 | entrypoint: ["sh", "-c", "yarn && yarn build"] 14 | 15 | deployer: 16 | image: ethereumoptimism/builder:latest 17 | network_mode: host 18 | volumes: 19 | - ./:/mnt 20 | working_dir: /mnt/contracts 21 | entrypoint: ["sh", "-c", "yarn && yarn build"] 22 | 23 | geth_l2: 24 | image: ethereumoptimism/builder:latest 25 | network_mode: host 26 | volumes: 27 | - ./:/mnt 28 | - go-modules:/go/pkg/mod # Put modules cache into a separate volume 29 | entrypoint: ["make", "geth"] 30 | working_dir: /mnt/go-ethereum 31 | 32 | batch_submitter: 33 | image: ethereumoptimism/builder:latest 34 | network_mode: host 35 | volumes: 36 | - ./:/mnt 37 | working_dir: /mnt/batch-submitter 38 | entrypoint: ["sh", "-c", "yarn && yarn build"] 39 | 40 | data_transport_layer: 41 | image: ethereumoptimism/builder:latest 42 | network_mode: host 43 | volumes: 44 | - ./:/mnt 45 | working_dir: /mnt/data-transport-layer 46 | entrypoint: ["sh", "-c", "yarn && yarn build"] 47 | -------------------------------------------------------------------------------- /docker-compose.env.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | data_transport_layer: 5 | environment: 6 | - DATA_TRANSPORT_LAYER__SYNC_FROM_L1=true 7 | - DATA_TRANSPORT_LAYER__SYNC_FROM_L2=false 8 | - DATA_TRANSPORT_LAYER__L2_RPC_ENDPOINT=http://geth_l2:8545 9 | - DATA_TRANSPORT_LAYER__L2_CHAIN_ID= 10 | - DATA_TRANSPORT_LAYER__DB_PATH=/db 11 | - DATA_TRANSPORT_LAYER__SERVER_PORT=7878 12 | - DATA_TRANSPORT_LAYER__TRANSACTIONS_PER_POLLING_INTERVAL=1000 13 | - DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT=http://l1_chain:9545 14 | - DATA_TRANSPORT_LAYER__CONFIRMATIONS=0 15 | - DATA_TRANSPORT_LAYER__POLLING_INTERVAL=500 16 | - DATA_TRANSPORT_LAYER__LOGS_PER_POLLING_INTERVAL=2000 17 | - DATA_TRANSPORT_LAYER__DANGEROUSLY_CATCH_ALL_ERRORS=true 18 | - DATA_TRANSPORT_LAYER__SERVER_HOSTNAME=0.0.0.0 19 | - DATA_TRANSPORT_LAYER__ADDRESS_MANAGER= 20 | - L1_NODE_WEB3_URL=http://l1_chain:9545 21 | - DEPLOYER_HTTP=http://deployer:8080 22 | - RETRIES=50 23 | 24 | geth_l2: 25 | environment: 26 | - ETH1_SYNC_SERVICE_ENABLE=true 27 | - ETH1_CTC_DEPLOYMENT_HEIGHT=8 28 | - ETH1_HTTP=http://l1_chain:9545 29 | - ETH1_CONFIRMATION_DEPTH=0 30 | - ROLLUP_CLIENT_HTTP=http://data_transport_layer:7878 31 | - ROLLUP_POLL_INTERVAL_FLAG=3s 32 | - USING_OVM=true 33 | - CHAIN_ID=420 34 | - NETWORK_ID=420 35 | - DEV=true 36 | - DATADIR=/root/.ethereum 37 | - RPC_ENABLE=true 38 | - RPC_ADDR=geth_l2 39 | - RPC_CORS_DOMAIN=* 40 | - RPC_VHOSTS=* 41 | - RPC_PORT=8545 42 | - WS=true 43 | - WS_ADDR=0.0.0.0 44 | - IPC_DISABLE=true 45 | - TARGET_GAS_LIMIT=9000000 46 | - RPC_API=eth,net,rollup,web3 47 | - WS_API=eth,net,rollup,web3 48 | - WS_ORIGINS=* 49 | - GASPRICE=0 50 | - NO_USB=true 51 | - GCMODE=archive 52 | - NO_DISCOVER=true 53 | - DEPLOYER_HTTP=http://deployer:8080 54 | - ROLLUP_STATE_DUMP_PATH=http://deployer:8080/dumps/state-dump.latest.json 55 | - RETRIES=60 56 | 57 | batch_submitter: 58 | environment: 59 | - DEBUG=info*,error*,warn*,debug* 60 | - MAX_L1_TX_SIZE=90000 61 | - MIN_L1_TX_SIZE=0 62 | - MAX_TX_BATCH_COUNT=50 63 | - MAX_STATE_BATCH_COUNT=50 64 | - POLL_INTERVAL=15000 65 | - NUM_CONFIRMATIONS=0 66 | - RESUBMISSION_TIMEOUT=1000000 67 | - FINALITY_CONFIRMATIONS=0 68 | - RUN_TX_BATCH_SUBMITTER=true 69 | - RUN_STATE_BATCH_SUBMITTER=true 70 | - MAX_BATCH_SUBMISSION_TIME=0 71 | - SAFE_MINIMUM_ETHER_BALANCE=0 72 | - CLEAR_PENDING_TXS=false 73 | - L1_NODE_WEB3_URL=http://l1_chain:9545 74 | - L2_NODE_WEB3_URL=http://geth_l2:8545 75 | - DEPLOYER_HTTP=http://deployer:8080 76 | - SEQUENCER_PRIVATE_KEY=0xd2ab07f7c10ac88d5f86f1b4c1035d5195e81f27dbe62ad65e59cbf88205629b 77 | - RETRIES=80 78 | - ADDRESS_MANAGER_ADDRESS= 79 | 80 | l1_chain: 81 | environment: 82 | - ETH1_HTTP_PORT=9545 83 | - MNEMONIC=abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about 84 | 85 | deployer: 86 | environment: 87 | - HARDHAT=true 88 | - FRAUD_PROOF_WINDOW_SECONDS=0 89 | - L1_NODE_WEB3_URL=http://l1_chain:9545 90 | - DEPLOYER_PRIVATE_KEY=0x754fde3f5e60ef2c7649061e06957c29017fe21032a8017132c0078e37f6193a 91 | - SEQUENCER_PRIVATE_KEY=0xd2ab07f7c10ac88d5f86f1b4c1035d5195e81f27dbe62ad65e59cbf88205629b 92 | 93 | integration_tests: 94 | environment: 95 | - L1_NODE_WEB3_URL=http://l1_chain:9545 96 | - L2_NODE_WEB3_URL=http://geth_l2:8545 97 | - MNEMONIC=abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about 98 | - DEPLOYER_HTTP=http://deployer:8080 99 | - CHAIN_ID=420 100 | - TARGET_GAS_LIMIT=9000000 101 | - DEPLOYER_URL=http://deployer:8080 102 | - DEPLOYER_PRIVATE_KEY=0x754fde3f5e60ef2c7649061e06957c29017fe21032a8017132c0078e37f6193a 103 | - SEQUENCER_PRIVATE_KEY=0xd2ab07f7c10ac88d5f86f1b4c1035d5195e81f27dbe62ad65e59cbf88205629b 104 | - RETRIES=60 105 | - ETH1_ADDRESS_RESOLVER_ADDRESS= 106 | -------------------------------------------------------------------------------- /docker-compose.local.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | integration_tests: 5 | image: ethereumoptimism/integration-tests:${INTEGRATION_TESTS_TAG:-latest} 6 | volumes: 7 | - ./integration-tests:/integration-tests 8 | - ./docker/integration-tests/wait-for-l1-and-l2-and-contract-deployment.sh:/wait.sh 9 | entrypoint: ["/wait.sh", "yarn", "run", "ci"] 10 | environment: 11 | - "PKGS=${PKGS}" 12 | 13 | l1_chain: 14 | image: ethereumoptimism/hardhat:${L1_CHAIN_TAG:-latest} 15 | ports: 16 | - 9545:9545 17 | 18 | geth_l2: 19 | image: ethereumoptimism/go-ethereum:${GETH_L2_TAG:-latest} 20 | volumes: 21 | - ./:/mnt 22 | - geth:/l2-node/l2:rw 23 | # Put modules cache into a separate volume 24 | - go-modules:/go/pkg/mod 25 | # Mount the locally built geth earlier in the PATH 26 | - ./go-ethereum/build/bin/geth:/usr/local/sbin/geth 27 | ports: 28 | - 8545:8545 29 | - 8546:8546 30 | 31 | batch_submitter: 32 | image: ethereumoptimism/batch-submitter:${BATCH_SUBMITTER_TAG:-latest} 33 | volumes: 34 | - ./batch-submitter:/opt/batch-submitter 35 | 36 | data_transport_layer: 37 | image: ethereumoptimism/data-transport-layer:${DATA_TRANSPORT_LAYER_TAG:-latest} 38 | volumes: 39 | - ./data-transport-layer:/opt/data-transport-layer 40 | ports: 41 | - 7878:7878 42 | 43 | deployer: 44 | image: ethereumoptimism/deployer:${DEPLOYER_TAG:-latest} 45 | working_dir: /opt/contracts 46 | entrypoint: ["/wait-for-l1.sh", "yarn", "run", "--silent", "deploy"] 47 | volumes: 48 | - ./contracts:/opt/contracts 49 | ports: 50 | - 8080:8080 51 | 52 | volumes: 53 | geth: 54 | go-modules: 55 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | integration_tests: 5 | image: ethereumoptimism/integration-tests:${INTEGRATION_TESTS_TAG:-latest} 6 | environment: 7 | - "PKGS=${PKGS}" 8 | 9 | l1_chain: 10 | image: ethereumoptimism/hardhat:${L1_CHAIN_TAG:-latest} 11 | ports: 12 | - 9545:9545 13 | 14 | geth_l2: 15 | image: ethereumoptimism/go-ethereum:${GETH_L2_TAG:-latest} 16 | volumes: 17 | - geth:/l2-node/l2:rw 18 | ports: 19 | - 8545:8545 20 | - 8546:8546 21 | 22 | batch_submitter: 23 | image: ethereumoptimism/batch-submitter:${BATCH_SUBMITTER_TAG:-latest} 24 | 25 | data_transport_layer: 26 | image: ethereumoptimism/data-transport-layer:${DATA_TRANSPORT_LAYER_TAG:-latest} 27 | ports: 28 | - 7878:7878 29 | 30 | deployer: 31 | image: ethereumoptimism/deployer:${DEPLOYER_TAG:-latest} 32 | ports: 33 | - 8080:8080 34 | 35 | volumes: 36 | geth: 37 | -------------------------------------------------------------------------------- /optional/replica-service.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | replica_data_transport_layer: 5 | image: ethereumoptimism/data-transport-layer:${REPLICA_DATA_TRANSPORT_LAYER_TAG:-latest} 6 | environment: 7 | - DATA_TRANSPORT_LAYER__SYNC_FROM_L1=false 8 | - DATA_TRANSPORT_LAYER__SYNC_FROM_L2=true 9 | - DATA_TRANSPORT_LAYER__L2_RPC_ENDPOINT=http://geth_l2:8545 10 | - DATA_TRANSPORT_LAYER__L2_CHAIN_ID= 11 | - DATA_TRANSPORT_LAYER__DB_PATH=/db 12 | - DATA_TRANSPORT_LAYER__SERVER_PORT=7878 13 | - DATA_TRANSPORT_LAYER__TRANSACTIONS_PER_POLLING_INTERVAL=1000 14 | - DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT=http://l1_chain:9545 15 | - DATA_TRANSPORT_LAYER__CONFIRMATIONS=0 16 | - DATA_TRANSPORT_LAYER__POLLING_INTERVAL=500 17 | - DATA_TRANSPORT_LAYER__LOGS_PER_POLLING_INTERVAL=2000 18 | - DATA_TRANSPORT_LAYER__DANGEROUSLY_CATCH_ALL_ERRORS=true 19 | - DATA_TRANSPORT_LAYER__SERVER_HOSTNAME=0.0.0.0 20 | - DATA_TRANSPORT_LAYER__ADDRESS_MANAGER= 21 | - L1_NODE_WEB3_URL=http://l1_chain:9545 22 | - DEPLOYER_HTTP=http://deployer:8080 23 | ports: 24 | - 7879:7878 25 | 26 | replica_geth_l2: 27 | image: ethereumoptimism/go-ethereum:${REPLICA_GETH_L2_TAG:-latest} 28 | environment: 29 | - ETH1_SYNC_SERVICE_ENABLE=true 30 | - ETH1_CTC_DEPLOYMENT_HEIGHT=8 31 | - ETH1_HTTP=http://l1_chain:9545 32 | - ETH1_CONFIRMATION_DEPTH=0 33 | - ROLLUP_CLIENT_HTTP=http://data_transport_layer:7878 34 | - ROLLUP_POLL_INTERVAL_FLAG=3s 35 | - ROLLUP_VERIFIER=true 36 | - USING_OVM=true 37 | - CHAIN_ID=420 38 | - NETWORK_ID=420 39 | - DEV=true 40 | - DATADIR=/root/.ethereum 41 | - RPC_ENABLE=true 42 | - RPC_ADDR=0.0.0.0 43 | - RPC_CORS_DOMAIN=* 44 | - RPC_VHOSTS=* 45 | - RPC_PORT=8545 46 | - WS=true 47 | - WS_ADDR=0.0.0.0 48 | - IPC_DISABLE=true 49 | - TARGET_GAS_LIMIT=9000000 50 | - RPC_API=eth,net,rollup,web3,debug 51 | - WS_API=eth,net,rollup,web3,debug 52 | - WS_ORIGINS=* 53 | - GASPRICE=0 54 | - NO_USB=true 55 | - GCMODE=archive 56 | - NO_DISCOVER=true 57 | - DEPLOYER_HTTP=http://deployer:8080 58 | - ROLLUP_STATE_DUMP_PATH=http://deployer:8080/dumps/state-dump.latest.json 59 | ports: 60 | - 6545:8545 61 | - 6546:8546 62 | -------------------------------------------------------------------------------- /optional/verifier-service.local.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | verifier: 5 | volumes: 6 | - verifier:/l2-node/l2:rw 7 | # Mount the locally built geth earlier in the PATH 8 | - ./go-ethereum/build/bin/geth:/usr/local/sbin/geth 9 | -------------------------------------------------------------------------------- /optional/verifier-service.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | 5 | verifier: 6 | image: ethereumoptimism/go-ethereum:${VERIFIER_TAG:-latest} 7 | volumes: 8 | - verifier:/root/.ethereum:rw 9 | environment: 10 | - ROLLUP_VERIFIER_ENABLE=true 11 | - CHAIN_ID=420 12 | - NETWORK_ID=420 13 | - DEV=true 14 | - DATADIR=/root/.ethereum 15 | - RPC_ENABLE=true 16 | - RPC_ADDR=verifier 17 | - RPC_CORS_DOMAIN=* 18 | - RPC_VHOSTS=* 19 | - RPC_PORT=8045 20 | - WS=true 21 | - WS_ADDR=0.0.0.0 22 | - WS_PORT=8046 23 | - IPC_DISABLE=true 24 | - TARGET_GAS_LIMIT=12000000 25 | - RPC_API=eth,net,rollup,web3 26 | - WS_API=eth,net,rollup,web3 27 | - WS_ORIGINS=* 28 | - GASPRICE=0 29 | - NO_USB=true 30 | - GCMODE=archive 31 | - NO_DISCOVER=true 32 | - USING_OVM=true 33 | - ETH1_SYNC_SERVICE_ENABLE=true 34 | - ETH1_CTC_DEPLOYMENT_HEIGHT=8 35 | - ETH1_HTTP=http://l1_chain:9545 36 | - ETH1_CONFIRMATION_DEPTH=0 37 | - DEPLOYER_HTTP=http://deployer:8080 38 | - L1_NODE_WEB3_URL=http://l1_chain:9545 39 | ports: 40 | - 8045:8045 41 | - 8046:8046 42 | 43 | volumes: 44 | verifier: 45 | -------------------------------------------------------------------------------- /optional/x-domain-service.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | message_relayer: 5 | image: ethereumoptimism/message-relayer:${MESSAGE_RELAYER_TAG:-latest} 6 | environment: 7 | - L1_WALLET_KEY=0xea8b000efb33c49d819e8d6452f681eed55cdf7de47d655887fc0e318906f2e7 8 | - L1_NODE_WEB3_URL=http://l1_chain:9545 9 | - L2_NODE_WEB3_URL=http://geth_l2:8545 10 | - DEPLOYER_HTTP=http://deployer:8080 11 | - RETRIES=80 12 | - ADDRESS_MANAGER_ADDRESS= 13 | -------------------------------------------------------------------------------- /pull.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | git pull --recurse-submodules 4 | git submodule update 5 | docker-compose pull 6 | -------------------------------------------------------------------------------- /test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eou pipefail 4 | 5 | # PKGS are packages in the "integration-tests" repo. 6 | # The name of the directory must match the package name 7 | # with the "eth-optimism/" prefix. 8 | 9 | PKGS=${PKGS:-""} 10 | DOCKERFILE=docker-compose.yml 11 | SUPPRESS_OUTPUT=${SUPPRESS_OUTPUT:-false} 12 | 13 | while (( "$#" )); do 14 | case "$1" in 15 | -p|--pkgs) 16 | if [ -n "$2" ] && [ ${2:0:1} != "-" ]; then 17 | PKGS="$2" 18 | shift 2 19 | else 20 | echo "Error: Argument for $1 is missing" >&2 21 | exit 1 22 | fi 23 | ;; 24 | -l|--local) 25 | DOCKERFILE=docker-compose.local.yml 26 | shift 1 27 | ;; 28 | -s|--suppress-output) 29 | echo "Logs will not be streamed and instead only be available as artifacts" 30 | SUPPRESS_OUTPUT=true 31 | shift 1 32 | ;; 33 | *) 34 | echo "Unknown argument $1" >&2 35 | shift 36 | ;; 37 | esac 38 | done 39 | 40 | DEPLOYER_TAG=${DEPLOYER_TAG:-latest} 41 | BATCH_SUBMITTER_TAG=${BATCH_SUBMITTER_TAG:-latest} 42 | GETH_L2_TAG=${GETH_L2_TAG:-latest} 43 | L1_CHAIN_TAG=${L1_CHAIN_TAG:-latest} 44 | INTEGRATION_TESTS_TAG=${INTEGRATION_TESTS_TAG:-latest} 45 | MESSAGE_RELAYER_TAG=${MESSAGE_RELAYER_TAG:-latest} 46 | DATA_TRANSPORT_LAYER_TAG=${DATA_TRANSPORT_LAYER_TAG:-latest} 47 | 48 | # Replace slash with underscore in tags 49 | DEPLOYER_TAG=$(echo $DEPLOYER_TAG | sed 's/\//_/g') 50 | BATCH_SUBMITTER_TAG=$(echo $BATCH_SUBMITTER_TAG | sed 's/\//_/g') 51 | GETH_L2_TAG=$(echo $GETH_L2_TAG | sed 's/\//_/g') 52 | L1_CHAIN_TAG=$(echo $L1_CHAIN_TAG | sed 's/\//_/g') 53 | INTEGRATION_TESTS_TAG=$(echo $INTEGRATION_TESTS_TAG | sed 's/\//_/g') 54 | MESSAGE_RELAYER_TAG=$(echo $MESSAGE_RELAYER_TAG | sed 's/\//_/g') 55 | DATA_TRANSPORT_LAYER_TAG=$(echo $DATA_TRANSPORT_LAYER_TAG | sed 's/\//_/g') 56 | 57 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )" 58 | 59 | function run { 60 | # Create artifacts folder for logs 61 | artifacts_folder="$DIR/artifacts/$PKGS" 62 | mkdir -p $artifacts_folder 63 | 64 | local cmd 65 | cmd="docker-compose -f $DIR/$DOCKERFILE" 66 | cmd="$cmd -f $DIR/docker-compose.env.yml" 67 | if [ -f "$DIR/optional/$PKGS-service.yml" ]; then 68 | cmd="$cmd -f $DIR/optional/$PKGS-service.yml" 69 | fi 70 | cmd="$cmd up" 71 | cmd="$cmd --exit-code-from integration_tests" 72 | cmd="$cmd --abort-on-container-exit" 73 | 74 | echo "Logs available per-service at $artifacts_folder" 75 | 76 | ( 77 | export PKGS=$PKGS; 78 | export DEPLOYER_TAG=$DEPLOYER_TAG; 79 | export BATCH_SUBMITTER_TAG=$BATCH_SUBMITTER_TAG; 80 | export GETH_L2_TAG=$GETH_L2_TAG; 81 | export L1_CHAIN_TAG=$L1_CHAIN_TAG; 82 | export INTEGRATION_TESTS_TAG=$INTEGRATION_TESTS_TAG; 83 | export MESSAGE_RELAYER_TAG=$MESSAGE_RELAYER_TAG; 84 | export DATA_TRANSPORT_LAYER_TAG=$DATA_TRANSPORT_LAYER_TAG; 85 | 86 | if [ "$SUPPRESS_OUTPUT" = true ]; then 87 | $cmd &> $artifacts_folder/process.log 88 | else 89 | $cmd 2>&1 | tee $artifacts_folder/process.log 90 | fi 91 | ) 92 | 93 | ( 94 | # Send all process logs to artifacts folder w/ service name as filename 95 | # Delimiter based on | which docker-compose uses in streamed logs 96 | cd $artifacts_folder 97 | cat process.log | 98 | perl -pe 's/\x1b\[[0-9;]*[mG]//g' | # Remove bash color characters 99 | grep -e "|" | # Only get log lines 100 | awk '{ 101 | delimiter_idx = index($0, "| "); 102 | service_name = substr($0, 0, delimiter_idx); 103 | gsub("[^a-zA-Z0-9_]", "", service_name); 104 | gsub("$", ".log", service_name); 105 | outputfile = sprintf (service_name); 106 | print substr($0, delimiter_idx + 2) > outputfile; 107 | }' 108 | ) 109 | 110 | } 111 | 112 | function clean { 113 | local cmd 114 | cmd="docker-compose -f $DOCKERFILE" 115 | cmd="$cmd -f $DIR/docker-compose.env.yml" 116 | if [ -f "$DIR/optional/$PKGS-service.yml" ]; then 117 | cmd="$cmd -f $DIR/optional/$PKGS-service.yml" 118 | fi 119 | cmd="$cmd down -v --remove-orphans" 120 | $cmd 121 | } 122 | 123 | if [ ! -z "$PKGS" ]; then 124 | clean 125 | run 126 | else 127 | # The directory name must match the package name with @eth-optimism/ prefix 128 | for PACKAGE_PATH in $DIR/integration-tests/packages/*; do 129 | [ -e "$PACKAGE_PATH" ] || continue 130 | PKGS=$(basename $PACKAGE_PATH) 131 | echo "Running $PKGS test suite" 132 | 133 | clean 134 | run 135 | done 136 | fi 137 | 138 | -------------------------------------------------------------------------------- /up-replica.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Start services without the integration tests 4 | # The `-s` flag takes a string of services to run. 5 | # The `-l` flag will use mounted code. 6 | 7 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )" 8 | DOCKERFILE="docker-compose.yml" 9 | SERVICES=$(docker-compose \ 10 | -f $DIR/$DOCKERFILE \ 11 | -f $DIR/docker-compose.env.yml \ 12 | -f $DIR/optional/x-domain-service.yml \ 13 | -f $DIR/optional/replica-service.yml \ 14 | config --services \ 15 | | grep -v integration_tests \ 16 | | tr '\n' ' ') 17 | 18 | docker-compose \ 19 | -f $DIR/$DOCKERFILE \ 20 | -f $DIR/docker-compose.env.yml \ 21 | -f $DIR/optional/x-domain-service.yml \ 22 | -f $DIR/optional/replica-service.yml \ 23 | down -v --remove-orphans 24 | 25 | docker-compose \ 26 | -f $DIR/$DOCKERFILE \ 27 | -f $DIR/docker-compose.env.yml \ 28 | -f $DIR/optional/x-domain-service.yml \ 29 | -f $DIR/optional/replica-service.yml \ 30 | up $SERVICES 31 | -------------------------------------------------------------------------------- /up-verifier.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )" 4 | DOCKERFILE='docker-compose.local.yml' 5 | SERVICES="deployer verifier l1_chain batch_submitter geth_l2" 6 | 7 | while (( "$#" )); do 8 | case "$1" in 9 | -l|--local) 10 | DOCKERFILE="docker-compose.local.yml" 11 | shift 1 12 | ;; 13 | -s|--services) 14 | SERVICES="$2" 15 | shift 2 16 | ;; 17 | *) 18 | echo "Unknown argument $1" >&2 19 | shift 20 | ;; 21 | esac 22 | done 23 | 24 | docker-compose \ 25 | -f $DOCKERFILE \ 26 | -f $DIR/docker-compose.env.yml \ 27 | -f optional/verifier-service.yml \ 28 | -f optional/verifier-service.local.yml \ 29 | down -v --remove-orphans 30 | 31 | docker-compose \ 32 | -f $DOCKERFILE \ 33 | -f $DIR/docker-compose.env.yml \ 34 | -f optional/verifier-service.yml \ 35 | -f optional/verifier-service.local.yml \ 36 | up $SERVICES 37 | -------------------------------------------------------------------------------- /up.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Start services without the integration tests 4 | # The `-s` flag takes a string of services to run. 5 | # The `-l` flag will use mounted code. 6 | 7 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )" 8 | SERVICES= 9 | DOCKERFILE="docker-compose.yml" 10 | IS_LOCAL= 11 | 12 | while (( "$#" )); do 13 | case "$1" in 14 | -l|--local) 15 | DOCKERFILE="docker-compose.local.yml" 16 | IS_LOCAL=true 17 | shift 1 18 | ;; 19 | -s|--services) 20 | SERVICES="$2" 21 | shift 2 22 | ;; 23 | *) 24 | echo "Unknown argument $1" >&2 25 | shift 26 | ;; 27 | esac 28 | done 29 | 30 | # If the services haven't been specified, parse 31 | # the docker-compose files for the services. 32 | # Run everything except for the integration tests 33 | if [ -z "$SERVICES" ]; then 34 | SERVICES=$(docker-compose \ 35 | -f $DIR/$DOCKERFILE \ 36 | -f $DIR/docker-compose.env.yml \ 37 | -f $DIR/optional/x-domain-service.yml \ 38 | config --services \ 39 | | grep -v integration_tests \ 40 | | tr '\n' ' ') 41 | fi 42 | 43 | if [ ! -z "$IS_LOCAL" ]; then 44 | git submodule foreach \ 45 | ' 46 | BRANCH=$(git branch --show-current) 47 | COMMIT=$(git rev-parse --short HEAD) 48 | echo "$BRANCH $COMMIT" 49 | ' 50 | fi 51 | 52 | docker-compose \ 53 | -f $DIR/$DOCKERFILE \ 54 | -f $DIR/docker-compose.env.yml \ 55 | -f $DIR/optional/x-domain-service.yml \ 56 | down -v --remove-orphans 57 | 58 | docker-compose \ 59 | -f $DIR/$DOCKERFILE \ 60 | -f $DIR/docker-compose.env.yml \ 61 | -f $DIR/optional/x-domain-service.yml \ 62 | up $SERVICES 63 | --------------------------------------------------------------------------------