From 2d745075e2d1a860e495c699eb5aa5f300933354 Mon Sep 17 00:00:00 2001 From: nabarun Date: Fri, 31 Mar 2023 18:10:24 +0530 Subject: [PATCH 1/3] Remove laconicd to use optimism endpoint --- .../docker-compose-watcher-mobymask-v2.yml | 9 +--- .../optimism-contracts/run.sh | 1 + .../config/watcher-mobymask-v2/secrets.json | 4 +- app/data/stacks/mobymask-v2/README.md | 52 +++---------------- app/data/stacks/mobymask-v2/demo.md | 6 +-- app/data/stacks/mobymask-v2/stack.yml | 3 -- 6 files changed, 13 insertions(+), 62 deletions(-) diff --git a/app/data/compose/docker-compose-watcher-mobymask-v2.yml b/app/data/compose/docker-compose-watcher-mobymask-v2.yml index dc4f6928..223fcc5e 100644 --- a/app/data/compose/docker-compose-watcher-mobymask-v2.yml +++ b/app/data/compose/docker-compose-watcher-mobymask-v2.yml @@ -25,6 +25,7 @@ services: restart: unless-stopped image: cerc/mobymask:local working_dir: /app/packages/server + # TODO: Configure env file for ETH RPC URL & private key environment: - ENV=PROD command: ["sh", "-c", "npm start"] @@ -109,11 +110,3 @@ services: volumes: mobymask_watcher_db_data: moby_data_server: - -networks: - # https://docs.docker.com/compose/networking/#configure-the-default-network - default: - # https://docs.docker.com/compose/networking/#use-a-pre-existing-network - name: mobymask-v2-network - external: true - diff --git a/app/data/config/fixturenet-optimism/optimism-contracts/run.sh b/app/data/config/fixturenet-optimism/optimism-contracts/run.sh index 4a5f568b..17a7887e 100755 --- a/app/data/config/fixturenet-optimism/optimism-contracts/run.sh +++ b/app/data/config/fixturenet-optimism/optimism-contracts/run.sh @@ -74,6 +74,7 @@ PROXY_JSON=$(cat deployments/getting-started/Proxy__OVM_L1StandardBridge.json) PROXY_ADDRESS=$(echo "$PROXY_JSON" | jq -r '.address') # Send balance to the above L2 address +# TODO: Send balance using second account to reflect in L2 yarn hardhat send-balance --to "${PROXY_ADDRESS}" --amount 1 --private-key "${L1_PRIV_KEY}" --network getting-started echo "Balance sent to Proxy L2 contract" diff --git a/app/data/config/watcher-mobymask-v2/secrets.json b/app/data/config/watcher-mobymask-v2/secrets.json index 127735cd..9fb85b79 100644 --- a/app/data/config/watcher-mobymask-v2/secrets.json +++ b/app/data/config/watcher-mobymask-v2/secrets.json @@ -1,5 +1,5 @@ { - "rpcUrl": "http://laconicd:8545", - "privateKey": "GENESIS_ACCOUNT_PRIVATE_KEY", + "rpcUrl": "http://op-geth:8545", + "privateKey": "ROLLUP_ACCOUNT_PRIVATE_KEY", "baseURI": "http://127.0.0.1:3002/#" } diff --git a/app/data/stacks/mobymask-v2/README.md b/app/data/stacks/mobymask-v2/README.md index fc6f6b05..432c7a77 100644 --- a/app/data/stacks/mobymask-v2/README.md +++ b/app/data/stacks/mobymask-v2/README.md @@ -28,10 +28,6 @@ git checkout v0.2.31 cd ~/cerc/mobymask-ui git checkout laconic -# laconicd -cd ~/cerc/laconicd -git checkout v0.8.0 - # MobyMask cd ~/cerc/MobyMask git checkout v0.1.1 @@ -47,55 +43,19 @@ This should create the required docker images in the local image registry. Deploy the stack: -* Deploy the laconic chain - - ```bash - laconic-so --stack mobymask-v2 deploy-system --include mobymask-laconicd up - ``` - -* Check that laconic chain status is healthy - - ```bash - docker ps - ``` - -* Export the private key from laconicd - - ```bash - laconic-so --stack mobymask-v2 deploy-system --include mobymask-laconicd exec laconicd "echo y | laconicd keys export mykey --unarmored-hex --unsafe" - ``` - * Set the private key in [secrets.json](../../config/watcher-mobymask-v2/secrets.json) file that will be used by mobymask container to deploy contract -* Create a new account named `alice` - - ```bash - laconic-so --stack mobymask-v2 deploy-system --include mobymask-laconicd exec laconicd "laconicd keys add alice" - ``` - -* Transfer balance to new account - - ```bash - laconic-so --stack mobymask-v2 deploy-system --include mobymask-laconicd exec laconicd 'laconicd tx bank send $(laconicd keys show mykey -a) $(laconicd keys show alice -a) 1000000000000000000000000aphoton --fees 2000aphoton' - ``` - -* Export the private key of new account from laconicd - - ```bash - laconic-so --stack mobymask-v2 deploy-system --include mobymask-laconicd exec laconicd "echo y | laconicd keys export alice --unarmored-hex --unsafe" - ``` - -* Set the private key (`server.p2p.peer.l2TxConfig.privateKey`) in [watcher.toml](../../config/watcher-mobymask-v2/watcher.toml) file that will be used to start the peer that sends txs to L2 chain +* Set the private key (`server.p2p.peer.l2TxConfig.privateKey`) in [watcher.toml](../../config/watcher-mobymask-v2/watcher-config-template.toml) file that will be used to start the peer that sends txs to L2 chain ```toml [server.p2p.peer.l2TxConfig] - privateKey = 'ALICE_PRIVATE_KEY' + privateKey = 'SECOND_ACCOUNT_PRIVATE_KEY' ``` -* Deploy the other containers +* Deploy the containers ```bash - laconic-so --stack mobymask-v2 deploy-system --include watcher-mobymask-v2 up + laconic-so --stack mobymask-v2 deploy-system up ``` * Check that all containers are healthy using `docker ps` @@ -103,7 +63,7 @@ Deploy the stack: 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 ```bash - laconic-so --stack mobymask-v2 deploy-system --include watcher-mobymask-v2 up + laconic-so --stack mobymask-v2 deploy-system up ``` ## Tests @@ -111,7 +71,7 @@ Deploy the stack: Find the watcher container's id: ```bash -laconic-so --stack mobymask-v2 deploy-system --include watcher-mobymask-v2 ps | grep "mobymask-watcher-server" +laconic-so --stack mobymask-v2 deploy-system ps | grep "mobymask-watcher-server" ``` Example output diff --git a/app/data/stacks/mobymask-v2/demo.md b/app/data/stacks/mobymask-v2/demo.md index 09085b89..35416780 100644 --- a/app/data/stacks/mobymask-v2/demo.md +++ b/app/data/stacks/mobymask-v2/demo.md @@ -3,7 +3,7 @@ * Get the root invite link URL for mobymask-app ``` - laconic-so --stack mobymask-v2 deploy-system --include watcher-mobymask-v2 logs mobymask + laconic-so --stack mobymask-v2 deploy-system logs mobymask ``` The invite link is seen at the end of the logs @@ -34,7 +34,7 @@ * Get the container id ```bash - laconic-so --stack mobymask-v2 deploy-system --include watcher-mobymask-v2 ps | grep mobymask-watcher-server + laconic-so --stack mobymask-v2 deploy-system ps | grep mobymask-watcher-server ``` * Check logs @@ -74,7 +74,7 @@ * Get the deployed contract address ```bash - laconic-so --stack mobymask-v2 deploy-system --include watcher-mobymask-v2 exec mobymask-app "cat src/config.json" + laconic-so --stack mobymask-v2 deploy-system exec mobymask-app "cat src/config.json" ``` The value of `address` field is the deployed contract address diff --git a/app/data/stacks/mobymask-v2/stack.yml b/app/data/stacks/mobymask-v2/stack.yml index e3b36bfe..c92a768d 100644 --- a/app/data/stacks/mobymask-v2/stack.yml +++ b/app/data/stacks/mobymask-v2/stack.yml @@ -4,14 +4,11 @@ repos: - cerc-io/watcher-ts - cerc-io/react-peer - cerc-io/mobymask-ui - - cerc-io/laconicd - cerc-io/MobyMask containers: - cerc/watcher-mobymask-v2 - cerc/react-peer - cerc/mobymask-ui - - cerc/laconicd - cerc/mobymask pods: - - mobymask-laconicd - watcher-mobymask-v2 -- 2.45.2 From d97c4bf14d5127b44a7ee282c8e5c313fb5e1e45 Mon Sep 17 00:00:00 2001 From: nabarun Date: Mon, 3 Apr 2023 15:37:45 +0530 Subject: [PATCH 2/3] Use fixturenet-optimism stack for mobymask-v2-watcher --- .../compose/docker-compose-fixturenet-eth.yml | 4 ++-- .../docker-compose-fixturenet-optimism.yml | 20 +++++++++---------- .../docker-compose-watcher-mobymask-v2.yml | 17 +++++++++++++++- .../optimism-contracts/run.sh | 16 ++++++++++----- .../config/fixturenet-optimism/run-op-node.sh | 4 ++-- .../watcher-mobymask-v2/deploy-invite.sh | 11 ++++++++++ .../config/watcher-mobymask-v2/secrets.json | 2 +- .../watcher-mobymask-v2/server-start.sh | 4 +++- .../watcher-config-template.toml | 4 ++-- .../container-build/cerc-mobymask/Dockerfile | 2 +- app/data/stacks/mobymask-v2/README.md | 9 --------- app/data/stacks/mobymask-v2/stack.yml | 15 ++++++++++++++ 12 files changed, 74 insertions(+), 34 deletions(-) create mode 100644 app/data/config/watcher-mobymask-v2/deploy-invite.sh diff --git a/app/data/compose/docker-compose-fixturenet-eth.yml b/app/data/compose/docker-compose-fixturenet-eth.yml index c51550cc..2eaad084 100644 --- a/app/data/compose/docker-compose-fixturenet-eth.yml +++ b/app/data/compose/docker-compose-fixturenet-eth.yml @@ -25,7 +25,7 @@ services: - ../config/fixturenet-eth/fixturenet-eth.env image: cerc/fixturenet-eth-geth:local volumes: - - fixturenet-geth-accounts:/opt/testnet/build/el + - fixturenet_geth_accounts:/opt/testnet/build/el healthcheck: test: ["CMD", "nc", "-v", "localhost", "8545"] interval: 30s @@ -111,4 +111,4 @@ services: condition: service_healthy volumes: - fixturenet-geth-accounts: + fixturenet_geth_accounts: diff --git a/app/data/compose/docker-compose-fixturenet-optimism.yml b/app/data/compose/docker-compose-fixturenet-optimism.yml index 6e65c46f..f334d794 100644 --- a/app/data/compose/docker-compose-fixturenet-optimism.yml +++ b/app/data/compose/docker-compose-fixturenet-optimism.yml @@ -18,9 +18,9 @@ services: - ../config/fixturenet-optimism/optimism-contracts/send-balance.ts:/app/packages/contracts-bedrock/tasks/send-balance.ts - ../config/fixturenet-optimism/optimism-contracts/update-config.js:/app/packages/contracts-bedrock/update-config.js - ../config/fixturenet-optimism/optimism-contracts/run.sh:/app/packages/contracts-bedrock/run.sh - - fixturenet-geth-accounts:/geth-accounts:ro - - l2-accounts:/l2-accounts - - l1-deployment:/app/packages/contracts-bedrock + - fixturenet_geth_accounts:/geth-accounts:ro + - l2_accounts:/l2-accounts + - l1_deployment:/app/packages/contracts-bedrock op-node-l2-config-gen: image: cerc/optimism-op-node:local @@ -31,7 +31,7 @@ services: L1_RPC: "http://fixturenet-eth-geth-1:8545" volumes: - ../config/fixturenet-optimism/generate-l2-config.sh:/app/generate-l2-config.sh - - l1-deployment:/contracts-bedrock:ro + - l1_deployment:/contracts-bedrock:ro - op_node_data:/app command: ["sh", "/app/generate-l2-config.sh"] @@ -43,7 +43,7 @@ services: volumes: - ../config/fixturenet-optimism/run-op-geth.sh:/run-op-geth.sh - op_node_data:/op-node:ro - - l2-accounts:/l2-accounts:ro + - l2_accounts:/l2-accounts:ro entrypoint: "sh" command: "/run-op-geth.sh" ports: @@ -64,8 +64,8 @@ services: image: cerc/optimism-op-node:local volumes: - ../config/fixturenet-optimism/run-op-node.sh:/app/run-op-node.sh - - op_node_data:/app:ro - - l2-accounts:/l2-accounts:ro + - op_node_data:/op-node-data:ro + - l2_accounts:/l2-accounts:ro command: ["sh", "/app/run-op-node.sh"] ports: - "8547" @@ -87,11 +87,11 @@ services: image: cerc/optimism-op-batcher:local volumes: - ../config/fixturenet-optimism/run-op-batcher.sh:/run-op-batcher.sh - - l2-accounts:/l2-accounts:ro + - l2_accounts:/l2-accounts:ro entrypoint: "sh" command: "/run-op-batcher.sh" volumes: op_node_data: - l2-accounts: - l1-deployment: + l2_accounts: + l1_deployment: diff --git a/app/data/compose/docker-compose-watcher-mobymask-v2.yml b/app/data/compose/docker-compose-watcher-mobymask-v2.yml index 223fcc5e..ca1b7809 100644 --- a/app/data/compose/docker-compose-watcher-mobymask-v2.yml +++ b/app/data/compose/docker-compose-watcher-mobymask-v2.yml @@ -25,13 +25,22 @@ services: restart: unless-stopped image: cerc/mobymask:local working_dir: /app/packages/server + depends_on: + op-node: + condition: service_healthy + op-geth: + condition: service_healthy # TODO: Configure env file for ETH RPC URL & private key environment: - ENV=PROD - command: ["sh", "-c", "npm start"] + command: ["sh", "./deploy-invite.sh"] volumes: + # TODO: add a script to set rpc endpoint from env + # add manually if running seperately - ../config/watcher-mobymask-v2/secrets.json:/app/packages/server/secrets.json + - ../config/watcher-mobymask-v2/deploy-invite.sh:/app/packages/server/deploy-invite.sh - moby_data_server:/app/packages/server + - fixturenet_geth_accounts:/geth-accounts:ro healthcheck: test: ["CMD", "nc", "-v", "localhost", "3330"] interval: 20s @@ -40,6 +49,7 @@ services: start_period: 10s mobymask-watcher-server: + # TODO: pass optimism rpc endpoint restart: unless-stopped depends_on: mobymask-watcher-db: @@ -49,12 +59,15 @@ services: image: cerc/watcher-mobymask-v2:local command: ["sh", "server-start.sh"] volumes: + # TODO: add a script to set rpc endpoint from env + # add manually if running seperately - ../config/watcher-mobymask-v2/watcher-config-template.toml:/app/packages/mobymask-v2-watcher/environments/watcher-config-template.toml - ../config/watcher-mobymask-v2/peer.env:/app/packages/peer/.env - ../config/watcher-mobymask-v2/relay-id.json:/app/packages/mobymask-v2-watcher/relay-id.json - ../config/watcher-mobymask-v2/peer-id.json:/app/packages/mobymask-v2-watcher/peer-id.json - ../config/watcher-mobymask-v2/server-start.sh:/app/packages/mobymask-v2-watcher/server-start.sh - moby_data_server:/server + - fixturenet_geth_accounts:/geth-accounts:ro ports: - "0.0.0.0:3001:3001" - "0.0.0.0:9001:9001" @@ -66,6 +79,7 @@ services: retries: 15 start_period: 5s + # TODO: Move to a separate pod mobymask-app: depends_on: mobymask-watcher-server: @@ -110,3 +124,4 @@ services: volumes: mobymask_watcher_db_data: moby_data_server: + fixturenet_geth_accounts: diff --git a/app/data/config/fixturenet-optimism/optimism-contracts/run.sh b/app/data/config/fixturenet-optimism/optimism-contracts/run.sh index 17a7887e..473b8743 100755 --- a/app/data/config/fixturenet-optimism/optimism-contracts/run.sh +++ b/app/data/config/fixturenet-optimism/optimism-contracts/run.sh @@ -28,10 +28,12 @@ PROPOSER_ADDRESS=$(echo "$KEYS_JSON" | jq -r '.Proposer.address') BATCHER_ADDRESS=$(echo "$KEYS_JSON" | jq -r '.Batcher.address') SEQUENCER_ADDRESS=$(echo "$KEYS_JSON" | jq -r '.Sequencer.address') -# Read the private key of a L1 account +# Read the private key of L1 accounts # TODO: Take from env if /geth-accounts volume doesn't exist to allow using separately running L1 L1_ADDRESS=$(head -n 1 /geth-accounts/accounts.csv | cut -d ',' -f 2) L1_PRIV_KEY=$(head -n 1 /geth-accounts/accounts.csv | cut -d ',' -f 3) +L1_ADDRESS_2=$(awk -F, 'NR==2{print $(NF-1)}' /geth-accounts/accounts.csv) +L1_PRIV_KEY_2=$(awk -F, 'NR==2{print $NF}' /geth-accounts/accounts.csv) # Send balances to the above L2 addresses yarn hardhat send-balance --to "${ADMIN_ADDRESS}" --amount 2 --private-key "${L1_PRIV_KEY}" --network getting-started @@ -69,14 +71,18 @@ yarn hardhat deploy --network getting-started echo "Deployed the L1 smart contracts" -# Read Proxy contarct's JSON and get the address +# Read Proxy contract's JSON and get the address PROXY_JSON=$(cat deployments/getting-started/Proxy__OVM_L1StandardBridge.json) PROXY_ADDRESS=$(echo "$PROXY_JSON" | jq -r '.address') -# Send balance to the above L2 address -# TODO: Send balance using second account to reflect in L2 +# Send balance to the above Proxy contract in L1 for reflecting balance in L2 +# First account yarn hardhat send-balance --to "${PROXY_ADDRESS}" --amount 1 --private-key "${L1_PRIV_KEY}" --network getting-started +# Second account +yarn hardhat send-balance --to "${PROXY_ADDRESS}" --amount 1 --private-key "${L1_PRIV_KEY_2}" --network getting-started echo "Balance sent to Proxy L2 contract" -echo "Use account ${L1_ADDRESS} to deploy contracts to L2" +echo "Use following accounts for transactions in L2:" +echo "${L1_ADDRESS}" +echo "${L1_ADDRESS_2}" echo "Done" diff --git a/app/data/config/fixturenet-optimism/run-op-node.sh b/app/data/config/fixturenet-optimism/run-op-node.sh index e4aafae9..3be417d0 100755 --- a/app/data/config/fixturenet-optimism/run-op-node.sh +++ b/app/data/config/fixturenet-optimism/run-op-node.sh @@ -6,11 +6,11 @@ SEQUENCER_KEY=$(jq -r '.Sequencer.privateKey' /l2-accounts/keys.json | tr -d '"' op-node \ --l2=http://op-geth:8551 \ - --l2.jwt-secret=/app/jwt.txt \ + --l2.jwt-secret=/op-node-data/jwt.txt \ --sequencer.enabled \ --sequencer.l1-confs=3 \ --verifier.l1-confs=3 \ - --rollup.config=/app/rollup.json \ + --rollup.config=/op-node-data/rollup.json \ --rpc.addr=0.0.0.0 \ --rpc.port=8547 \ --p2p.disable \ diff --git a/app/data/config/watcher-mobymask-v2/deploy-invite.sh b/app/data/config/watcher-mobymask-v2/deploy-invite.sh new file mode 100644 index 00000000..9dc9782b --- /dev/null +++ b/app/data/config/watcher-mobymask-v2/deploy-invite.sh @@ -0,0 +1,11 @@ +#!/bin/sh +set -e + +# Read the private key of L1 account to deploy contract +# TODO: Take from env if /geth-accounts volume doesn't exist to allow using separately running L1 +L1_PRIV_KEY=$(head -n 1 /geth-accounts/accounts.csv | cut -d ',' -f 3) + +# Set the private key +jq --arg privateKey "$L1_PRIV_KEY" '.privateKey = ($privateKey)' secrets.json > tmp.json && mv tmp.json secrets.json + +npm start diff --git a/app/data/config/watcher-mobymask-v2/secrets.json b/app/data/config/watcher-mobymask-v2/secrets.json index 9fb85b79..220efc8e 100644 --- a/app/data/config/watcher-mobymask-v2/secrets.json +++ b/app/data/config/watcher-mobymask-v2/secrets.json @@ -1,5 +1,5 @@ { "rpcUrl": "http://op-geth:8545", - "privateKey": "ROLLUP_ACCOUNT_PRIVATE_KEY", + "privateKey": "", "baseURI": "http://127.0.0.1:3002/#" } diff --git a/app/data/config/watcher-mobymask-v2/server-start.sh b/app/data/config/watcher-mobymask-v2/server-start.sh index 80bf4d34..766525f4 100755 --- a/app/data/config/watcher-mobymask-v2/server-start.sh +++ b/app/data/config/watcher-mobymask-v2/server-start.sh @@ -2,8 +2,10 @@ # Assign deployed contract address from server config CONTRACT_ADDRESS=`jq '.address' /server/config.json` +L1_PRIV_KEY_2=$(awk -F, 'NR==2{print $NF}' /geth-accounts/accounts.csv) -sed "s/REPLACE_WITH_CONTRACT_ADDRESS/${CONTRACT_ADDRESS}/" environments/watcher-config-template.toml > environments/local.toml +sed "s/REPLACE_WITH_PRIVATE_KEY/${L1_PRIV_KEY_2}/" environments/watcher-config-template.toml > environments/local.toml +sed -i "s/REPLACE_WITH_CONTRACT_ADDRESS/${CONTRACT_ADDRESS}/" environments/local.toml echo 'yarn server' yarn server diff --git a/app/data/config/watcher-mobymask-v2/watcher-config-template.toml b/app/data/config/watcher-mobymask-v2/watcher-config-template.toml index 1a05e225..f93a310a 100644 --- a/app/data/config/watcher-mobymask-v2/watcher-config-template.toml +++ b/app/data/config/watcher-mobymask-v2/watcher-config-template.toml @@ -37,7 +37,7 @@ enableDebugInfo = true [server.p2p.peer.l2TxConfig] - privateKey = '' + privateKey = REPLACE_WITH_PRIVATE_KEY contractAddress = REPLACE_WITH_CONTRACT_ADDRESS [metrics] @@ -59,7 +59,7 @@ [upstream] [upstream.ethServer] gqlApiEndpoint = "http://ipld-eth-server:8083/graphql" - rpcProviderEndpoint = "http://laconicd:8545" + rpcProviderEndpoint = "http://op-geth:8545" blockDelayInMilliSecs = 60000 [upstream.cache] diff --git a/app/data/container-build/cerc-mobymask/Dockerfile b/app/data/container-build/cerc-mobymask/Dockerfile index e7b09cf8..c94a1cea 100644 --- a/app/data/container-build/cerc-mobymask/Dockerfile +++ b/app/data/container-build/cerc-mobymask/Dockerfile @@ -1,6 +1,6 @@ FROM node:16.17.1-alpine3.16 -RUN apk --update --no-cache add python3 alpine-sdk +RUN apk --update --no-cache add python3 alpine-sdk jq WORKDIR /app diff --git a/app/data/stacks/mobymask-v2/README.md b/app/data/stacks/mobymask-v2/README.md index 432c7a77..2ebc304b 100644 --- a/app/data/stacks/mobymask-v2/README.md +++ b/app/data/stacks/mobymask-v2/README.md @@ -43,15 +43,6 @@ This should create the required docker images in the local image registry. Deploy the stack: -* Set the private key in [secrets.json](../../config/watcher-mobymask-v2/secrets.json) file that will be used by mobymask container to deploy contract - -* Set the private key (`server.p2p.peer.l2TxConfig.privateKey`) in [watcher.toml](../../config/watcher-mobymask-v2/watcher-config-template.toml) file that will be used to start the peer that sends txs to L2 chain - - ```toml - [server.p2p.peer.l2TxConfig] - privateKey = 'SECOND_ACCOUNT_PRIVATE_KEY' - ``` - * Deploy the containers ```bash diff --git a/app/data/stacks/mobymask-v2/stack.yml b/app/data/stacks/mobymask-v2/stack.yml index c92a768d..cdcbd663 100644 --- a/app/data/stacks/mobymask-v2/stack.yml +++ b/app/data/stacks/mobymask-v2/stack.yml @@ -1,14 +1,29 @@ version: "1.0" name: mobymask-v2 repos: + - cerc-io/go-ethereum + - dboreham/foundry + - ethereum-optimism/optimism + - ethereum-optimism/op-geth - cerc-io/watcher-ts - cerc-io/react-peer - cerc-io/mobymask-ui - cerc-io/MobyMask containers: + - cerc/go-ethereum + - cerc/lighthouse + - cerc/fixturenet-eth-geth + - cerc/fixturenet-eth-lighthouse + - cerc/foundry + - cerc/optimism-contracts + - cerc/optimism-l2geth + - cerc/optimism-op-batcher + - cerc/optimism-op-node - cerc/watcher-mobymask-v2 - cerc/react-peer - cerc/mobymask-ui - cerc/mobymask pods: + - fixturenet-eth + - fixturenet-optimism - watcher-mobymask-v2 -- 2.45.2 From f9a3642caef0ffaca1076f3e82e8123b5a02d1a7 Mon Sep 17 00:00:00 2001 From: nabarun Date: Mon, 3 Apr 2023 16:22:13 +0530 Subject: [PATCH 3/3] Fix setting L1 account private key in mobymask-v2 stack --- app/data/compose/docker-compose-fixturenet-optimism.yml | 2 ++ app/data/compose/docker-compose-watcher-mobymask-v2.yml | 2 +- app/data/config/watcher-mobymask-v2/deploy-invite.sh | 2 +- .../{secrets.json => secrets-template.json} | 0 app/data/config/watcher-mobymask-v2/server-start.sh | 2 +- .../config/watcher-mobymask-v2/watcher-config-template.toml | 4 ++-- app/data/stacks/mobymask-v2/README.md | 4 +--- 7 files changed, 8 insertions(+), 8 deletions(-) rename app/data/config/watcher-mobymask-v2/{secrets.json => secrets-template.json} (100%) diff --git a/app/data/compose/docker-compose-fixturenet-optimism.yml b/app/data/compose/docker-compose-fixturenet-optimism.yml index f334d794..6dcde5c9 100644 --- a/app/data/compose/docker-compose-fixturenet-optimism.yml +++ b/app/data/compose/docker-compose-fixturenet-optimism.yml @@ -80,6 +80,8 @@ services: environment: L1_RPC: "http://fixturenet-eth-geth-1:8545" depends_on: + fixturenet-eth-geth-1: + condition: service_healthy op-node: condition: service_healthy op-geth: diff --git a/app/data/compose/docker-compose-watcher-mobymask-v2.yml b/app/data/compose/docker-compose-watcher-mobymask-v2.yml index ca1b7809..ed5c203a 100644 --- a/app/data/compose/docker-compose-watcher-mobymask-v2.yml +++ b/app/data/compose/docker-compose-watcher-mobymask-v2.yml @@ -37,7 +37,7 @@ services: volumes: # TODO: add a script to set rpc endpoint from env # add manually if running seperately - - ../config/watcher-mobymask-v2/secrets.json:/app/packages/server/secrets.json + - ../config/watcher-mobymask-v2/secrets-template.json:/app/packages/server/secrets-template.json - ../config/watcher-mobymask-v2/deploy-invite.sh:/app/packages/server/deploy-invite.sh - moby_data_server:/app/packages/server - fixturenet_geth_accounts:/geth-accounts:ro diff --git a/app/data/config/watcher-mobymask-v2/deploy-invite.sh b/app/data/config/watcher-mobymask-v2/deploy-invite.sh index 9dc9782b..2a8e0eb5 100644 --- a/app/data/config/watcher-mobymask-v2/deploy-invite.sh +++ b/app/data/config/watcher-mobymask-v2/deploy-invite.sh @@ -6,6 +6,6 @@ set -e L1_PRIV_KEY=$(head -n 1 /geth-accounts/accounts.csv | cut -d ',' -f 3) # Set the private key -jq --arg privateKey "$L1_PRIV_KEY" '.privateKey = ($privateKey)' secrets.json > tmp.json && mv tmp.json secrets.json +jq --arg privateKey "$L1_PRIV_KEY" '.privateKey = ($privateKey)' secrets-template.json > secrets.json npm start diff --git a/app/data/config/watcher-mobymask-v2/secrets.json b/app/data/config/watcher-mobymask-v2/secrets-template.json similarity index 100% rename from app/data/config/watcher-mobymask-v2/secrets.json rename to app/data/config/watcher-mobymask-v2/secrets-template.json diff --git a/app/data/config/watcher-mobymask-v2/server-start.sh b/app/data/config/watcher-mobymask-v2/server-start.sh index 766525f4..6b4cd345 100755 --- a/app/data/config/watcher-mobymask-v2/server-start.sh +++ b/app/data/config/watcher-mobymask-v2/server-start.sh @@ -1,7 +1,7 @@ #!/bin/sh # Assign deployed contract address from server config -CONTRACT_ADDRESS=`jq '.address' /server/config.json` +CONTRACT_ADDRESS=$(jq -r '.address' /server/config.json | tr -d '"') L1_PRIV_KEY_2=$(awk -F, 'NR==2{print $NF}' /geth-accounts/accounts.csv) sed "s/REPLACE_WITH_PRIVATE_KEY/${L1_PRIV_KEY_2}/" environments/watcher-config-template.toml > environments/local.toml diff --git a/app/data/config/watcher-mobymask-v2/watcher-config-template.toml b/app/data/config/watcher-mobymask-v2/watcher-config-template.toml index f93a310a..ff937678 100644 --- a/app/data/config/watcher-mobymask-v2/watcher-config-template.toml +++ b/app/data/config/watcher-mobymask-v2/watcher-config-template.toml @@ -37,8 +37,8 @@ enableDebugInfo = true [server.p2p.peer.l2TxConfig] - privateKey = REPLACE_WITH_PRIVATE_KEY - contractAddress = REPLACE_WITH_CONTRACT_ADDRESS + privateKey = 'REPLACE_WITH_PRIVATE_KEY' + contractAddress = 'REPLACE_WITH_CONTRACT_ADDRESS' [metrics] host = "0.0.0.0" diff --git a/app/data/stacks/mobymask-v2/README.md b/app/data/stacks/mobymask-v2/README.md index 2ebc304b..18af5b2b 100644 --- a/app/data/stacks/mobymask-v2/README.md +++ b/app/data/stacks/mobymask-v2/README.md @@ -114,9 +114,7 @@ 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 --include watcher-mobymask-v2 down - -laconic-so --stack mobymask-v2 deploy-system --include mobymask-laconicd down +laconic-so --stack mobymask-v2 deploy-system down ``` Clear volumes: -- 2.45.2