From d43d36cc407b061f1d0c6ac25871914a31dbd84b Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Mon, 2 Oct 2023 12:02:28 +0530 Subject: [PATCH] Fixes for contract deployment and watcher scripts --- .../docker-compose-watcher-mobymask-v3.yml | 7 ++++--- .../deploy-and-generate-invite.sh | 18 ++++-------------- .../watcher-mobymask-v3/mobymask-params.env | 19 +++++++++++++++---- .../watcher-mobymask-v3/start-server.sh | 6 ++++++ 4 files changed, 29 insertions(+), 21 deletions(-) diff --git a/app/data/compose/docker-compose-watcher-mobymask-v3.yml b/app/data/compose/docker-compose-watcher-mobymask-v3.yml index f5dfdf8f..7c4f6feb 100644 --- a/app/data/compose/docker-compose-watcher-mobymask-v3.yml +++ b/app/data/compose/docker-compose-watcher-mobymask-v3.yml @@ -32,12 +32,11 @@ services: environment: CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG} ENV: "PROD" - CERC_ETH_RPC_ENDPOINT: ${CERC_ETH_RPC_ENDPOINT:-http://fixturenet-eth-geth-1:8545} - CERC_L1_ACCOUNTS_CSV_URL: ${CERC_L1_ACCOUNTS_CSV_URL} + CERC_ETH_RPC_ENDPOINT: ${CERC_ETH_RPC_ENDPOINT} CERC_PRIVATE_KEY_DEPLOYER: ${CERC_PRIVATE_KEY_DEPLOYER} CERC_MOBYMASK_APP_BASE_URI: ${CERC_MOBYMASK_APP_BASE_URI} CERC_DEPLOYED_CONTRACT: ${CERC_DEPLOYED_CONTRACT} - command: ["sh", "deploy-and-generate-invite.sh"] + command: ["bash", "-c", "./deploy-and-generate-invite.sh"] volumes: - ../config/watcher-mobymask-v3/deploy-and-generate-invite.sh:/app/packages/server/deploy-and-generate-invite.sh - mobymask_deployment:/app/packages/server @@ -67,6 +66,8 @@ services: condition: service_completed_successfully mobymask: condition: service_completed_successfully + nitro-contracts: + condition: service_completed_successfully env_file: - ../config/watcher-mobymask-v3/mobymask-params.env environment: diff --git a/app/data/config/watcher-mobymask-v3/deploy-and-generate-invite.sh b/app/data/config/watcher-mobymask-v3/deploy-and-generate-invite.sh index ab6ca5f3..7ac5fd9a 100755 --- a/app/data/config/watcher-mobymask-v3/deploy-and-generate-invite.sh +++ b/app/data/config/watcher-mobymask-v3/deploy-and-generate-invite.sh @@ -1,9 +1,11 @@ -#!/bin/sh +#!/bin/bash + set -e if [ -n "$CERC_SCRIPT_DEBUG" ]; then set -x fi +CERC_ETH_RPC_ENDPOINT="${CERC_ETH_RPC_ENDPOINT:-${DEFAULT_CERC_ETH_RPC_ENDPOINT}}" CERC_MOBYMASK_APP_BASE_URI="${CERC_MOBYMASK_APP_BASE_URI:-${DEFAULT_CERC_MOBYMASK_APP_BASE_URI}}" CERC_DEPLOYED_CONTRACT="${CERC_DEPLOYED_CONTRACT:-${DEFAULT_CERC_DEPLOYED_CONTRACT}}" @@ -42,19 +44,7 @@ while true; do fi done -if [ -n "$CERC_L1_ACCOUNTS_CSV_URL" ] && \ - l1_accounts_response=$(curl -L --write-out '%{http_code}' --silent --output /dev/null "$CERC_L1_ACCOUNTS_CSV_URL") && \ - [ "$l1_accounts_response" -eq 200 ]; -then - echo "Fetching L1 account credentials using provided URL" - mkdir -p /geth-accounts - wget -O /geth-accounts/accounts.csv "$CERC_L1_ACCOUNTS_CSV_URL" - - # Read the private key of an L1 account to deploy contract - CERC_PRIVATE_KEY_DEPLOYER=$(head -n 1 /geth-accounts/accounts.csv | cut -d ',' -f 3) -else - echo "Couldn't fetch L1 account credentials, using CERC_PRIVATE_KEY_DEPLOYER from env" -fi +echo "Using CERC_PRIVATE_KEY_DEPLOYER from env" # Create the required JSON and write it to a file secrets_file="secrets.json" diff --git a/app/data/config/watcher-mobymask-v3/mobymask-params.env b/app/data/config/watcher-mobymask-v3/mobymask-params.env index 88b83942..7b4a0c81 100644 --- a/app/data/config/watcher-mobymask-v3/mobymask-params.env +++ b/app/data/config/watcher-mobymask-v3/mobymask-params.env @@ -1,5 +1,14 @@ # Defaults +# ETH RPC endpoint used for contract(s) deployment +DEFAULT_CERC_ETH_RPC_ENDPOINT="http://fixturenet-eth-geth-1:8545" + +# ETH RPC endpoint used for queries in the watcher +DEFAULT_CERC_ETH_RPC_QUERY_ENDPOINT="http://nitro-reverse-payment-proxy:8081" + +# ETH RPC endpoint used for mutations in the watcher +DEFAULT_CERC_ETH_RPC_MUTATION_ENDPOINT="http://fixturenet-eth-geth-1:8545" + # Set of relay peers to connect to from the relay node DEFAULT_CERC_RELAY_PEERS=[] @@ -31,7 +40,9 @@ DEFAULT_CERC_PUBSUB="" # Set of direct peers to be used when pubsub is set to gossipsub DEFAULT_CERC_GOSSIPSUB_DIRECT_PEERS=[] -# Set deployed Nitro addresses to avoid deploying them in the stack -DEFAULT_CERC_NA_ADDRESS= -DEFAULT_CERC_VPA_ADDRESS= -DEFAULT_CERC_CA_ADDRESS= +# Nitro node details (nitro address + multiaddr) of upstream ETH server +DEFAULT_CERC_UPSTREAM_NITRO_ADDRESS="" +DEFAULT_CERC_UPSTREAM_NITRO_MULTIADDR="" + +# Payment amount per RPC query request to the upstream ETH server +DEFAULT_CERC_UPSTREAM_NITRO_PAY_AMOUNT="5000" diff --git a/app/data/config/watcher-mobymask-v3/start-server.sh b/app/data/config/watcher-mobymask-v3/start-server.sh index 242d3a51..98349906 100755 --- a/app/data/config/watcher-mobymask-v3/start-server.sh +++ b/app/data/config/watcher-mobymask-v3/start-server.sh @@ -5,6 +5,8 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then set -x fi +CERC_ETH_RPC_QUERY_ENDPOINT="${CERC_ETH_RPC_QUERY_ENDPOINT:-${DEFAULT_CERC_ETH_RPC_QUERY_ENDPOINT}}" +CERC_ETH_RPC_MUTATION_ENDPOINT="${CERC_ETH_RPC_MUTATION_ENDPOINT:-${DEFAULT_CERC_ETH_RPC_MUTATION_ENDPOINT}}" 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}}" @@ -12,6 +14,10 @@ CERC_RELAY_ANNOUNCE_DOMAIN="${CERC_RELAY_ANNOUNCE_DOMAIN:-${DEFAULT_CERC_RELAY_A 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}}" +CERC_UPSTREAM_NITRO_ADDRESS="${CERC_UPSTREAM_NITRO_ADDRESS:-${DEFAULT_CERC_UPSTREAM_NITRO_ADDRESS}}" +CERC_UPSTREAM_NITRO_MULTIADDR="${CERC_UPSTREAM_NITRO_MULTIADDR:-${DEFAULT_CERC_UPSTREAM_NITRO_MULTIADDR}}" +CERC_UPSTREAM_NITRO_PAY_AMOUNT="${CERC_UPSTREAM_NITRO_PAY_AMOUNT:-${DEFAULT_CERC_UPSTREAM_NITRO_PAY_AMOUNT}}" + watcher_keys_dir="./keys" echo "Using RPC query endpoint ${CERC_ETH_RPC_QUERY_ENDPOINT}"