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: environment:
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG} CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
ENV: "PROD" ENV: "PROD"
CERC_ETH_RPC_ENDPOINT: ${CERC_ETH_RPC_ENDPOINT:-http://fixturenet-eth-geth-1:8545} CERC_ETH_RPC_ENDPOINT: ${CERC_ETH_RPC_ENDPOINT}
CERC_L1_ACCOUNTS_CSV_URL: ${CERC_L1_ACCOUNTS_CSV_URL}
CERC_PRIVATE_KEY_DEPLOYER: ${CERC_PRIVATE_KEY_DEPLOYER} CERC_PRIVATE_KEY_DEPLOYER: ${CERC_PRIVATE_KEY_DEPLOYER}
CERC_MOBYMASK_APP_BASE_URI: ${CERC_MOBYMASK_APP_BASE_URI} CERC_MOBYMASK_APP_BASE_URI: ${CERC_MOBYMASK_APP_BASE_URI}
CERC_DEPLOYED_CONTRACT: ${CERC_DEPLOYED_CONTRACT} CERC_DEPLOYED_CONTRACT: ${CERC_DEPLOYED_CONTRACT}
command: ["sh", "deploy-and-generate-invite.sh"] command: ["bash", "-c", "./deploy-and-generate-invite.sh"]
volumes: volumes:
- ../config/watcher-mobymask-v3/deploy-and-generate-invite.sh:/app/packages/server/deploy-and-generate-invite.sh - ../config/watcher-mobymask-v3/deploy-and-generate-invite.sh:/app/packages/server/deploy-and-generate-invite.sh
- mobymask_deployment:/app/packages/server - mobymask_deployment:/app/packages/server
@ -67,6 +66,8 @@ services:
condition: service_completed_successfully condition: service_completed_successfully
mobymask: mobymask:
condition: service_completed_successfully condition: service_completed_successfully
nitro-contracts:
condition: service_completed_successfully
env_file: env_file:
- ../config/watcher-mobymask-v3/mobymask-params.env - ../config/watcher-mobymask-v3/mobymask-params.env
environment: environment:

View File

@ -1,9 +1,11 @@
#!/bin/sh #!/bin/bash
set -e set -e
if [ -n "$CERC_SCRIPT_DEBUG" ]; then if [ -n "$CERC_SCRIPT_DEBUG" ]; then
set -x set -x
fi 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_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}}" CERC_DEPLOYED_CONTRACT="${CERC_DEPLOYED_CONTRACT:-${DEFAULT_CERC_DEPLOYED_CONTRACT}}"
@ -42,19 +44,7 @@ while true; do
fi fi
done done
if [ -n "$CERC_L1_ACCOUNTS_CSV_URL" ] && \ echo "Using CERC_PRIVATE_KEY_DEPLOYER from env"
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
# Create the required JSON and write it to a file # Create the required JSON and write it to a file
secrets_file="secrets.json" secrets_file="secrets.json"

View File

@ -1,5 +1,14 @@
# Defaults # 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 # Set of relay peers to connect to from the relay node
DEFAULT_CERC_RELAY_PEERS=[] DEFAULT_CERC_RELAY_PEERS=[]
@ -31,7 +40,9 @@ DEFAULT_CERC_PUBSUB=""
# Set of direct peers to be used when pubsub is set to gossipsub # Set of direct peers to be used when pubsub is set to gossipsub
DEFAULT_CERC_GOSSIPSUB_DIRECT_PEERS=[] DEFAULT_CERC_GOSSIPSUB_DIRECT_PEERS=[]
# Set deployed Nitro addresses to avoid deploying them in the stack # Nitro node details (nitro address + multiaddr) of upstream ETH server
DEFAULT_CERC_NA_ADDRESS= DEFAULT_CERC_UPSTREAM_NITRO_ADDRESS=""
DEFAULT_CERC_VPA_ADDRESS= DEFAULT_CERC_UPSTREAM_NITRO_MULTIADDR=""
DEFAULT_CERC_CA_ADDRESS=
# 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 set -x
fi 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_RELAY_PEERS="${CERC_RELAY_PEERS:-${DEFAULT_CERC_RELAY_PEERS}}"
CERC_DENY_MULTIADDRS="${CERC_DENY_MULTIADDRS:-${DEFAULT_CERC_DENY_MULTIADDRS}}" CERC_DENY_MULTIADDRS="${CERC_DENY_MULTIADDRS:-${DEFAULT_CERC_DENY_MULTIADDRS}}"
CERC_PUBSUB="${CERC_PUBSUB:-${DEFAULT_CERC_PUBSUB}}" 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_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_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" watcher_keys_dir="./keys"
echo "Using RPC query endpoint ${CERC_ETH_RPC_QUERY_ENDPOINT}" echo "Using RPC query endpoint ${CERC_ETH_RPC_QUERY_ENDPOINT}"