Skip to content

Commit

Permalink
Update instructions in the mobymask-v2 stack (#438)
Browse files Browse the repository at this point in the history
  • Loading branch information
prathamesh0 authored Jun 26, 2023
1 parent c465153 commit 3e7037e
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 40 deletions.
2 changes: 1 addition & 1 deletion app/data/config/watcher-mobymask-v2/mobymask-params.env
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ DEFAULT_CERC_RELAY_PEERS=[]
DEFAULT_CERC_RELAY_ANNOUNCE_DOMAIN=

# Base URI for mobymask-app (used for generating invite)
DEFAULT_CERC_MOBYMASK_APP_BASE_URI="http://127.0.0.1:3002/#"
DEFAULT_CERC_MOBYMASK_APP_BASE_URI="http://127.0.0.1:3004/#"

# Set to false for disabling watcher peer to send txs to L2
DEFAULT_CERC_ENABLE_PEER_L2_TXS=true
Expand Down
4 changes: 1 addition & 3 deletions app/data/stacks/fixturenet-optimism/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,11 @@ Deploy the stack:
laconic-so --stack fixturenet-optimism deploy up
```

If you get the error `service "fixturenet-optimism-contracts" didn't complete successfully: exit 1` with ~25 lines of Traceback, wait 15-20 mins then re-run the command.

The `fixturenet-optimism-contracts` service takes a while to complete running as it:
1. waits for the 'Merge' to happen on L1
2. waits for a finalized block to exist on L1 (so that it can be taken as a starting block for roll ups)
3. deploys the L1 contracts
It may restart a few times after running into errors.

To list and monitor the running containers:

Expand Down Expand Up @@ -115,6 +114,5 @@ docker volume rm $(docker volume ls -q --filter "name=.*l1_deployment|.*l2_accou

## Known Issues

* `fixturenet-eth` currently starts fresh on a restart
* Resource requirements (memory + time) for building the `cerc/foundry` image are on the higher side
* `cerc/optimism-contracts` image is currently based on `cerc/foundry` (Optimism requires foundry installation)
25 changes: 15 additions & 10 deletions app/data/stacks/mobymask-v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,21 @@ Deploy the stack:
* Deploy the containers:

```bash
laconic-so --stack mobymask-v2 deploy-system up
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 up
```

* List and check the health status of all the containers using `docker ps` and wait for them to be `healthy`
NOTE: The `fixturenet-optimism-contracts` service takes a while to run to completion and it may restart a few times after running into errors.

NOTE: The `mobymask-app` container might not start; if the app is not running at http://localhost:3002, restart the container using it's id:
* To list down and monitor the running containers:

```bash
docker ps -a | grep "mobymask-app"
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 ps
docker restart <CONTAINER_ID>
# With status
docker ps -a
# Check logs for a container
docker logs -f <CONTAINER_ID>
```

## Tests
Expand All @@ -68,11 +72,12 @@ docker ps | grep -E 'mobymask-app|peer-test-app'
### mobymask-app
The mobymask-app should be running at http://localhost:3002
* The mobymask-app should be running at http://localhost:3002
* The lxdao-mobymask-app should be running at http://localhost:3004
### peer-test-app
The peer-test-app should be running at http://localhost:3003
* The peer-test-app should be running at http://localhost:3003
## Details
Expand All @@ -91,15 +96,15 @@ Follow the [demo](./demo.md) to try out the MobyMask app with L2 chain
Stop all the services running in background run:
```bash
laconic-so --stack mobymask-v2 deploy-system down 30
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 down 30
```
Clear volumes created by this stack:
```bash
# List all relevant volumes
docker volume ls -q --filter "name=.*mobymask_watcher_db_data|.*peers_ids|.*mobymask_deployment|.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data"
docker volume ls -q --filter "name=mobymask_v2"
# Remove all the listed volumes
docker volume rm $(docker volume ls -q --filter "name=.*mobymask_watcher_db_data|.*peers_ids|.*mobymask_deployment|.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data")
docker volume rm $(docker volume ls -q --filter "name=mobymask_v2")
```
21 changes: 10 additions & 11 deletions app/data/stacks/mobymask-v2/demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@
The invite link is seen at the end of the logs. Example log:

```bash
laconic-bfb01caf98b1b8f7c8db4d33f11b905a-mobymask-1 | http://127.0.0.1:3002/#/members?invitation=%7B%22v%22%3A1%2C%22signedDelegations%22%3A%5B%7B%22signature%22%3A%220x7559bd412f02677d60820e38243acf61547f79339395a34f7d4e1630e645aeb30535fc219f79b6fbd3af0ce3bd05132ad46d2b274a9fbc4c36bc71edd09850891b%22%2C%22delegation%22%3A%7B%22delegate%22%3A%220xc0838c92B2b71756E0eAD5B3C1e1F186baeEAAac%22%2C%22authority%22%3A%220x0000000000000000000000000000000000000000000000000000000000000000%22%2C%22caveats%22%3A%5B%7B%22enforcer%22%3A%220x558024C7d593B840E1BfD83E9B287a5CDad4db15%22%2C%22terms%22%3A%220x0000000000000000000000000000000000000000000000000000000000000000%22%7D%5D%7D%7D%5D%2C%22key%22%3A%220x98da9805821f1802196443e578fd32af567bababa0a249c07c82df01ecaa7d8d%22%7D
http://127.0.0.1:3004/#/members?invitation=%7B%22v%22%3A1%2C%22signedDelegations%22%3A%5B%7B%22signature%22%3A%220x7559bd412f02677d60820e38243acf61547f79339395a34f7d4e1630e645aeb30535fc219f79b6fbd3af0ce3bd05132ad46d2b274a9fbc4c36bc71edd09850891b%22%2C%22delegation%22%3A%7B%22delegate%22%3A%220xc0838c92B2b71756E0eAD5B3C1e1F186baeEAAac%22%2C%22authority%22%3A%220x0000000000000000000000000000000000000000000000000000000000000000%22%2C%22caveats%22%3A%5B%7B%22enforcer%22%3A%220x558024C7d593B840E1BfD83E9B287a5CDad4db15%22%2C%22terms%22%3A%220x0000000000000000000000000000000000000000000000000000000000000000%22%7D%5D%7D%7D%5D%2C%22key%22%3A%220x98da9805821f1802196443e578fd32af567bababa0a249c07c82df01ecaa7d8d%22%7D
```

* Open the invite link in a browser to use the mobymask-app.

NOTE: Before opening the invite link, clear the browser cache (local storage) for http://127.0.0.1:3002 to remove old invitations
NOTE: Before opening the invite link, clear the browser cache (local storage) for http://127.0.0.1:3004 to remove old invitations

* In the debug panel, check if it is connected to the p2p network (it should be connected to at least one other peer for pubsub to work).

* Create an invite link in the app by clicking on `Create new invite link` button.
* Create an invite link in the app by clicking on `Create new invite link` button in the `My invitees` section.

* Switch to the `MESSAGES` tab in debug panel for viewing incoming messages later.

* Open the invite link in a new browser with different profile (to simulate remote browser)
* Check that it is connected to any other peer in the network.
* Check that it is connected to a peer in the network.

* In `Report a phishing attempt` section, report multiple phishers using the `Submit` button. Click on the `Submit batch to p2p network` button. This broadcasts signed invocations to the connected peers.
* In the `Pending reports` section, enter multiple phisher records and click on the `Submit batch to p2p network` button. This broadcasts signed invocations to the connected peers.

* In the `MESSAGES` tab of other browsers, a message can be seen with the signed invocations.

Expand Down Expand Up @@ -66,7 +66,7 @@
* Get the deployed contract address:

```bash
docker exec -it $(docker ps -aq --filter name="mobymask-app") cat /config/config.yml
docker exec -it $(docker ps -aq --filter name="lxdao-mobymask-app") cat /config/config.yml
```

The value of `address` field is the deployed contract address
Expand All @@ -91,15 +91,14 @@
* Watcher internally is using L2 chain `eth_getStorageAt` method.

* Check the phisher name in mobymask app in `Check Phisher Status` section.
* Watcher GQL API is used for checking phisher.
* Watcher GQL API is used for checking phisher.

* Manage the invitations by clicking on the `Outstanding Invitations in p2p network`.

* Revoke the created invitation by clicking on `Revoke (p2p network)`
* Manage invitations in the `Outstanding invitations (p2p network)` tab in `My Invitations` section.
* Revoke the created invitation by clicking on the `Revoke` button.

* Revocation messages can be seen in the debug panel `MESSAGES` tab of other browsers.

* Check the watcher peer logs. It should receive a message and log the transaction receipt for a `revoke` message.
* Also, check the watcher peer logs. It should receive a message and log the transaction receipt for a `revoke` message.

* Try reporting a phisher from the revoked invitee's browser.
Expand Down
14 changes: 7 additions & 7 deletions app/data/stacks/mobymask-v2/mobymask-only.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Create and update an env file to be used in the next step ([defaults](../../conf

# Base URI for mobymask-app
# (used for generating a root invite link after deploying the contract)
CERC_MOBYMASK_APP_BASE_URI="http://127.0.0.1:3002/#"
CERC_MOBYMASK_APP_BASE_URI="http://127.0.0.1:3004/#"

# (Optional) Domain to be used in the relay node's announce address
CERC_RELAY_ANNOUNCE_DOMAIN=
Expand All @@ -72,16 +72,16 @@ Create and update an env file to be used in the next step ([defaults](../../conf
### Deploy the stack

```bash
laconic-so --stack mobymask-v2 deploy --include watcher-mobymask-v2 --env-file <PATH_TO_ENV_FILE> up
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 --include watcher-mobymask-v2 --env-file <PATH_TO_ENV_FILE> up
```

To list down and monitor the running containers:

```bash
laconic-so --stack mobymask-v2 deploy --include watcher-mobymask-v2 ps
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 --include watcher-mobymask-v2 ps
# With status
docker ps
docker ps -a
# Check logs for a container
docker logs -f <CONTAINER_ID>
Expand All @@ -108,15 +108,15 @@ For deploying the web-app(s) separately after deploying the watcher, follow [web
Stop all services running in the background:
```bash
laconic-so --stack mobymask-v2 deploy --include watcher-mobymask-v2 down
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 --include watcher-mobymask-v2 down
```
Clear volumes created by this stack:
```bash
# List all relevant volumes
docker volume ls -q --filter "name=.*mobymask_watcher_db_data|.*peers_ids|.*mobymask_deployment"
docker volume ls -q --filter "name=mobymask_v2"
# Remove all the listed volumes
docker volume rm $(docker volume ls -q --filter "name=.*mobymask_watcher_db_data|.*peers_ids|.*mobymask_deployment")
docker volume rm $(docker volume ls -q --filter "name=mobymask_v2")
```
17 changes: 9 additions & 8 deletions app/data/stacks/mobymask-v2/web-apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,25 @@ Create and update an env file to be used in the next step ([defaults](../../conf

For running mobymask-app
```bash
laconic-so --stack mobymask-v2 deploy --include mobymask-app --env-file <PATH_TO_ENV_FILE> up
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 --include mobymask-app --env-file <PATH_TO_ENV_FILE> up
# Runs mobymask-app on host port 3002 and lxdao-mobymask-app on host port 3004
```

For running peer-test-app
```bash
laconic-so --stack mobymask-v2 deploy --include peer-test-app --env-file <PATH_TO_ENV_FILE> up
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 --include peer-test-app --env-file <PATH_TO_ENV_FILE> up
# Runs on host port 3003
```

To list down and monitor the running containers:

```bash
laconic-so --stack mobymask-v2 deploy --include [mobymask-app | peer-test-app] ps
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 --include [mobymask-app | peer-test-app] ps
docker ps
# With status
docker ps -a
# Check logs for a container
docker logs -f <CONTAINER_ID>
Expand All @@ -80,20 +81,20 @@ Stop all services running in the background:

For mobymask-app
```bash
laconic-so --stack mobymask-v2 deploy --include mobymask-app down
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 --include mobymask-app down
```

For peer-test-app
```bash
laconic-so --stack mobymask-v2 deploy --include peer-test-app down
laconic-so --stack mobymask-v2 deploy --cluster mobymask_v2 --include peer-test-app down
```

Clear volumes created by this stack:

```bash
# List all relevant volumes
docker volume ls -q --filter "name=.*mobymask_deployment|.*peers_ids"
docker volume ls -q --filter "name=mobymask_v2"
# Remove all the listed volumes
docker volume rm $(docker volume ls -q --filter "name=.*mobymask_deployment|.*peers_ids")
docker volume rm $(docker volume ls -q --filter "name=mobymask_v2")
```

0 comments on commit 3e7037e

Please sign in to comment.