From 3011a485ee523b3dfcdfe08c546bdab48a2d00d0 Mon Sep 17 00:00:00 2001 From: prathamesh0 <42446521+prathamesh0@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:48:32 +0530 Subject: [PATCH] Update mobymask-v2 stack with pubsub option (#527) * Add steps to force rebuild and persist peers_ids volume * Update mobymask-v2 stack with pubsub option * Update watcher-ts version --------- Co-authored-by: Nabarun --- app/data/compose/docker-compose-mobymask-app.yml | 6 ++++-- app/data/compose/docker-compose-watcher-mobymask-v2.yml | 1 + app/data/config/watcher-mobymask-v2/mobymask-app-start.sh | 4 +++- app/data/config/watcher-mobymask-v2/mobymask-params.env | 3 +++ app/data/config/watcher-mobymask-v2/start-server.sh | 2 ++ .../watcher-mobymask-v2/watcher-config-template.toml | 2 ++ app/data/stacks/fixturenet-optimism/README.md | 5 +++++ app/data/stacks/mobymask-v2/mobymask-only.md | 7 +++++++ app/data/stacks/mobymask-v2/stack.yml | 4 ++-- app/data/stacks/mobymask-v2/web-apps.md | 3 +++ 10 files changed, 32 insertions(+), 5 deletions(-) diff --git a/app/data/compose/docker-compose-mobymask-app.yml b/app/data/compose/docker-compose-mobymask-app.yml index 22d5f70f..100342ae 100644 --- a/app/data/compose/docker-compose-mobymask-app.yml +++ b/app/data/compose/docker-compose-mobymask-app.yml @@ -14,7 +14,8 @@ services: CERC_APP_WATCHER_URL: ${CERC_APP_WATCHER_URL} CERC_RELAY_NODES: ${CERC_RELAY_NODES} CERC_DENY_MULTIADDRS: ${CERC_DENY_MULTIADDRS} - CERC_RELEASE: "v0.1.6" + CERC_PUBSUB: ${CERC_PUBSUB} + CERC_RELEASE: "v0.1.7" CERC_USE_NPM: true CERC_CONFIG_FILE: "src/config.json" working_dir: /scripts @@ -48,7 +49,8 @@ services: CERC_APP_WATCHER_URL: ${CERC_APP_WATCHER_URL} CERC_RELAY_NODES: ${CERC_RELAY_NODES} CERC_DENY_MULTIADDRS: ${CERC_DENY_MULTIADDRS} - CERC_RELEASE: "v0.1.6-lxdao-0.1.1" + CERC_PUBSUB: ${CERC_PUBSUB} + CERC_RELEASE: "v0.1.7-lxdao-0.1.1" CERC_USE_NPM: false CERC_CONFIG_FILE: "src/utils/config.json" working_dir: /scripts diff --git a/app/data/compose/docker-compose-watcher-mobymask-v2.yml b/app/data/compose/docker-compose-watcher-mobymask-v2.yml index bed274c6..176135fb 100644 --- a/app/data/compose/docker-compose-watcher-mobymask-v2.yml +++ b/app/data/compose/docker-compose-watcher-mobymask-v2.yml @@ -84,6 +84,7 @@ services: CERC_PRIVATE_KEY_PEER: ${CERC_PRIVATE_KEY_PEER} CERC_RELAY_PEERS: ${CERC_RELAY_PEERS} CERC_DENY_MULTIADDRS: ${CERC_DENY_MULTIADDRS} + CERC_PUBSUB: ${CERC_PUBSUB} CERC_RELAY_ANNOUNCE_DOMAIN: ${CERC_RELAY_ANNOUNCE_DOMAIN} CERC_ENABLE_PEER_L2_TXS: ${CERC_ENABLE_PEER_L2_TXS} CERC_DEPLOYED_CONTRACT: ${CERC_DEPLOYED_CONTRACT} diff --git a/app/data/config/watcher-mobymask-v2/mobymask-app-start.sh b/app/data/config/watcher-mobymask-v2/mobymask-app-start.sh index d6f0d452..3623d0ba 100755 --- a/app/data/config/watcher-mobymask-v2/mobymask-app-start.sh +++ b/app/data/config/watcher-mobymask-v2/mobymask-app-start.sh @@ -8,6 +8,7 @@ CERC_CHAIN_ID="${CERC_CHAIN_ID:-${DEFAULT_CERC_CHAIN_ID}}" CERC_DEPLOYED_CONTRACT="${CERC_DEPLOYED_CONTRACT:-${DEFAULT_CERC_DEPLOYED_CONTRACT}}" CERC_RELAY_NODES="${CERC_RELAY_NODES:-${DEFAULT_CERC_RELAY_NODES}}" CERC_DENY_MULTIADDRS="${CERC_DENY_MULTIADDRS:-${DEFAULT_CERC_DENY_MULTIADDRS}}" +CERC_PUBSUB="${CERC_PUBSUB:-${DEFAULT_CERC_PUBSUB}}" CERC_APP_WATCHER_URL="${CERC_APP_WATCHER_URL:-${DEFAULT_CERC_APP_WATCHER_URL}}" # If not set (or []), check the mounted volume for relay peer id @@ -41,7 +42,8 @@ jq --arg address "$CERC_DEPLOYED_CONTRACT" \ --argjson chainId "$CERC_CHAIN_ID" \ --argjson relayNodes "$CERC_RELAY_NODES" \ --argjson denyMultiaddrs "$CERC_DENY_MULTIADDRS" \ - '.address = $address | .chainId = $chainId | .relayNodes = $relayNodes | .peer.denyMultiaddrs = $denyMultiaddrs' \ + --arg pubsub "$CERC_PUBSUB" \ + '.address = $address | .chainId = $chainId | .relayNodes = $relayNodes | .peer.denyMultiaddrs = $denyMultiaddrs | .peer.pubsub = $pubsub' \ /app/src/mobymask-app-config.json > /app/${CERC_CONFIG_FILE} if [ "${CERC_USE_NPM}" = "true" ]; then diff --git a/app/data/config/watcher-mobymask-v2/mobymask-params.env b/app/data/config/watcher-mobymask-v2/mobymask-params.env index 5e4d9fb6..2cf65c7e 100644 --- a/app/data/config/watcher-mobymask-v2/mobymask-params.env +++ b/app/data/config/watcher-mobymask-v2/mobymask-params.env @@ -27,3 +27,6 @@ DEFAULT_CERC_RELAY_NODES=[] # Set of multiaddrs to be avoided while dialling DEFAULT_CERC_DENY_MULTIADDRS=[] + +# Type of pubsub to be used +DEFAULT_CERC_PUBSUB="" diff --git a/app/data/config/watcher-mobymask-v2/start-server.sh b/app/data/config/watcher-mobymask-v2/start-server.sh index eab8bac2..110265bc 100755 --- a/app/data/config/watcher-mobymask-v2/start-server.sh +++ b/app/data/config/watcher-mobymask-v2/start-server.sh @@ -9,6 +9,7 @@ CERC_L1_ACCOUNTS_CSV_URL="${CERC_L1_ACCOUNTS_CSV_URL:-${DEFAULT_CERC_L1_ACCOUNTS CERC_RELAY_PEERS="${CERC_RELAY_PEERS:-${DEFAULT_CERC_RELAY_PEERS}}" CERC_DENY_MULTIADDRS="${CERC_DENY_MULTIADDRS:-${DEFAULT_CERC_DENY_MULTIADDRS}}" +CERC_PUBSUB="${CERC_PUBSUB:-${DEFAULT_CERC_PUBSUB}}" CERC_RELAY_ANNOUNCE_DOMAIN="${CERC_RELAY_ANNOUNCE_DOMAIN:-${DEFAULT_CERC_RELAY_ANNOUNCE_DOMAIN}}" CERC_ENABLE_PEER_L2_TXS="${CERC_ENABLE_PEER_L2_TXS:-${DEFAULT_CERC_ENABLE_PEER_L2_TXS}}" CERC_DEPLOYED_CONTRACT="${CERC_DEPLOYED_CONTRACT:-${DEFAULT_CERC_DEPLOYED_CONTRACT}}" @@ -50,6 +51,7 @@ WATCHER_CONFIG_TEMPLATE=$(cat environments/watcher-config-template.toml) WATCHER_CONFIG=$(echo "$WATCHER_CONFIG_TEMPLATE" | \ sed -E "s|REPLACE_WITH_CERC_RELAY_PEERS|${CERC_RELAY_PEERS}|g; \ s|REPLACE_WITH_CERC_DENY_MULTIADDRS|${CERC_DENY_MULTIADDRS}|g; \ + s/REPLACE_WITH_CERC_PUBSUB/${CERC_PUBSUB}/g; \ s/REPLACE_WITH_CERC_RELAY_ANNOUNCE_DOMAIN/${CERC_RELAY_ANNOUNCE_DOMAIN}/g; \ s|REPLACE_WITH_CERC_RELAY_MULTIADDR|${CERC_RELAY_MULTIADDR}|g; \ s/REPLACE_WITH_CERC_ENABLE_PEER_L2_TXS/${CERC_ENABLE_PEER_L2_TXS}/g; \ 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 5a2c7ce4..a0dd3b34 100644 --- a/app/data/config/watcher-mobymask-v2/watcher-config-template.toml +++ b/app/data/config/watcher-mobymask-v2/watcher-config-template.toml @@ -30,6 +30,7 @@ denyMultiaddrs = REPLACE_WITH_CERC_DENY_MULTIADDRS peerIdFile = './peers/relay-id.json' announce = 'REPLACE_WITH_CERC_RELAY_ANNOUNCE_DOMAIN' + pubsub = 'REPLACE_WITH_CERC_PUBSUB' enableDebugInfo = true [server.p2p.peer] @@ -37,6 +38,7 @@ pubSubTopic = 'mobymask' denyMultiaddrs = REPLACE_WITH_CERC_DENY_MULTIADDRS peerIdFile = './peers/peer-id.json' + pubsub = 'REPLACE_WITH_CERC_PUBSUB' enableDebugInfo = true enableL2Txs = REPLACE_WITH_CERC_ENABLE_PEER_L2_TXS diff --git a/app/data/stacks/fixturenet-optimism/README.md b/app/data/stacks/fixturenet-optimism/README.md index c083ee68..4d933f83 100644 --- a/app/data/stacks/fixturenet-optimism/README.md +++ b/app/data/stacks/fixturenet-optimism/README.md @@ -18,6 +18,11 @@ Build the container images: ```bash laconic-so --stack fixturenet-optimism build-containers + +# If redeploying with changes in the stack containers +laconic-so --stack fixturenet-optimism build-containers --force-rebuild + +# If errors are thrown during build, old images used by this stack would have to be deleted ``` Note: this will take >10 mins depending on the specs of your machine, and **requires** 16GB of memory or greater. diff --git a/app/data/stacks/mobymask-v2/mobymask-only.md b/app/data/stacks/mobymask-v2/mobymask-only.md index b45bfc8e..ef18d835 100644 --- a/app/data/stacks/mobymask-v2/mobymask-only.md +++ b/app/data/stacks/mobymask-v2/mobymask-only.md @@ -60,6 +60,9 @@ Create and update an env file to be used in the next step ([defaults](../../conf # (Optional) Set of multiaddrs to be avoided while dialling CERC_DENY_MULTIADDRS=[] + # (Optional) Type of pubsub to be used + CERC_PUBSUB="" + # Set to false for disabling watcher peer to send txs to L2 CERC_ENABLE_PEER_L2_TXS=true @@ -119,4 +122,8 @@ docker volume ls -q --filter "name=mobymask_v2" # Remove all the listed volumes docker volume rm $(docker volume ls -q --filter "name=mobymask_v2") + +# WARNING: To avoid changing peer ids for the watcher, `peers_ids` volume can be persisted +# To delete all volumes except for `peers_ids` +docker volume rm $(docker volume ls -q --filter "name=mobymask_v2" | grep -v "peers_ids$") ``` diff --git a/app/data/stacks/mobymask-v2/stack.yml b/app/data/stacks/mobymask-v2/stack.yml index 80db392e..4344d54f 100644 --- a/app/data/stacks/mobymask-v2/stack.yml +++ b/app/data/stacks/mobymask-v2/stack.yml @@ -6,8 +6,8 @@ repos: - github.com/dboreham/foundry - github.com/ethereum-optimism/optimism@v1.0.4 - github.com/ethereum-optimism/op-geth@v1.101105.2 - - github.com/cerc-io/watcher-ts@v0.2.55 - - github.com/cerc-io/mobymask-v2-watcher-ts@v0.1.2 + - github.com/cerc-io/watcher-ts@v0.2.56 + - github.com/cerc-io/mobymask-v2-watcher-ts@v0.1.3 - github.com/cerc-io/MobyMask@v0.1.3 - github.com/cerc-io/mobymask-ui containers: diff --git a/app/data/stacks/mobymask-v2/web-apps.md b/app/data/stacks/mobymask-v2/web-apps.md index 1f231cfe..0ea62769 100644 --- a/app/data/stacks/mobymask-v2/web-apps.md +++ b/app/data/stacks/mobymask-v2/web-apps.md @@ -45,6 +45,9 @@ Create and update an env file to be used in the next step ([defaults](../../conf # L2 Chain ID used by mobymask web-app for L2 txs CERC_CHAIN_ID=42069 + + # (Optional) Type of pubsub to be used ("floodsub" | "gossipsub") + CERC_PUBSUB="" ``` * NOTE: If watcher is running on the host machine, use `host.docker.internal` as the hostname to access the host port