Add ability to run Optimism fixturenet with external L1 endpoint (#273)

* Remove unnecessary todos

* Set option to log commands in shell scripts

* Replace fixturenet-eth dependency with wait on endpoint

* Skip lighthouse node dependency check

* Update all services in the stack

* Use debug flag to enable shell commands logging

* Add bash in op-batcher container

* Update mobymask-v2 instructions

* Update fixturenet-optimism instructions

* Add descriptions for services

* Move ts files to container-build

* Take L1 RPC endpoint from the env file

* Add dev mode restriction for editing env file

Former-commit-id: 2515878eeb
This commit is contained in:
prathamesh0
2023-04-04 14:53:28 +05:30
committed by GitHub
parent 287468b7c0
commit be08ee81ea
19 changed files with 349 additions and 99 deletions
+23 -18
View File
@@ -31,6 +31,10 @@ git checkout laconic
# MobyMask
cd ~/cerc/MobyMask
git checkout v0.1.1
# Optimism
cd ~/cerc/optimism
git checkout @eth-optimism/sdk@0.0.0-20230329025055
```
Build the container images:
@@ -43,29 +47,33 @@ This should create the required docker images in the local image registry.
Deploy the stack:
* Deploy the containers
* Deploy the containers:
```bash
laconic-so --stack mobymask-v2 deploy-system up
```
* Check that all containers are healthy using `docker ps`
* List and check the health status of all the containers using `docker ps` and wait for them to be `healthy`
NOTE: The `mobymask-ui` container might not start. If mobymask-app is not running at http://localhost:3002, run command again to start the container
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:
```bash
laconic-so --stack mobymask-v2 deploy-system up
docker ps -a | grep "mobymask-app"
docker restart <CONTAINER_ID>
```
## Tests
Find the watcher container's id:
Find the watcher container's id and export it for later use:
```bash
laconic-so --stack mobymask-v2 deploy-system ps | grep "mobymask-watcher-server"
export CONTAINER_ID=<CONTAINER_ID>
```
Example output
Example output:
```
id: 5d3aae4b22039fcd1c9b18feeb91318ede1100581e75bb5ac54f9e436066b02c, name: laconic-bfb01caf98b1b8f7c8db4d33f11b905a-mobymask-watcher-server-1, ports: 0.0.0.0:3001->3001/tcp, 0.0.0.0:9001->9001/tcp, 0.0.0.0:9090->9090/tcp
@@ -73,12 +81,6 @@ id: 5d3aae4b22039fcd1c9b18feeb91318ede1100581e75bb5ac54f9e436066b02c, name: laco
In above output the container ID is `5d3aae4b22039fcd1c9b18feeb91318ede1100581e75bb5ac54f9e436066b02c`
Export it for later use:
```bash
export CONTAINER_ID=<CONTAINER_ID>
```
Run the peer tests:
```bash
@@ -87,7 +89,11 @@ docker exec -w /app/packages/peer $CONTAINER_ID yarn test
## Web Apps
Check that the status for web-app containers are healthy by using `docker ps`
Check that the web-app containers are healthy:
```bash
docker ps | grep -E 'mobymask-app|peer-test-app'
```
### mobymask-app
@@ -119,15 +125,14 @@ laconic-so --stack mobymask-v2 deploy-system down
Clear volumes:
* List all volumes
* List all relevant volumes:
```bash
docker volume ls
docker volume ls -q --filter name=laconic*
```
* Remove volumes created by this stack
* Remove all the listed volumes:
Example:
```bash
docker volume rm laconic-bfb01caf98b1b8f7c8db4d33f11b905a_moby_data_server
docker volume rm $(docker volume ls -q --filter name=laconic*)
```
+18 -18
View File
@@ -1,22 +1,22 @@
# Demo
* Get the root invite link URL for mobymask-app
* Get the root invite link URL for mobymask-app:
```
```bash
laconic-so --stack mobymask-v2 deploy-system logs mobymask
```
The invite link is seen at the end of the logs
Example:
```
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
```
* Open the invite link in browser to use the mobymask-app.
* 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
* In the debug panel, check if it is connected to the p2p network (It should be connected to atleast one other peer for pubsub to work).
* 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.
@@ -31,24 +31,24 @@
* In a terminal check logs from the watcher peer container.
* Get the container id
* Get the container id:
```bash
laconic-so --stack mobymask-v2 deploy-system ps | grep mobymask-watcher-server
```
* Check logs
* Check logs:
```bash
docker logs -f CONTAINER_ID
docker logs -f <CONTAINER_ID>
```
* It should have received the message, sent transaction to L2 chain and received a transaction receipt with block details.
* It should have received the message, sent transaction to L2 chain and received a transaction receipt for an `invoke` message with block details.
Example log:
```
2023-03-23T10:25:19.771Z vulcanize:peer-listener [10:25:19] Received a message on mobymask P2P network from peer: PeerId(12D3KooWAVNswtcrX12iDYukEoxdQwD34kJyRWcQTfZ4unGg2xjd)
```bash
2023-03-23T10:25:19.771Z vulcanize:peer-listener [10:25:19] Received a message on mobymask P2P network from peer: 12D3KooWAVNswtcrX12iDYukEoxdQwD34kJyRWcQTfZ4unGg2xjd
2023-03-23T10:25:24.143Z laconic:libp2p-utils Transaction receipt for invoke message {
to: '0x558024C7d593B840E1BfD83E9B287a5CDad4db15',
blockNumber: 1996,
@@ -60,7 +60,7 @@
```
* Check the phisher in watcher GQL: http://localhost:3001/graphql
* Use the blockHash from transaction receipt details or query for latest block
* Use the blockHash from transaction receipt details or query for latest block:
```gql
query {
@@ -71,7 +71,7 @@
}
```
* Get the deployed contract address
* Get the deployed contract address:
```bash
laconic-so --stack mobymask-v2 deploy-system exec mobymask-app "cat src/config.json"
@@ -94,7 +94,7 @@
}
```
It should return true for reported phisher names.
It should return `true` for reported phisher names.
* Watcher internally is using L2 chain `eth_getStorageAt` method.
@@ -107,7 +107,7 @@
* 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 revoke message.
* 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.
@@ -129,4 +129,4 @@
}
```
It should return false as the invitation/delegation used for reporting phishers has been revoked.
It should return `false` as the invitation/delegation used for reporting phishers has been revoked.