From 59f60599c192dd5618875446728b0a8d5a8bcc78 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Fri, 29 Sep 2023 16:54:31 +0530 Subject: [PATCH] Add MobyMask contract deployment and watcher services --- .../docker-compose-watcher-mobymask-v3.yml | 8 ++-- .../watcher-mobymask-v3/start-server.sh | 37 ++++++++++--------- .../watcher-config-template.toml | 18 +++++++-- app/data/stacks/fixturenet-payments/stack.yml | 9 +++++ app/data/stacks/mobymask-v3/stack.yml | 2 +- 5 files changed, 50 insertions(+), 24 deletions(-) diff --git a/app/data/compose/docker-compose-watcher-mobymask-v3.yml b/app/data/compose/docker-compose-watcher-mobymask-v3.yml index 4749e553..f5dfdf8f 100644 --- a/app/data/compose/docker-compose-watcher-mobymask-v3.yml +++ b/app/data/compose/docker-compose-watcher-mobymask-v3.yml @@ -71,9 +71,8 @@ services: - ../config/watcher-mobymask-v3/mobymask-params.env environment: CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG} - CERC_L2_GETH_RPC: ${CERC_L2_GETH_RPC} - CERC_L1_ACCOUNTS_CSV_URL: ${CERC_L1_ACCOUNTS_CSV_URL} - CERC_PRIVATE_KEY_DEPLOYER: ${CERC_PRIVATE_KEY_DEPLOYER} + CERC_ETH_RPC_QUERY_ENDPOINT: ${CERC_ETH_RPC_QUERY_ENDPOINT} + CERC_ETH_RPC_MUTATION_ENDPOINT: ${CERC_ETH_RPC_MUTATION_ENDPOINT} CERC_RELAY_PEERS: ${CERC_RELAY_PEERS} CERC_DENY_MULTIADDRS: ${CERC_DENY_MULTIADDRS} CERC_PUBSUB: ${CERC_PUBSUB} @@ -86,6 +85,9 @@ services: CERC_PRIVATE_KEY_PEER: ${CERC_PRIVATE_KEY_PEER} CERC_PRIVATE_KEY_NITRO: ${CERC_PRIVATE_KEY_NITRO} CERC_PEER_ID: ${CERC_PEER_ID} + CERC_UPSTREAM_NITRO_ADDRESS: ${CERC_UPSTREAM_NITRO_ADDRESS} + CERC_UPSTREAM_NITRO_MULTIADDR: ${CERC_UPSTREAM_NITRO_MULTIADDR} + CERC_UPSTREAM_NITRO_PAY_AMOUNT: ${CERC_UPSTREAM_NITRO_PAY_AMOUNT} command: ["bash", "./start-server.sh"] volumes: - ../config/watcher-mobymask-v3/watcher-config-template.toml:/app/environments/watcher-config-template.toml diff --git a/app/data/config/watcher-mobymask-v3/start-server.sh b/app/data/config/watcher-mobymask-v3/start-server.sh index 12bcd1c8..242d3a51 100755 --- a/app/data/config/watcher-mobymask-v3/start-server.sh +++ b/app/data/config/watcher-mobymask-v3/start-server.sh @@ -5,8 +5,6 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then set -x fi -CERC_L2_GETH_RPC="${CERC_L2_GETH_RPC:-${DEFAULT_CERC_L2_GETH_RPC}}" - 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}}" @@ -16,7 +14,8 @@ CERC_DEPLOYED_CONTRACT="${CERC_DEPLOYED_CONTRACT:-${DEFAULT_CERC_DEPLOYED_CONTRA watcher_keys_dir="./keys" -echo "Using L2 RPC endpoint ${CERC_L2_GETH_RPC}" +echo "Using RPC query endpoint ${CERC_ETH_RPC_QUERY_ENDPOINT}" +echo "Using RPC mutation endpoint ${CERC_ETH_RPC_MUTATION_ENDPOINT}" # Use public domain for relay multiaddr in peer config if specified # Otherwise, use the docker container's host IP @@ -125,20 +124,24 @@ fi 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_PEER_ID_FILE|${PEER_ID_FILE}|g; \ - s/REPLACE_WITH_CERC_ENABLE_PEER_L2_TXS/${CERC_ENABLE_PEER_L2_TXS}/g; \ - s/REPLACE_WITH_CERC_PRIVATE_KEY_PEER/${CERC_PRIVATE_KEY_PEER}/g; \ - s/REPLACE_WITH_CERC_PRIVATE_KEY_NITRO/${CERC_PRIVATE_KEY_NITRO}/g; \ - s/REPLACE_WITH_CONTRACT_ADDRESS/${CONTRACT_ADDRESS}/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_L2_GETH_RPC_ENDPOINT|${CERC_L2_GETH_RPC}| ") + 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_PEER_ID_FILE|${PEER_ID_FILE}|g; \ + s/REPLACE_WITH_CERC_ENABLE_PEER_L2_TXS/${CERC_ENABLE_PEER_L2_TXS}/g; \ + s/REPLACE_WITH_CERC_PRIVATE_KEY_PEER/${CERC_PRIVATE_KEY_PEER}/g; \ + s/REPLACE_WITH_CERC_PRIVATE_KEY_NITRO/${CERC_PRIVATE_KEY_NITRO}/g; \ + s/REPLACE_WITH_CONTRACT_ADDRESS/${CONTRACT_ADDRESS}/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_CERC_UPSTREAM_NITRO_ADDRESS/${CERC_UPSTREAM_NITRO_ADDRESS}/g; \ + s|REPLACE_WITH_CERC_UPSTREAM_NITRO_MULTIADDR|${CERC_UPSTREAM_NITRO_MULTIADDR}|g; \ + s/REPLACE_WITH_CERC_UPSTREAM_NITRO_PAY_AMOUNT/${CERC_UPSTREAM_NITRO_PAY_AMOUNT}/ ") # Write the modified content to a new file echo "$WATCHER_CONFIG" > environments/local.toml diff --git a/app/data/config/watcher-mobymask-v3/watcher-config-template.toml b/app/data/config/watcher-mobymask-v3/watcher-config-template.toml index dbf5b407..d786fb27 100644 --- a/app/data/config/watcher-mobymask-v3/watcher-config-template.toml +++ b/app/data/config/watcher-mobymask-v3/watcher-config-template.toml @@ -19,6 +19,9 @@ # 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 @@ -41,6 +44,9 @@ pubsub = 'REPLACE_WITH_CERC_PUBSUB' enableDebugInfo = true enableL2Txs = REPLACE_WITH_CERC_ENABLE_PEER_L2_TXS + pingInterval = 4000 + pingTimeout = 1500 + maxRelayConnections = 10 [server.p2p.peer.l2TxsConfig] privateKey = 'REPLACE_WITH_CERC_PRIVATE_KEY_PEER' @@ -87,9 +93,14 @@ [upstream] [upstream.ethServer] - gqlApiEndpoint = "http://ipld-eth-server:8083/graphql" - rpcProviderEndpoint = "REPLACE_WITH_CERC_L2_GETH_RPC_ENDPOINT" - blockDelayInMilliSecs = 60000 + gqlApiEndpoint = 'http://ipld-eth-server:8083/graphql' + rpcProviderEndpoint = 'REPLACE_WITH_CERC_ETH_RPC_QUERY_ENDPOINT' + rpcProviderMutationEndpoint = 'REPLACE_WITH_CERC_ETH_RPC_MUTATION_ENDPOINT' + + [upstream.ethServer.rpcProviderNitroNode] + address = 'REPLACE_WITH_CERC_UPSTREAM_NITRO_ADDRESS' + multiAddr = 'REPLACE_WITH_CERC_UPSTREAM_NITRO_MULTIADDR' + amount = 'REPLACE_WITH_CERC_UPSTREAM_NITRO_PAY_AMOUNT' [upstream.cache] name = "requests" @@ -101,3 +112,4 @@ maxCompletionLagInSecs = 300 jobDelayInMilliSecs = 100 eventsInBatch = 50 + blockDelayInMilliSecs = 60000 diff --git a/app/data/stacks/fixturenet-payments/stack.yml b/app/data/stacks/fixturenet-payments/stack.yml index 7163f209..2984aafe 100644 --- a/app/data/stacks/fixturenet-payments/stack.yml +++ b/app/data/stacks/fixturenet-payments/stack.yml @@ -10,6 +10,10 @@ repos: # nitro repos - github.com/cerc-io/ts-nitro - github.com/cerc-io/go-nitro@pm-disable-compression + # mobymask watcher repos + - github.com/cerc-io/watcher-ts@v0.2.61 + - github.com/cerc-io/mobymask-v2-watcher-ts@v0.2.0 # TODO: Update + - github.com/cerc-io/MobyMask@v0.1.3 containers: # fixturenet images - cerc/go-ethereum @@ -22,6 +26,10 @@ containers: - cerc/ipld-eth-server - cerc/nitro-contracts - cerc/go-nitro + # mobymask watcher images + - cerc/watcher-ts + - cerc/watcher-mobymask-v3 + - cerc/mobymask pods: - fixturenet-eth - ipld-eth-server @@ -29,3 +37,4 @@ pods: - nitro-contracts - go-nitro - nitro-reverse-payment-proxy + - watcher-mobymask-v3 diff --git a/app/data/stacks/mobymask-v3/stack.yml b/app/data/stacks/mobymask-v3/stack.yml index 52ce9a61..57975d71 100644 --- a/app/data/stacks/mobymask-v3/stack.yml +++ b/app/data/stacks/mobymask-v3/stack.yml @@ -4,7 +4,7 @@ name: mobymask-v3 repos: - github.com/cerc-io/ts-nitro - github.com/cerc-io/watcher-ts@v0.2.57 - - github.com/cerc-io/mobymask-v2-watcher-ts@v3 + - github.com/cerc-io/mobymask-v2-watcher-ts@v0.2.0 - github.com/cerc-io/MobyMask@v0.1.3 - github.com/cerc-io/mobymask-ui containers: