Add instructions to run smoke tests

This commit is contained in:
Prathamesh Musale 2023-08-08 16:52:51 +05:30
parent 78d482c7a0
commit 4992554c9a
9 changed files with 198 additions and 12 deletions

View File

@ -59,6 +59,7 @@ services:
command: ["node", "--enable-source-maps", "dist/job-runner.js"]
volumes:
- ../config/watcher-sushiswap/sushi-watcher.toml:/app/packages/uni-watcher/environments/local.toml
- ../config/watcher-sushiswap/sushi-watcher-test.toml:/app/packages/uni-watcher/environments/test.toml
ports:
- "0.0.0.0:9004:9000"
healthcheck:
@ -78,12 +79,15 @@ services:
sushi-watcher-job-runner:
condition: service_healthy
image: cerc/watcher-sushiswap:local
env_file:
- ../config/watcher-sushiswap/lotus-params.env
environment:
- DEBUG=vulcanize:*
working_dir: /app/packages/uni-watcher
command: ["node", "--enable-source-maps", "dist/server.js"]
volumes:
- ../config/watcher-sushiswap/sushi-watcher.toml:/app/packages/uni-watcher/environments/local.toml
- ../config/watcher-sushiswap/sushi-watcher-test.toml:/app/packages/uni-watcher/environments/test.toml
ports:
- "0.0.0.0:3003:3003"
- "0.0.0.0:9005:9001"
@ -112,6 +116,7 @@ services:
command: ["node", "--enable-source-maps", "dist/job-runner.js"]
volumes:
- ../config/watcher-sushiswap/sushi-info-watcher.toml:/app/packages/uni-info-watcher/environments/local.toml
- ../config/watcher-sushiswap/sushi-info-watcher-test.toml:/app/packages/uni-info-watcher/environments/test.toml
ports:
- "0.0.0.0:9006:9002"
healthcheck:
@ -135,10 +140,13 @@ services:
sushi-info-watcher-job-runner:
condition: service_healthy
image: cerc/watcher-sushiswap:local
env_file:
- ../config/watcher-sushiswap/lotus-params.env
working_dir: /app/packages/uni-info-watcher
command: ["node", "--enable-source-maps", "dist/server.js"]
volumes:
- ../config/watcher-sushiswap/sushi-info-watcher.toml:/app/packages/uni-info-watcher/environments/local.toml
- ../config/watcher-sushiswap/sushi-info-watcher-test.toml:/app/packages/uni-info-watcher/environments/test.toml
ports:
- "0.0.0.0:3004:3004"
- "0.0.0.0:9007:9003"
@ -163,13 +171,13 @@ services:
sushiswap-v3-core:
image: cerc/sushiswap-v3-core:local
env_file:
- ../config/watcher-sushiswap/contract-deployment.env
- ../config/watcher-sushiswap/lotus-params.env
# Deploys the periphery (NFPM, token, etc.) contracts
sushiswap-v3-periphery:
image: cerc/sushiswap-v3-periphery:local
env_file:
- ../config/watcher-sushiswap/contract-deployment.env
- ../config/watcher-sushiswap/lotus-params.env
volumes:
uniswap_watcher_db_data:

View File

@ -21,11 +21,10 @@
logging = false
maxQueryExecutionTime = 100
# TODO: Update to use rpc-eth-client
[upstream]
[upstream.ethServer]
gqlApiEndpoint = "http://ipld-eth-server.example.com:8083/graphql"
rpcProviderEndpoint = "http://ipld-eth-server.example.com:8082"
rpcProviderEndpoint = "http://lotus-node-1:1234/rpc/v1"
rpcClient = true
[upstream.cache]
name = "requests"

View File

@ -1,3 +1,6 @@
# Lotus node config
ETH_RPC_ENDPOINT="http://lotus-node-1:1234/rpc/v1"
CHAIN_ID=31415926
# From app/data/config/fixturenet-lotus/fund-account.sh
ACCOUNT_PRIVATE_KEY="0xc05fd3613bcd62a4f25e5eba1f464d0b76d74c3f771a7c2f13e26ad6439444b3"

View File

@ -0,0 +1,45 @@
[server]
host = "0.0.0.0"
port = 3004
# Use mode demo when running watcher locally.
# Mode demo whitelists all tokens so that entity values get updated.
mode = "demo"
[database]
type = "postgres"
host = "sushiswap-watcher-db"
port = 5432
database = "sushi-info-watcher"
username = "vdbm"
password = "password"
synchronize = true
logging = false
maxQueryExecutionTime = 100
[upstream]
[upstream.ethServer]
rpcProviderEndpoint = "http://lotus-node-1:1234/rpc/v1"
rpcClient = true
[upstream.cache]
name = "requests"
enabled = false
deleteOnStart = false
[upstream.uniWatcher]
gqlEndpoint = "http://sushi-watcher-server:3003/graphql"
gqlSubscriptionEndpoint = "ws://sushi-watcher-server:3003/graphql"
[upstream.tokenWatcher]
gqlEndpoint = "http://erc20-watcher-server:3001/graphql"
gqlSubscriptionEndpoint = "ws://erc20-watcher-server:3001/graphql"
[jobQueue]
dbConnectionString = "postgres://vdbm:password@sushiswap-watcher-db:5432/sushi-info-watcher-job-queue"
maxCompletionLagInSecs = 300
jobDelayInMilliSecs = 1000
eventsInBatch = 50
subgraphEventsOrder = true
blockDelayInMilliSecs = 2000
prefetchBlocksInMem = true
prefetchBlockCount = 10

View File

@ -61,11 +61,10 @@
# maximum number of clients the pool should contain
max = 20
# TODO: Update to use rpc-eth-client
[upstream]
[upstream.ethServer]
gqlApiEndpoint = "http://ipld-eth-server.example.com:8083/graphql"
rpcProviderEndpoint = "http://ipld-eth-server.example.com:8082"
rpcProviderEndpoint = "http://lotus-node-1:1234/rpc/v1"
rpcClient = true
[upstream.cache]
name = "requests"

View File

@ -0,0 +1,34 @@
[server]
host = "0.0.0.0"
port = 3003
[database]
type = "postgres"
host = "sushiswap-watcher-db"
port = 5432
database = "sushi-watcher"
username = "vdbm"
password = "password"
synchronize = true
logging = false
maxQueryExecutionTime = 100
[upstream]
[upstream.ethServer]
rpcProviderEndpoint = "http://lotus-node-1:1234/rpc/v1"
rpcClient = true
[upstream.cache]
name = "requests"
enabled = false
deleteOnStart = false
[jobQueue]
dbConnectionString = "postgres://vdbm:password@sushiswap-watcher-db:5432/sushi-watcher-job-queue"
maxCompletionLagInSecs = 300
jobDelayInMilliSecs = 0
eventsInBatch = 50
lazyUpdateBlockProgress = true
blockDelayInMilliSecs = 2000
prefetchBlocksInMem = false
prefetchBlockCount = 10

View File

@ -20,11 +20,10 @@
logging = false
maxQueryExecutionTime = 100
# TODO: Update to use rpc-eth-client
[upstream]
[upstream.ethServer]
gqlApiEndpoint = "http://ipld-eth-server.example.com:8083/graphql"
rpcProviderEndpoint = "http://ipld-eth-server.example.com:8082"
rpcProviderEndpoint = "http://lotus-node-1:1234/rpc/v1"
rpcClient = true
[upstream.cache]
name = "requests"

View File

@ -21,5 +21,27 @@ laconic-so --stack sushiswap build-containers
Deploy the stack:
```bash
laconic-so --stack sushiswap deploy --cluster lotus up
laconic-so --stack sushiswap deploy --cluster sushiswap up
```
## Tests
Follow [smoke-tests.md](./smoke-tests.md) to run smoke tests
## Clean up
Stop all the services running in background run:
```bash
laconic-so --stack sushiswap deploy --cluster sushiswap down
```
Clear volumes created by this stack:
```bash
# List all relevant volumes
docker volume ls -q --filter "name=sushiswap"
# Remove all the listed volumes
docker volume rm $(docker volume ls -q --filter "name=sushiswap")
```

View File

@ -0,0 +1,77 @@
# SushiSwap Watcher Smoke Tests
## sushi-watcher
Deploy required contracts and set the addresses to variables:
```bash
# Deploy UniswapV3Factory
docker exec -it sushiswap-sushiswap-v3-core-1 pnpm hardhat --network docker deploy --tags UniswapV3Factory
# Set the returned address to a variable
export FACTORY_ADDRESS=<FACTORY_ADDRESS>
# Deploy TestUniswapV3Callee
docker exec -it sushiswap-sushiswap-v3-core-1 pnpm hardhat --network docker deploy --tags TestUniswapV3Callee
# Set the returned address to a variable
export UNISWAP_CALLEE_ADDRESS=<UNISWAP_CALLEE_ADDRESS>
# Deploy NFPM contract
docker exec -it sushiswap-sushiswap-v3-periphery-1 bash -c "export FACTORY_ADDRESS=$FACTORY_ADDRESS && yarn hardhat --network docker deploy --tags NonfungiblePositionManager"
# Set the returned address to a variable
export POSITION_MANAGER_ADDRESS=<POSITION_MANAGER_ADDRESS>
# Deploy two test tokens
docker exec -it sushiswap-sushiswap-v3-periphery-1 yarn hardhat --network docker deploy --tags TestERC20
docker exec -it sushiswap-sushiswap-v3-periphery-1 yarn hardhat --network docker deploy --tags TestERC20
# Set the returned addresses to variables
export TOKEN0_ADDRESS=<TOKEN0_ADDRESS>
export TOKEN1_ADDRESS=<TOKEN1_ADDRESS>
```
Watch the contracts:
```bash
# Watch factory contract
docker exec -it sushiswap-sushiswap-watcher-server-1 bash -c "yarn watch:contract --address $FACTORY_ADDRESS --kind factory --startingBlock 100 --checkpoint false"
docker exec -it sushiswap-sushiswap-info-watcher-server-1 bash -c "yarn watch:contract --address $FACTORY_ADDRESS --kind factory --startingBlock 100 --checkpoint false"
# Watch NFPM contract
docker exec -it sushiswap-sushiswap-watcher-server-1 bash -c "yarn watch:contract --address $POSITION_MANAGER_ADDRESS --kind nfpm --startingBlock 100 --checkpoint false"
docker exec -it sushiswap-sushiswap-info-watcher-server-1 bash -c "yarn watch:contract --address $POSITION_MANAGER_ADDRESS --kind nfpm --startingBlock 100 --checkpoint false"
```
Run the smoke test:
```bash
docker exec -it sushiswap-sushiswap-watcher-server-1 bash -c "export TOKEN0_ADDRESS=$TOKEN0_ADDRESS && export TOKEN1_ADDRESS=$TOKEN1_ADDRESS && export UNISWAP_CALLEE_ADDRESS=$UNISWAP_CALLEE_ADDRESS && yarn smoke-test"
```
## sushi-info-watcher
Deploy required contracts and set the addresses to variables:
```bash
# Deploy TestUniswapV3Callee
docker exec -it sushiswap-sushiswap-v3-core-1 pnpm hardhat --network docker deploy --tags TestUniswapV3Callee
# Set the returned address to a variable
export UNISWAP_CALLEE_ADDRESS=<UNISWAP_CALLEE_ADDRESS>
# Deploy two test tokens
docker exec -it sushiswap-sushiswap-v3-periphery-1 yarn hardhat --network docker deploy --tags TestERC20
docker exec -it sushiswap-sushiswap-v3-periphery-1 yarn hardhat --network docker deploy --tags TestERC20
# Set the returned addresses to variables
export TOKEN0_ADDRESS=<TOKEN0_ADDRESS>
export TOKEN1_ADDRESS=<TOKEN1_ADDRESS>
```
Run the smoke test:
```bash
docker exec -it sushiswap-sushiswap-info-watcher-server-1 bash -c "export TOKEN0_ADDRESS=$TOKEN0_ADDRESS && export TOKEN1_ADDRESS=$TOKEN1_ADDRESS && export UNISWAP_CALLEE_ADDRESS=$UNISWAP_CALLEE_ADDRESS && yarn smoke-test"
```