Rename to mobymask-watcher (#139)

This commit is contained in:
nikugogoi 2022-07-07 11:50:32 +05:30 committed by GitHub
parent 4b256016da
commit bd3113069a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
55 changed files with 20 additions and 25 deletions

View File

@ -1,4 +1,4 @@
# moby-mask-watcher # mobymask-watcher
## Setup ## Setup
@ -18,7 +18,7 @@
```bash ```bash
sudo su - postgres sudo su - postgres
createdb moby-mask-watcher createdb mobymask-watcher
``` ```
* If the watcher is an `active` watcher: * If the watcher is an `active` watcher:
@ -26,19 +26,19 @@
Create database for the job queue and enable the `pgcrypto` extension on them (https://github.com/timgit/pg-boss/blob/master/docs/usage.md#intro): Create database for the job queue and enable the `pgcrypto` extension on them (https://github.com/timgit/pg-boss/blob/master/docs/usage.md#intro):
``` ```
createdb moby-mask-watcher-job-queue createdb mobymask-watcher-job-queue
``` ```
``` ```
postgres@tesla:~$ psql -U postgres -h localhost moby-mask-watcher-job-queue postgres@tesla:~$ psql -U postgres -h localhost mobymask-watcher-job-queue
Password for user postgres: Password for user postgres:
psql (12.7 (Ubuntu 12.7-1.pgdg18.04+1)) psql (12.7 (Ubuntu 12.7-1.pgdg18.04+1))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off) SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help. Type "help" for help.
moby-mask-watcher-job-queue=# CREATE EXTENSION pgcrypto; mobymask-watcher-job-queue=# CREATE EXTENSION pgcrypto;
CREATE EXTENSION CREATE EXTENSION
moby-mask-watcher-job-queue=# exit mobymask-watcher-job-queue=# exit
``` ```
* In the [config file](./environments/local.toml): * In the [config file](./environments/local.toml):

View File

@ -51,30 +51,30 @@
sudo su - postgres sudo su - postgres
# If database already exists # If database already exists
# dropdb moby-mask-watcher # dropdb mobymask-watcher
createdb moby-mask-watcher createdb mobymask-watcher
``` ```
* Create database for the job queue and enable the `pgcrypto` extension on them (https://github.com/timgit/pg-boss/blob/master/docs/usage.md#intro): * Create database for the job queue and enable the `pgcrypto` extension on them (https://github.com/timgit/pg-boss/blob/master/docs/usage.md#intro):
```bash ```bash
# If database already exists # If database already exists
# dropdb moby-mask-watcher-job-queue # dropdb mobymask-watcher-job-queue
createdb moby-mask-watcher-job-queue createdb mobymask-watcher-job-queue
``` ```
``` ```
postgres@tesla:~$ psql -U postgres -h localhost moby-mask-watcher-job-queue postgres@tesla:~$ psql -U postgres -h localhost mobymask-watcher-job-queue
Password for user postgres: Password for user postgres:
psql (12.7 (Ubuntu 12.7-1.pgdg18.04+1)) psql (12.7 (Ubuntu 12.7-1.pgdg18.04+1))
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off) SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help. Type "help" for help.
moby-mask-watcher-job-queue=# CREATE EXTENSION pgcrypto; mobymask-watcher-job-queue=# CREATE EXTENSION pgcrypto;
CREATE EXTENSION CREATE EXTENSION
moby-mask-watcher-job-queue=# exit mobymask-watcher-job-queue=# exit
``` ```
* In the [config file](./environments/local.toml) update the `database` connection settings. * In the [config file](./environments/local.toml) update the `database` connection settings.
@ -86,7 +86,7 @@
yarn && yarn build yarn && yarn build
``` ```
* Change directory to `packages/moby-mask-watcher/` and run the watcher: * Change directory to `packages/mobymask-watcher/` and run the watcher:
```bash ```bash
yarn server yarn server
@ -217,7 +217,7 @@
* The events should be visible in the subscription at GQL endpoint. Note down the event blockHash from result. * The events should be visible in the subscription at GQL endpoint. Note down the event blockHash from result.
* The isMember and isPhisher lists should be indexed. Check the database (moby-mask-watcher) tables `is_phisher` and `is_member`, there should be entries at the event blockHash and the value should be true. The data is indexed in `handleEvent` method in the [hooks file](./src/hooks.ts). * The isMember and isPhisher lists should be indexed. Check the database (mobymask-watcher) tables `is_phisher` and `is_member`, there should be entries at the event blockHash and the value should be true. The data is indexed in `handleEvent` method in the [hooks file](./src/hooks.ts).
* Update the the previous query with event blockHash and check isPhisher and isMember in GraphQL playground * Update the the previous query with event blockHash and check isPhisher and isMember in GraphQL playground

View File

@ -16,7 +16,7 @@
type = "postgres" type = "postgres"
host = "localhost" host = "localhost"
port = 5432 port = 5432
database = "moby-mask-watcher" database = "mobymask-watcher"
username = "postgres" username = "postgres"
password = "postgres" password = "postgres"
synchronize = true synchronize = true
@ -26,7 +26,7 @@
[upstream.ethServer] [upstream.ethServer]
gqlApiEndpoint = "http://127.0.0.1:8082/graphql" gqlApiEndpoint = "http://127.0.0.1:8082/graphql"
rpcProviderEndpoint = "http://127.0.0.1:8081" rpcProviderEndpoint = "http://127.0.0.1:8081"
blockDelayInMilliSecs = 2000 blockDelayInMilliSecs = 60000
[upstream.cache] [upstream.cache]
name = "requests" name = "requests"
@ -34,7 +34,7 @@
deleteOnStart = false deleteOnStart = false
[jobQueue] [jobQueue]
dbConnectionString = "postgres://postgres:postgres@localhost/moby-mask-watcher-job-queue" dbConnectionString = "postgres://postgres:postgres@localhost/mobymask-watcher-job-queue"
maxCompletionLagInSecs = 300 maxCompletionLagInSecs = 300
jobDelayInMilliSecs = 100 jobDelayInMilliSecs = 100
eventsInBatch = 50 eventsInBatch = 50

View File

@ -1,7 +1,7 @@
{ {
"name": "@vulcanize/moby-mask-watcher", "name": "@vulcanize/mobymask-watcher",
"version": "0.1.0", "version": "0.1.0",
"description": "moby-mask-watcher", "description": "mobymask-watcher",
"private": true, "private": true,
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {

View File

@ -103,11 +103,6 @@ export const createResolvers = async (indexer: Indexer, eventWatcher: EventWatch
eventsInRange: async (_: any, { fromBlockNumber, toBlockNumber }: { fromBlockNumber: number, toBlockNumber: number }) => { eventsInRange: async (_: any, { fromBlockNumber, toBlockNumber }: { fromBlockNumber: number, toBlockNumber: number }) => {
log('eventsInRange', fromBlockNumber, toBlockNumber); log('eventsInRange', fromBlockNumber, toBlockNumber);
const { expected, actual } = await indexer.getProcessedBlockCountForRange(fromBlockNumber, toBlockNumber);
if (expected !== actual) {
throw new Error(`Range not available, expected ${expected}, got ${actual} blocks in range`);
}
const events = await indexer.getEventsInRange(fromBlockNumber, toBlockNumber); const events = await indexer.getEventsInRange(fromBlockNumber, toBlockNumber);
return events.map(event => indexer.getResultEvent(event)); return events.map(event => indexer.getResultEvent(event));
}, },