Fixes for contract deployment and watcher scripts

This commit is contained in:
Prathamesh Musale 2023-10-02 12:02:28 +05:30
parent 59f60599c1
commit d43d36cc40
4 changed files with 29 additions and 21 deletions

View File

@ -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:

View File

@ -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"

View File

@ -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"

View File

@ -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}"