From 1a2bbe337a84659f462f4ed79c5ba74405a56293 Mon Sep 17 00:00:00 2001 From: prathamesh0 Date: Tue, 4 Apr 2023 10:51:05 +0530 Subject: [PATCH] Update mobymask-v2 instructions --- .../optimism-contracts/run.sh | 3 ++ .../config/fixturenet-optimism/run-op-geth.sh | 5 ++- app/data/stacks/fixturenet-optimism/README.md | 2 +- app/data/stacks/fixturenet-optimism/stack.yml | 2 +- app/data/stacks/mobymask-v2/README.md | 29 +++++++++++------ app/data/stacks/mobymask-v2/demo.md | 32 +++++++++---------- 6 files changed, 44 insertions(+), 29 deletions(-) diff --git a/app/data/config/fixturenet-optimism/optimism-contracts/run.sh b/app/data/config/fixturenet-optimism/optimism-contracts/run.sh index ac8ee430..e8775121 100755 --- a/app/data/config/fixturenet-optimism/optimism-contracts/run.sh +++ b/app/data/config/fixturenet-optimism/optimism-contracts/run.sh @@ -50,9 +50,12 @@ until FINALIZED_BLOCK=$(cast block finalized --rpc-url "$L1_RPC"); do sleep 10 done +L1_BLOCKNUMBER=$(echo "$FINALIZED_BLOCK" | awk '/number/{print $2}') L1_BLOCKHASH=$(echo "$FINALIZED_BLOCK" | awk '/hash/{print $2}') L1_BLOCKTIMESTAMP=$(echo "$FINALIZED_BLOCK" | awk '/timestamp/{print $2}') +echo "Selected L1 block ${L1_BLOCKNUMBER} as the starting block for roll ups" + # Send balances to the above L2 addresses yarn hardhat send-balance --to "${ADMIN_ADDRESS}" --amount 2 --private-key "${L1_PRIV_KEY}" --network getting-started yarn hardhat send-balance --to "${PROPOSER_ADDRESS}" --amount 5 --private-key "${L1_PRIV_KEY}" --network getting-started diff --git a/app/data/config/fixturenet-optimism/run-op-geth.sh b/app/data/config/fixturenet-optimism/run-op-geth.sh index 2c1abc3e..cb180065 100755 --- a/app/data/config/fixturenet-optimism/run-op-geth.sh +++ b/app/data/config/fixturenet-optimism/run-op-geth.sh @@ -1,5 +1,8 @@ #!/bin/sh -set -e -x +set -e +if [ -n "$CERC_SCRIPT_DEBUG" ]; then + set -x +fi mkdir datadir diff --git a/app/data/stacks/fixturenet-optimism/README.md b/app/data/stacks/fixturenet-optimism/README.md index 5b9dd51b..c3ef118d 100644 --- a/app/data/stacks/fixturenet-optimism/README.md +++ b/app/data/stacks/fixturenet-optimism/README.md @@ -13,7 +13,7 @@ laconic-so --stack fixturenet-optimism setup-repositories Checkout to the required versions and branches in repos: ```bash -# optimism +# Optimism cd ~/cerc/optimism git checkout @eth-optimism/sdk@0.0.0-20230329025055 ``` diff --git a/app/data/stacks/fixturenet-optimism/stack.yml b/app/data/stacks/fixturenet-optimism/stack.yml index 299b1367..e53623ca 100644 --- a/app/data/stacks/fixturenet-optimism/stack.yml +++ b/app/data/stacks/fixturenet-optimism/stack.yml @@ -13,9 +13,9 @@ containers: - cerc/fixturenet-eth-lighthouse - cerc/foundry - cerc/optimism-contracts + - cerc/optimism-op-node - cerc/optimism-l2geth - cerc/optimism-op-batcher - - cerc/optimism-op-node pods: - fixturenet-eth - fixturenet-optimism diff --git a/app/data/stacks/mobymask-v2/README.md b/app/data/stacks/mobymask-v2/README.md index 18af5b2b..71d30a56 100644 --- a/app/data/stacks/mobymask-v2/README.md +++ b/app/data/stacks/mobymask-v2/README.md @@ -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,18 +47,20 @@ 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 ``` ## Tests @@ -87,7 +93,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 +129,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*) ``` diff --git a/app/data/stacks/mobymask-v2/demo.md b/app/data/stacks/mobymask-v2/demo.md index 35416780..dbed1871 100644 --- a/app/data/stacks/mobymask-v2/demo.md +++ b/app/data/stacks/mobymask-v2/demo.md @@ -1,14 +1,14 @@ # 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 ``` @@ -16,7 +16,7 @@ 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 atleast 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 ``` -* 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" @@ -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.