Skip to content

Commit

Permalink
Add MobyMask contract deployment and watcher services
Browse files Browse the repository at this point in the history
  • Loading branch information
prathamesh0 committed Sep 29, 2023
1 parent 27e334c commit 59f6059
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 24 deletions.
8 changes: 5 additions & 3 deletions app/data/compose/docker-compose-watcher-mobymask-v3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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
Expand Down
37 changes: 20 additions & 17 deletions app/data/config/watcher-mobymask-v3/start-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}}"
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
18 changes: 15 additions & 3 deletions app/data/config/watcher-mobymask-v3/watcher-config-template.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
Expand Down Expand Up @@ -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"
Expand All @@ -101,3 +112,4 @@
maxCompletionLagInSecs = 300
jobDelayInMilliSecs = 100
eventsInBatch = 50
blockDelayInMilliSecs = 60000
9 changes: 9 additions & 0 deletions app/data/stacks/fixturenet-payments/stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
- github.com/cerc-io/[email protected] # TODO: Update
- github.com/cerc-io/[email protected]
containers:
# fixturenet images
- cerc/go-ethereum
Expand All @@ -22,10 +26,15 @@ 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
- ipld-eth-db
- nitro-contracts
- go-nitro
- nitro-reverse-payment-proxy
- watcher-mobymask-v3
2 changes: 1 addition & 1 deletion app/data/stacks/mobymask-v3/stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: mobymask-v3
repos:
- github.com/cerc-io/ts-nitro
- github.com/cerc-io/[email protected]
- github.com/cerc-io/mobymask-v2-watcher-ts@v3
- github.com/cerc-io/mobymask-v2-watcher-ts@v0.2.0
- github.com/cerc-io/[email protected]
- github.com/cerc-io/mobymask-ui
containers:
Expand Down

0 comments on commit 59f6059

Please sign in to comment.