Skip to content
This repository has been archived by the owner on Dec 5, 2021. It is now read-only.

Commit

Permalink
next gen integration tests for the OMGX stack (#149)
Browse files Browse the repository at this point in the history
* next gen integration tests for the OMGX stack

* finish first pass integration test outline

* move LP tests to the `message-relayer-fast`

* Update omgx-integration.yml

* add more tests to message-relayer-fast

* connect up the .env variables

* hard code URIs

* Update utils.ts

* Update omgx-integration.yml

* fix - should have been 8080

* Update omgx-integration.yml

* which address to use?

* Update omgx-integration.yml

* removing not needed code

* remove superfluous logging code

* Update utils.ts

* Update utils.ts

* additional comments and formatting improvements

* fix: use older changes on tests (#152)

* fix: use older structure

* correct messenger

* LP fees on the correct side

* correct messenger

* rearrange depl order

Co-authored-by: Souradeep Das <dsouradeep2@gmail.com>
  • Loading branch information
CAPtheorem and souradeep-das committed Jul 2, 2021
1 parent c7ebd2c commit 8367b76
Show file tree
Hide file tree
Showing 45 changed files with 18,561 additions and 10,907 deletions.
98 changes: 32 additions & 66 deletions .github/workflows/omgx-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ jobs:
omgx_integration:
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
TEST_PRIVATE_KEY_1: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
TEST_PRIVATE_KEY_2: "0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba"
TEST_PRIVATE_KEY_3: "0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e"
ADDRESS_MANAGER_ADDRESS: "0x5FbDB2315678afecb367f032d93F642f64180aa3"
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
TEST_PRIVATE_KEY_1: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
TEST_PRIVATE_KEY_2: "0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba"
TEST_PRIVATE_KEY_3: "0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e"
ADDRESS_MANAGER_ADDRESS: "0x5FbDB2315678afecb367f032d93F642f64180aa3"
URL: http://127.0.0.1:8080/addresses.json
OMGX_URL: http://127.0.0.1:8078/addresses.json

steps:
# Monorepo tests
Expand All @@ -40,64 +42,22 @@ jobs:
- name: Install yq
run: sudo snap install yq

- name: Bring the stack up + OMGX
- name: Check the .envs
run: printenv

- name: Build the services, bring the stack up + OMGX services
working-directory: ./ops
env:
BUILD: 1
DAEMON: 1
run: ./up_local.sh

- name: Background logs
# just sets up background logs for the system that was just started
- name: Start background logging
working-directory: ./ops
run: docker-compose -f docker-compose.yml -f docker-compose-omgx-services.yml logs --follow &

# these are the standard optimism integration tests, that are being run in the `integration.yml` anyway
# - name: Run the integration tests
# working-directory: ./ops
# run: docker-compose run integration_tests

# # Examples Tests
# - name: Test & deploy hardhat-example on Ethereum (regression)
# working-directory: ./examples/hardhat
# run: |
# yarn
# yarn deploy
# yarn test:integration

# - name: Test & deploy hardhat-example on Optimistic Ethereum
# working-directory: ./examples/hardhat
# run: |
# yarn deploy:ovm
# yarn test:integration:ovm

# - name: Test & deploy waffle-example on Ethereum (regression)
# working-directory: ./examples/waffle
# run: |
# yarn
# yarn compile
# yarn test:integration

# - name: Test & deploy waffle-example on Optimistic Ethereum
# working-directory: ./examples/waffle
# run: |
# yarn compile:ovm
# yarn test:integration:ovm

# - name: Test & deploy truffle-example on Ethereum (regression)
# working-directory: ./examples/truffle
# run: |
# yarn
# yarn compile
# yarn test:integration
# yarn deploy

# - name: Test & deploy truffle-example on Optimistic Ethereum
# working-directory: ./examples/truffle
# run: |
# yarn compile:ovm
# yarn test:integration:ovm
# yarn deploy:ovm


# this test jitters - in any case, later tests will fail if the OMGX_deployer does not come up
- name: Test serving OMGX contracts
working-directory: ./
run: |
Expand All @@ -121,20 +81,26 @@ jobs:
exit 1
fi
- name: Function test the OMGX contracts
- name: Test the base OMGX contracts
working-directory: ./packages/omgx/contracts
run: |
yarn test:integration
# This test duplicates the standard test in the optimism `integration.yml`
# - name: Test l1-l2-deposit-withdrawal example on Optimistic Ethereum with cross-domain message passing
# working-directory: ./examples/l1-l2-deposit-withdrawal
# run: |
# yarn
# yarn compile
# yarn compile:ovm
# yarn test:integration:ovm
# ToDo
# - name: Test the base OMGX contracts
# working-directory: ./ops
# run: docker-compose -f docker-compose.yml -f docker-compose-omgx-services.yml run omgx_test_contracts

- name: Test the message-relayer-fast
working-directory: ./packages/omgx/message-relayer-fast
run: |
yarn test:integration
# ToDo
# - name: Test the message-relayer-fast
# working-directory: ./ops
# run: docker-compose -f docker-compose.yml -f docker-compose-omgx-services.yml run omgx_test_relayer

# - name: List all built images
# if: failure()
# run: docker images
Expand Down
57 changes: 0 additions & 57 deletions .github/workflows/omgx-sync-tests.yml

This file was deleted.

20 changes: 16 additions & 4 deletions README_OMGX.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ $ cd ops
$ BUILD=1 DAEMON=0 ./up_local.sh
```

<!-- Normally, after you have built the docker images once, all you have to do is to run:
```bash
$ BUILD=0 DAEMON=0 ./up_local.sh
```
and your computer will use the docker images you built earlier. -->

Note: _Running out of space on your Docker, or having other having hard to debug issues_? Try running `docker system prune -a --volumes` and then rebuild the images.

## Starting a local basic Optimism L1/L2

You can change the BUILD and DAEMON values to control if everything is rebuilt (`BUILD=1`, very slow), and if you want to see all the debug information (`DAEMON=0`)
Expand Down Expand Up @@ -144,19 +154,21 @@ yarn test:integration

## Front End Development

Start a local L1/L2. You can change the BUILD and DAEMON values to control if everything is rebuilt (`BUILD=1`, very slow), and if you want to see all the debug information (`DAEMON=0`)
Start a local L1/L2.

<!-- You can change the BUILD and DAEMON values to control if everything is rebuilt (`BUILD=1`, very slow), and if you want to see all the debug information (`DAEMON=0`) -->

```
$ cd ops
$ BUILD=1 DAEMON=1 ./up_local.sh
$ BUILD=1 DAEMON=0 ./up_local.sh
```

Typically, you will only have to build everything once, and after that, you can save time by setting `BUILD` to `0`:
<!-- Typically, you will only have to build everything once, and after that, you can save time by setting `BUILD` to `0`:
```
$ cd ops
$ BUILD=0 DAEMON=1 ./up_local.sh
```
``` -->

Then, open a second terminal window and navigate to `packages/omgx/wallet-frontend`, and run
```
Expand Down
3 changes: 3 additions & 0 deletions omgx_utilities/contracts-analyzer/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
...require('../../.prettierrc.js'),
};
3 changes: 3 additions & 0 deletions omgx_utilities/fraud-prover/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
...require('../../.prettierrc.js'),
};
1 change: 0 additions & 1 deletion omgx_utilities/fraud-prover/.prettierrc.json

This file was deleted.

37 changes: 31 additions & 6 deletions ops/docker-compose-omgx-services.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "3"

services:

# base service builder

omgx_builder:
Expand All @@ -10,7 +10,7 @@ services:
context: ..
dockerfile: ./ops/docker/Dockerfile.omgx_monorepo

# deploys OMGX contracts and serves contract addresses
# deploys OMGX contracts and serves contract addresses

omgx_deployer:
depends_on:
Expand All @@ -22,8 +22,8 @@ services:
context: ..
dockerfile: ./ops/docker/Dockerfile.omgx_deployer
environment:
TEST: 1 #controls whther the test ERC20 is deployed, too
NO_COMPILE: 0 #sorry for the flipped logic. NO_COMPILE 0 probably means `please compile`
TEST: 1 #controls whether the test ERC20 is deployed, too
NO_COMPILE: 0 #sorry for the flipped logic. NO_COMPILE: 0 means `please compile`
L1_NODE_WEB3_URL: http://l1_chain:8545
L2_NODE_WEB3_URL: http://l2geth:8545
URL: http://deployer:8081/addresses.json
Expand Down Expand Up @@ -77,12 +77,12 @@ services:
OMGX_URL: http://omgx_deployer:8079/addresses.json
POLLING_INTERVAL: 1500
GET_LOGS_INTERVAL: 500
WHITELIST_ENDPOINT: http://bl-wl:9000/whitelist.json
WHITELIST_ENDPOINT: http://omgx_bl-wl:9000/whitelist.json
RETRIES: 70

# and, tests for all the OMGX-specific services

omgx_integration_tests:
omgx_test_contracts:
image: omgx/omgx_builder
deploy:
replicas: 0
Expand All @@ -100,3 +100,28 @@ services:
L2_NODE_WEB3_URL: http://l2geth:8545
URL: http://deployer:8081/addresses.json
OMGX_URL: http://omgx_deployer:8079/addresses.json
TEST_PRIVATE_KEY_1: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
TEST_PRIVATE_KEY_2: "0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba"
TEST_PRIVATE_KEY_3: "0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e"

omgx_test_relayer:
image: omgx/omgx_builder
deploy:
replicas: 0
build:
context: ..
dockerfile: ./ops/docker/Dockerfile.omgx_monorepo
entrypoint:
- "/bin/sh"
- -ecx
- |
cd /optimism/packages/omgx/message-relayer-fast
yarn test:integration
environment:
L1_NODE_WEB3_URL: http://l1_chain:8545
L2_NODE_WEB3_URL: http://l2geth:8545
URL: http://deployer:8081/addresses.json
OMGX_URL: http://omgx_deployer:8079/addresses.json
TEST_PRIVATE_KEY_1: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
TEST_PRIVATE_KEY_2: "0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba"
TEST_PRIVATE_KEY_3: "0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e"
1 change: 1 addition & 0 deletions ops/docker/Dockerfile.omgx_bl-wl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ RUN apk add --no-cache git curl python bash jq
WORKDIR /opt/optimism/packages/omgx/bl-wl

COPY packages/omgx/bl-wl/bin ./bin
COPY packages/omgx/bl-wl/dist ./dist
COPY packages/omgx/bl-wl/scripts ./scripts
COPY packages/omgx/bl-wl/lambda ./lambda

Expand Down
5 changes: 5 additions & 0 deletions ops/docker/Dockerfile.omgx_monorepo
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ FROM ethereumoptimism/builder:latest

WORKDIR /optimism
COPY packages/omgx/contracts/package.json ./packages/omgx/contracts/package.json
COPY packages/omgx/message-relayer-fast/package.json ./packages/omgx/message-relayer-fast/package.json
COPY ./packages/omgx ./packages/omgx

COPY ./patches ./patches

RUN yarn

WORKDIR /optimism/packages/omgx/message-relayer-fast
RUN yarn build

WORKDIR /optimism/packages/omgx/contracts
RUN yarn build

Expand Down
8 changes: 6 additions & 2 deletions ops/up_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ if ! [ -x "$(command -v yq)" ]; then
exit 1
fi

#Set conservative defaults
#BUILD=${BUILD:-1} #build unless override
#DAEMON=${DAEMON:-0} #run win foreground unless overrride

if [[ $BUILD == 1 ]]; then
echo 'You set BUILD to 1, which means that all your dockers will be built'
echo 'You set BUILD to 1, which means that all your dockers will be (re)built'
fi

if [[ $BUILD == 0 ]]; then
echo 'You set BUILD to 0, which means that you want to use existing Dcoker images'
echo 'You set BUILD to 0, which means that you want to use existing Docker images'
fi

if [[ $DAEMON == 1 ]]; then
Expand Down
Empty file.
Empty file.
Loading

0 comments on commit 8367b76

Please sign in to comment.