Add a pod for mobymask v3 demo watcher and add fixtures
This commit is contained in:
parent
45a0d8f930
commit
364e9147f8
@ -0,0 +1,88 @@
|
|||||||
|
version: '3.2'
|
||||||
|
|
||||||
|
services:
|
||||||
|
# Starts the PostgreSQL database for watcher
|
||||||
|
mobymask-watcher-db:
|
||||||
|
restart: unless-stopped
|
||||||
|
image: postgres:14-alpine
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER=vdbm
|
||||||
|
- POSTGRES_MULTIPLE_DATABASES=mobymask-watcher-1,mobymask-watcher-1-job-queue,mobymask-watcher-2,mobymask-watcher-2-job-queue,mobymask-watcher-3,mobymask-watcher-3-job-queue
|
||||||
|
- POSTGRES_EXTENSION=mobymask-watcher-1-job-queue:pgcrypto,mobymask-watcher-2-job-queue:pgcrypto,mobymask-watcher-3-job-queue:pgcrypto
|
||||||
|
- POSTGRES_PASSWORD=password
|
||||||
|
volumes:
|
||||||
|
- ../config/postgresql/multiple-postgressql-databases.sh:/docker-entrypoint-initdb.d/multiple-postgressql-databases.sh
|
||||||
|
- mobymask_watcher_db_data:/var/lib/postgresql/data
|
||||||
|
ports:
|
||||||
|
- "127.0.0.1:15432:5432"
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "nc", "-v", "localhost", "5432"]
|
||||||
|
interval: 20s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 15
|
||||||
|
start_period: 10s
|
||||||
|
|
||||||
|
# Deploys the MobyMask contract and generates an invite link
|
||||||
|
# Deployment is skipped if CERC_DEPLOYED_CONTRACT env is set
|
||||||
|
mobymask:
|
||||||
|
image: cerc/mobymask:local
|
||||||
|
working_dir: /app/packages/server
|
||||||
|
environment:
|
||||||
|
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||||
|
# ENV: "PROD"
|
||||||
|
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: ["bash", "-c", "./deploy-and-generate-invite.sh"]
|
||||||
|
volumes:
|
||||||
|
- ../config/watcher-mobymask-v3-demo/deploy-and-generate-invite.sh:/app/packages/server/deploy-and-generate-invite.sh
|
||||||
|
- mobymask_deployment:/app/packages/server
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
|
||||||
|
# Starts the MobyMask v3 watcher server
|
||||||
|
mobymask-watcher-1-server:
|
||||||
|
image: cerc/watcher-mobymask-v3:local
|
||||||
|
restart: unless-stopped
|
||||||
|
depends_on:
|
||||||
|
mobymask-watcher-db:
|
||||||
|
condition: service_healthy
|
||||||
|
mobymask:
|
||||||
|
condition: service_completed_successfully
|
||||||
|
nitro-contracts:
|
||||||
|
condition: service_completed_successfully
|
||||||
|
environment:
|
||||||
|
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||||
|
CERC_WATCHER_INDEX: 1
|
||||||
|
CERC_ETH_RPC_QUERY_ENDPOINT: ${CERC_ETH_RPC_QUERY_ENDPOINT}
|
||||||
|
CERC_ETH_RPC_MUTATION_ENDPOINT: ${CERC_ETH_RPC_MUTATION_ENDPOINT}
|
||||||
|
CERC_NITRO_CHAIN_URL: ${CERC_NITRO_CHAIN_URL}
|
||||||
|
command: ["bash", "./start-server.sh"]
|
||||||
|
volumes:
|
||||||
|
- ../config/watcher-mobymask-v3-demo/watcher-config-template.toml:/app/environments/watcher-config-template.toml
|
||||||
|
- ../config/watcher-mobymask-v3-demo/watcher-config-rates.toml:/app/environments/rates.toml
|
||||||
|
- ../config/watcher-mobymask-v3-demo/local/keys:/app/keys
|
||||||
|
- ../config/watcher-mobymask-v3-demo/start-server.sh:/app/start-server.sh
|
||||||
|
- watcher_nitro_data:/app/out/nitro-db
|
||||||
|
- nitro_deployment:/nitro
|
||||||
|
- mobymask_deployment:/server
|
||||||
|
# Expose GQL, metrics and relay node ports
|
||||||
|
ports:
|
||||||
|
- "3001"
|
||||||
|
- "9001"
|
||||||
|
- "9090"
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "busybox", "nc", "localhost", "9090"]
|
||||||
|
interval: 20s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 15
|
||||||
|
start_period: 5s
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
mobymask_watcher_db_data:
|
||||||
|
mobymask_deployment:
|
||||||
|
nitro_deployment:
|
||||||
|
watcher_nitro_data:
|
@ -4,6 +4,8 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
|||||||
set -x
|
set -x
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Funding accounts on L2"
|
||||||
|
|
||||||
CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
|
CERC_L1_RPC="${CERC_L1_RPC:-${DEFAULT_CERC_L1_RPC}}"
|
||||||
CERC_L1_CHAIN_ID="${CERC_L1_CHAIN_ID:-${DEFAULT_CERC_L1_CHAIN_ID}}"
|
CERC_L1_CHAIN_ID="${CERC_L1_CHAIN_ID:-${DEFAULT_CERC_L1_CHAIN_ID}}"
|
||||||
|
|
||||||
@ -24,8 +26,8 @@ DEPLOYMENT_CONTEXT="$CERC_L1_CHAIN_ID"
|
|||||||
BRIDGE=$(cat /l1-deployment/$DEPLOYMENT_CONTEXT/L1StandardBridgeProxy.json | jq -r .address)
|
BRIDGE=$(cat /l1-deployment/$DEPLOYMENT_CONTEXT/L1StandardBridgeProxy.json | jq -r .address)
|
||||||
|
|
||||||
# Send balance to bridge contract on L1
|
# Send balance to bridge contract on L1
|
||||||
cast send --from $ACCOUNT_1 --rpc-url $CERC_L1_RPC --value 1000ether $BRIDGE --private-key $ACCOUNT_1_KEY
|
cast send --from $ACCOUNT_1 --rpc-url $CERC_L1_RPC --value 10000ether $BRIDGE --private-key $ACCOUNT_1_KEY
|
||||||
cast send --from $ACCOUNT_2 --rpc-url $CERC_L1_RPC --value 1000ether $BRIDGE --private-key $ACCOUNT_2_KEY
|
cast send --from $ACCOUNT_2 --rpc-url $CERC_L1_RPC --value 10000ether $BRIDGE --private-key $ACCOUNT_2_KEY
|
||||||
|
|
||||||
echo "Following accounts have been funded; use them for transactions on L2:"
|
echo "Following accounts have been funded; use them for transactions on L2:"
|
||||||
echo "${ACCOUNT_1}"
|
echo "${ACCOUNT_1}"
|
||||||
|
@ -0,0 +1,80 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
|
# From env:
|
||||||
|
# CERC_ETH_RPC_ENDPOINT
|
||||||
|
# CERC_MOBYMASK_APP_BASE_URI
|
||||||
|
# CERC_DEPLOYED_CONTRACT
|
||||||
|
# CERC_PRIVATE_KEY_DEPLOYER
|
||||||
|
|
||||||
|
# Check if CERC_DEPLOYED_CONTRACT environment variable set to skip contract deployment
|
||||||
|
if [ -n "$CERC_DEPLOYED_CONTRACT" ]; then
|
||||||
|
echo "CERC_DEPLOYED_CONTRACT is set to '$CERC_DEPLOYED_CONTRACT'"
|
||||||
|
echo "Skipping contract deployment"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Using ETH RPC endpoint ${CERC_ETH_RPC_ENDPOINT}"
|
||||||
|
|
||||||
|
# Wait till ETH RPC endpoint is available with block number > 1
|
||||||
|
retry_interval=5
|
||||||
|
while true; do
|
||||||
|
block_number_hex=$(curl -s -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' ${CERC_ETH_RPC_ENDPOINT} | jq -r '.result')
|
||||||
|
|
||||||
|
# Check if the request call was successful
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "RPC endpoint not yet available, retrying in $retry_interval seconds..."
|
||||||
|
sleep $retry_interval
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Convert hex to decimal
|
||||||
|
block_number_dec=$(printf %u ${block_number_hex})
|
||||||
|
|
||||||
|
# Check if block number is > 1 to avoid failures in the deployment
|
||||||
|
if [ "$block_number_dec" -ge 1 ]; then
|
||||||
|
echo "RPC endpoint is up"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "RPC endpoint not yet available, retrying in $retry_interval seconds..."
|
||||||
|
sleep $retry_interval
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Using CERC_PRIVATE_KEY_DEPLOYER from env"
|
||||||
|
|
||||||
|
# Create the required JSON and write it to a file
|
||||||
|
secrets_file="secrets.json"
|
||||||
|
secrets_json=$(jq -n \
|
||||||
|
--arg privateKey "$CERC_PRIVATE_KEY_DEPLOYER" \
|
||||||
|
--arg rpcUrl "$CERC_ETH_RPC_ENDPOINT" \
|
||||||
|
--arg baseURI "$CERC_MOBYMASK_APP_BASE_URI" \
|
||||||
|
'.privateKey = $privateKey | .rpcUrl = $rpcUrl | .baseURI = $baseURI')
|
||||||
|
echo "$secrets_json" > "${secrets_file}"
|
||||||
|
|
||||||
|
export RPC_URL="${CERC_ETH_RPC_ENDPOINT}"
|
||||||
|
|
||||||
|
# Check and exit if a deployment already exists (on restarts)
|
||||||
|
if [ -f ./config.json ]; then
|
||||||
|
echo "config.json already exists, checking the contract deployment"
|
||||||
|
|
||||||
|
# Read JSON file
|
||||||
|
deployment_details=$(cat config.json)
|
||||||
|
deployed_contract=$(echo "$deployment_details" | jq -r '.address')
|
||||||
|
|
||||||
|
cd ../hardhat
|
||||||
|
if yarn verifyDeployment --network optimism --contract "${deployed_contract}"; then
|
||||||
|
echo "Deployment verfication successful"
|
||||||
|
cd ../server
|
||||||
|
else
|
||||||
|
echo "Deployment verfication failed, please clear MobyMask deployment volume before starting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
npm run deployAndGenerateInvite
|
@ -0,0 +1,7 @@
|
|||||||
|
CERC_ETH_RPC_ENDPOINT="http://op-geth:8545"
|
||||||
|
CERC_PRIVATE_KEY_DEPLOYER="0xbe4aa664815ea3bc3d63118649a733f6c96b243744310806ecb6d96359ab62cf" # L1 faucet account #4
|
||||||
|
CERC_MOBYMASK_APP_BASE_URI="http://127.0.0.1:3004/#"
|
||||||
|
|
||||||
|
CERC_ETH_RPC_QUERY_ENDPOINT="http://op-geth:8545"
|
||||||
|
CERC_ETH_RPC_MUTATION_ENDPOINT="http://op-geth:8545"
|
||||||
|
CERC_NITRO_CHAIN_URL="http://op-geth:8546"
|
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"peerId": {
|
||||||
|
"id": "12D3KooWAMjBkFCT9DtCnSDcxftxJzSuTBvzVojabv64cnEvX4AZ",
|
||||||
|
"privKey": "CAESQAKCrnY0QKTky1I18fqn+VPydXGUv1NYiV+nVKqBFkw/CAjE9sKKIDGnYAo8mivnI6dngFenERY+0Q8AJrPTaXY=",
|
||||||
|
"pubKey": "CAESIAgIxPbCiiAxp2AKPJor5yOnZ4BXpxEWPtEPACaz02l2"
|
||||||
|
},
|
||||||
|
"relayPeerId": {
|
||||||
|
"id": "12D3KooWNQJDGtH3YAZk2qG1ZbcoQvw6HaD814pfd9HHQthgX63K",
|
||||||
|
"privKey": "CAESQGc996T2OuyV3aY+hnna+GIexKBEcE6jDNX/RaofHr58uv2EYxXm4kcL2tO2tKgnPgtkegHFdjqy6h/xOA+YMZo=",
|
||||||
|
"pubKey": "CAESILr9hGMV5uJHC9rTtrSoJz4LZHoBxXY6suof8TgPmDGa"
|
||||||
|
},
|
||||||
|
"peer": {
|
||||||
|
"privateKey": "ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
|
||||||
|
"nitroPrivateKey": "2d999770f7b5d49b694080f987b82bbc9fc9ac2b4dcc10b0f8aba7d700f69c6d"
|
||||||
|
},
|
||||||
|
"consensus": {
|
||||||
|
"publicKey": "02cd17b05ca998955be5ca7bf4fd4531243d438f1aae7ce8a0ed5159f53cee5b40",
|
||||||
|
"privateKey": "67d80505614bdf61fca11cbad31d93acb2c7df1c653dc25975d77d05f05f154f"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"peerId": {
|
||||||
|
"id": "12D3KooWBNEbY3QS4y23ngupDw9PDc4bvNvRJGVRejjV9EZLjux5",
|
||||||
|
"privKey": "CAESQGSTw0ymvn8+wX9Dbvyr4/Gib1q2voe0CC0VyeClMQP6FwW14x0fpRbBIx0XhLdxWHkRndphVg3gVAHyC+7ZI8o=",
|
||||||
|
"pubKey": "CAESIBcFteMdH6UWwSMdF4S3cVh5EZ3aYVYN4FQB8gvu2SPK"
|
||||||
|
},
|
||||||
|
"relayPeerId": {
|
||||||
|
"id": "12D3KooWPpBt2coC5BKEsewogHSkdgdyY9guUHJBgJFZoh66R4UL",
|
||||||
|
"privKey": "CAESQBdoGZzpiHsE8GlIhGGP+tl6A13sIPxOhgSwsWZR4cwmz/f7627X5GQRLD41ikH6oZ7ZeSbiiPsBtelL1+t3M80=",
|
||||||
|
"pubKey": "CAESIM/3++tu1+RkESw+NYpB+qGe2Xkm4oj7AbXpS9frdzPN"
|
||||||
|
},
|
||||||
|
"peer": {
|
||||||
|
"privateKey": "59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d",
|
||||||
|
"nitroPrivateKey": "0279651921cd800ac560c21ceea27aab0107b67daf436cdd25ce84cad30159b4"
|
||||||
|
},
|
||||||
|
"consensus": {
|
||||||
|
"publicKey": "029c8035b3e9401b8f178f7c37285b5cb22501e017340e2058b3b842f2a1f0ae45",
|
||||||
|
"privateKey": "0261008e8e3ec808168e99333599da38ca59a056a2ae4510a6ad3d8b5cb0918c"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"peerId": {
|
||||||
|
"id": "12D3KooWSRH6ftgkAZsKZK7UX1Zr6Hx6YAsEepHqzopFszqfTxxi",
|
||||||
|
"privKey": "CAESQHBjlHxfVhZ2gXsBItrIEEgSGKcjMkFiGs3PPz9E3ace9qyWEkvR4oit5ve9SAROVoh20hoa42IC91NIafMaqws=",
|
||||||
|
"pubKey": "CAESIPaslhJL0eKIreb3vUgETlaIdtIaGuNiAvdTSGnzGqsL"
|
||||||
|
},
|
||||||
|
"relayPeerId": {
|
||||||
|
"id": "12D3KooWLudDC3NnS8k9xLiqTZcS9xbFNrGSttu5GPynQgNgenPW",
|
||||||
|
"privKey": "CAESQHuEXPB1hTQATlZaNRQnAfSvnfYUeLF9PjSNKp9L33K2pMl37tTBYghnfQ0yluse0zHOIXRJM+9+ARn9+jIr0gU=",
|
||||||
|
"pubKey": "CAESIKTJd+7UwWIIZ30NMpbrHtMxziF0STPvfgEZ/foyK9IF"
|
||||||
|
},
|
||||||
|
"peer": {
|
||||||
|
"privateKey": "47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a",
|
||||||
|
"nitroPrivateKey": "58368d20ff12f17669c06158c21d885897aa56f9be430edc789614bf9851d53f"
|
||||||
|
},
|
||||||
|
"consensus": {
|
||||||
|
"publicKey": "039160c244a7ad8be16a64bdb69e6dbacdcfe20b37076792a0d06032a8097468ca",
|
||||||
|
"privateKey": "8894685fe81001d75662b079905472699373967451d1255ee5fc669d0a09a9ca"
|
||||||
|
}
|
||||||
|
}
|
112
stack_orchestrator/data/config/watcher-mobymask-v3-demo/start-server.sh
Executable file
112
stack_orchestrator/data/config/watcher-mobymask-v3-demo/start-server.sh
Executable file
@ -0,0 +1,112 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||||
|
set -x
|
||||||
|
fi
|
||||||
|
|
||||||
|
watcher_keys_dir="./keys"
|
||||||
|
|
||||||
|
echo "Watcher index: ${CERC_WATCHER_INDEX}"
|
||||||
|
echo "Using RPC query endpoint ${CERC_ETH_RPC_QUERY_ENDPOINT}"
|
||||||
|
echo "Using RPC mutation endpoint ${CERC_ETH_RPC_MUTATION_ENDPOINT}"
|
||||||
|
echo "Using Nitro chain URL ${CERC_NITRO_CHAIN_URL}"
|
||||||
|
|
||||||
|
WATCHER_DB="mobymask-watcher-${CERC_WATCHER_INDEX}"
|
||||||
|
|
||||||
|
# Use the docker container's host IP for relay multiaddr in peer config
|
||||||
|
CERC_RELAY_MULTIADDR="/dns4/mobymask-watcher-${CERC_WATCHER_INDEX}-server/tcp/9090/ws/p2p/$(jq -r '.relayPeerId.id' /app/keys/watcher-${CERC_WATCHER_INDEX}.json)"
|
||||||
|
|
||||||
|
# Assign deployed contract address from server config (created by mobymask container after deploying contract)
|
||||||
|
CONTRACT_ADDRESS=$(jq -r '.address' /server/config.json | tr -d '"')
|
||||||
|
|
||||||
|
nitro_addresses_file="/nitro/nitro-addresses.json"
|
||||||
|
nitro_addresses_destination_file="./src/nitro-addresses.json"
|
||||||
|
if [ -f ${nitro_addresses_file} ]; then
|
||||||
|
echo "Using Nitro addresses from ${nitro_addresses_file}:"
|
||||||
|
cat "$nitro_addresses_file"
|
||||||
|
cat "$nitro_addresses_file" > "$nitro_addresses_destination_file"
|
||||||
|
else
|
||||||
|
echo "Nitro addresses not available"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Build after setting the Nitro addresses
|
||||||
|
yarn build
|
||||||
|
|
||||||
|
PEER_ID_FILE='./peer-id.json'
|
||||||
|
RELAY_PEER_ID_FILE='./relay-id.json'
|
||||||
|
|
||||||
|
# Create watcher party array
|
||||||
|
watcher_parties=()
|
||||||
|
|
||||||
|
# Iterate over each fixture JSON file
|
||||||
|
for watcher_keys_file in "$watcher_keys_dir"/*.json; do
|
||||||
|
# Extract the filename without the path and extension
|
||||||
|
filename=$(basename "$watcher_keys_file" .json)
|
||||||
|
|
||||||
|
# Read the consensus keys
|
||||||
|
peer_id=$(jq -r '.peerId.id' "$watcher_keys_file")
|
||||||
|
|
||||||
|
# Read the consensus keys
|
||||||
|
consensus_public_key=$(jq -r '.consensus.publicKey' "$watcher_keys_file")
|
||||||
|
consensus_private_key=$(jq -r '.consensus.privateKey' "$watcher_keys_file")
|
||||||
|
|
||||||
|
# Append watcher party
|
||||||
|
watcher_party=$(jq -n \
|
||||||
|
--arg peerId "$peer_id" \
|
||||||
|
--arg publicKey "$consensus_public_key" \
|
||||||
|
'.peerId = $peerId | .publicKey = $publicKey')
|
||||||
|
watcher_parties+=("$watcher_party")
|
||||||
|
|
||||||
|
if [ "$filename" = "watcher-${CERC_WATCHER_INDEX}" ]; then
|
||||||
|
# Export watcher peer and relay ids
|
||||||
|
peer_id_data=$(jq '.peerId' "$watcher_keys_file")
|
||||||
|
relay_peer_id_data=$(jq '.relayPeerId' "$watcher_keys_file")
|
||||||
|
echo "$peer_id_data" > "${PEER_ID_FILE}"
|
||||||
|
echo "$relay_peer_id_data" > "${RELAY_PEER_ID_FILE}"
|
||||||
|
|
||||||
|
# Set peer and nitro account keys
|
||||||
|
CERC_PRIVATE_KEY_PEER=$(jq -r '.peer.privateKey' "$watcher_keys_file")
|
||||||
|
CERC_WATCHER_NITRO_PK=$(jq -r '.peer.nitroPrivateKey' "$watcher_keys_file")
|
||||||
|
|
||||||
|
# Set consensus keys for this peer
|
||||||
|
CONSENSUS_PUBLIC_KEY=${consensus_public_key}
|
||||||
|
CONSENSUS_PRIVATE_KEY=${consensus_private_key}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Consensus module enabled"
|
||||||
|
CONSENSUS_ENABLED=true
|
||||||
|
WATCHER_PARTY_PEERS_FILE='./watcher-party-peers.json'
|
||||||
|
|
||||||
|
# Export watcher party file
|
||||||
|
watcher_parties_json=$(printf '%s\n' "${watcher_parties[@]}" | jq -s .)
|
||||||
|
echo "$watcher_parties_json" > "${WATCHER_PARTY_PEERS_FILE}"
|
||||||
|
echo "Watcher party peers exported to ${WATCHER_PARTY_PEERS_FILE}"
|
||||||
|
|
||||||
|
# TODO: Configure
|
||||||
|
CERC_RELAY_PEERS=[]
|
||||||
|
|
||||||
|
# Read in the config template TOML file and modify it
|
||||||
|
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_RELAY_MULTIADDR|${CERC_RELAY_MULTIADDR}|g; \
|
||||||
|
s/REPLACE_WITH_CERC_PRIVATE_KEY_PEER/${CERC_PRIVATE_KEY_PEER}/g; \
|
||||||
|
s/REPLACE_WITH_CERC_WATCHER_NITRO_PK/${CERC_WATCHER_NITRO_PK}/g; \
|
||||||
|
s/REPLACE_WITH_CONTRACT_ADDRESS/${CONTRACT_ADDRESS}/g; \
|
||||||
|
s|REPLACE_WITH_CERC_NITRO_CHAIN_URL|${CERC_NITRO_CHAIN_URL}|g; \
|
||||||
|
s/REPLACE_WITH_CONSENSUS_ENABLED/${CONSENSUS_ENABLED}/g; \
|
||||||
|
s/REPLACE_WITH_CONSENSUS_PUBLIC_KEY/${CONSENSUS_PUBLIC_KEY}/g; \
|
||||||
|
s/REPLACE_WITH_CONSENSUS_PRIVATE_KEY/${CONSENSUS_PRIVATE_KEY}/g; \
|
||||||
|
s|REPLACE_WITH_WATCHER_PARTY_PEERS_FILE|${WATCHER_PARTY_PEERS_FILE}|g; \
|
||||||
|
s|REPLACE_WITH_CERC_ETH_RPC_QUERY_ENDPOINT|${CERC_ETH_RPC_QUERY_ENDPOINT}|g; \
|
||||||
|
s|REPLACE_WITH_CERC_ETH_RPC_MUTATION_ENDPOINT|${CERC_ETH_RPC_MUTATION_ENDPOINT}|g; \
|
||||||
|
s|REPLACE_WITH_WATCHER_DB|${WATCHER_DB}| ")
|
||||||
|
|
||||||
|
# Write the modified content to a new file
|
||||||
|
echo "$WATCHER_CONFIG" > environments/local.toml
|
||||||
|
|
||||||
|
echo 'Running watcher server'
|
||||||
|
yarn server
|
@ -0,0 +1,14 @@
|
|||||||
|
freeQueriesLimit = 10
|
||||||
|
|
||||||
|
freeQueriesList = []
|
||||||
|
|
||||||
|
[queries]
|
||||||
|
multiNonce = '50'
|
||||||
|
_owner = '50'
|
||||||
|
isRevoked = '50'
|
||||||
|
isPhisher = '50'
|
||||||
|
isMember = '50'
|
||||||
|
|
||||||
|
[mutations]
|
||||||
|
invoke = '100'
|
||||||
|
revoke = '100'
|
@ -0,0 +1,111 @@
|
|||||||
|
[server]
|
||||||
|
host = "0.0.0.0"
|
||||||
|
port = 3001
|
||||||
|
kind = "lazy"
|
||||||
|
|
||||||
|
# Checkpointing state.
|
||||||
|
checkpointing = false
|
||||||
|
|
||||||
|
# Checkpoint interval in number of blocks.
|
||||||
|
checkpointInterval = 2000
|
||||||
|
|
||||||
|
# Enable state creation
|
||||||
|
enableState = false
|
||||||
|
|
||||||
|
# Boolean to filter logs by contract.
|
||||||
|
filterLogs = true
|
||||||
|
|
||||||
|
# Max block range for which to return events in eventsInRange GQL query.
|
||||||
|
# Use -1 for skipping check on block range.
|
||||||
|
maxEventsBlockRange = -1
|
||||||
|
|
||||||
|
# Flag to specify whether RPC endpoint supports block hash as block tag parameter
|
||||||
|
rpcSupportsBlockHashParam = true
|
||||||
|
|
||||||
|
[server.p2p]
|
||||||
|
enableRelay = true
|
||||||
|
enablePeer = true
|
||||||
|
|
||||||
|
[server.p2p.relay]
|
||||||
|
host = "0.0.0.0"
|
||||||
|
port = 9090
|
||||||
|
relayPeers = REPLACE_WITH_CERC_RELAY_PEERS
|
||||||
|
denyMultiaddrs = []
|
||||||
|
peerIdFile = './relay-id.json'
|
||||||
|
announce = ''
|
||||||
|
pubsub = ''
|
||||||
|
enableDebugInfo = true
|
||||||
|
|
||||||
|
[server.p2p.peer]
|
||||||
|
relayMultiaddr = 'REPLACE_WITH_CERC_RELAY_MULTIADDR'
|
||||||
|
pubSubTopic = 'mobymask'
|
||||||
|
denyMultiaddrs = []
|
||||||
|
peerIdFile = './peer-id.json'
|
||||||
|
pubsub = ''
|
||||||
|
enableDebugInfo = true
|
||||||
|
enableL2Txs = true
|
||||||
|
pingInterval = 4000
|
||||||
|
pingTimeout = 1500
|
||||||
|
maxRelayConnections = 10
|
||||||
|
|
||||||
|
[server.p2p.peer.l2TxsConfig]
|
||||||
|
privateKey = 'REPLACE_WITH_CERC_PRIVATE_KEY_PEER'
|
||||||
|
contractAddress = 'REPLACE_WITH_CONTRACT_ADDRESS'
|
||||||
|
|
||||||
|
[server.p2p.nitro]
|
||||||
|
chainUrl = 'REPLACE_WITH_CERC_NITRO_CHAIN_URL'
|
||||||
|
store = './out/nitro-db'
|
||||||
|
privateKey = 'REPLACE_WITH_CERC_WATCHER_NITRO_PK'
|
||||||
|
chainPrivateKey = 'REPLACE_WITH_CERC_PRIVATE_KEY_PEER'
|
||||||
|
|
||||||
|
[server.p2p.nitro.payments]
|
||||||
|
ratesFile = './environments/rates.toml'
|
||||||
|
requestTimeoutInSecs = 10
|
||||||
|
|
||||||
|
[server.p2p.nitro.payments.cache]
|
||||||
|
maxAccounts = 1000
|
||||||
|
accountTTLInSecs = 1800
|
||||||
|
maxVouchersPerAccount = 1000
|
||||||
|
voucherTTLInSecs = 300
|
||||||
|
maxPaymentChannels = 10000
|
||||||
|
paymentChannelTTLInSecs = 1800
|
||||||
|
|
||||||
|
[server.p2p.consensus]
|
||||||
|
enabled = REPLACE_WITH_CONSENSUS_ENABLED
|
||||||
|
publicKey = 'REPLACE_WITH_CONSENSUS_PUBLIC_KEY'
|
||||||
|
privateKey = 'REPLACE_WITH_CONSENSUS_PRIVATE_KEY'
|
||||||
|
watcherPartyPeersFile = 'REPLACE_WITH_WATCHER_PARTY_PEERS_FILE'
|
||||||
|
|
||||||
|
[metrics]
|
||||||
|
host = "0.0.0.0"
|
||||||
|
port = 9000
|
||||||
|
[metrics.gql]
|
||||||
|
port = 9001
|
||||||
|
|
||||||
|
[database]
|
||||||
|
type = "postgres"
|
||||||
|
host = "mobymask-watcher-db"
|
||||||
|
port = 5432
|
||||||
|
database = "REPLACE_WITH_WATCHER_DB"
|
||||||
|
username = "vdbm"
|
||||||
|
password = "password"
|
||||||
|
synchronize = true
|
||||||
|
logging = false
|
||||||
|
|
||||||
|
[upstream]
|
||||||
|
[upstream.ethServer]
|
||||||
|
gqlApiEndpoint = "http://ipld-eth-server:8083/graphql"
|
||||||
|
rpcProviderEndpoint = 'REPLACE_WITH_CERC_ETH_RPC_QUERY_ENDPOINT'
|
||||||
|
rpcProviderMutationEndpoint = 'REPLACE_WITH_CERC_ETH_RPC_MUTATION_ENDPOINT'
|
||||||
|
|
||||||
|
[upstream.cache]
|
||||||
|
name = "requests"
|
||||||
|
enabled = false
|
||||||
|
deleteOnStart = false
|
||||||
|
|
||||||
|
[jobQueue]
|
||||||
|
dbConnectionString = "postgres://vdbm:password@mobymask-watcher-db/REPLACE_WITH_WATCHER_DB-job-queue"
|
||||||
|
maxCompletionLagInSecs = 300
|
||||||
|
jobDelayInMilliSecs = 100
|
||||||
|
eventsInBatch = 50
|
||||||
|
blockDelayInMilliSecs = 60000
|
@ -42,6 +42,6 @@ pods:
|
|||||||
- fixturenet-eth
|
- fixturenet-eth
|
||||||
- fixturenet-optimism
|
- fixturenet-optimism
|
||||||
- nitro-contracts
|
- nitro-contracts
|
||||||
- watcher-mobymask-v3
|
- watcher-mobymask-v3-demo
|
||||||
- mobymask-snap
|
- mobymask-snap
|
||||||
- mobymask-app-v3
|
- mobymask-app-v3
|
||||||
|
Loading…
Reference in New Issue
Block a user