Skip to content

Commit

Permalink
Rename to mobymask-watcher (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikugogoi committed Jul 7, 2022
1 parent 4b25601 commit bd31130
Show file tree
Hide file tree
Showing 55 changed files with 20 additions and 25 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# moby-mask-watcher
# mobymask-watcher

## Setup

Expand All @@ -18,27 +18,27 @@

```bash
sudo su - postgres
createdb moby-mask-watcher
createdb mobymask-watcher
```

* If the watcher is an `active` 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):

```
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:
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)
Type "help" for help.
moby-mask-watcher-job-queue=# CREATE EXTENSION pgcrypto;
mobymask-watcher-job-queue=# CREATE EXTENSION pgcrypto;
CREATE EXTENSION
moby-mask-watcher-job-queue=# exit
mobymask-watcher-job-queue=# exit
```

* In the [config file](./environments/local.toml):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,30 +51,30 @@
sudo su - postgres

# 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):

```bash
# 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:
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)
Type "help" for help.
moby-mask-watcher-job-queue=# CREATE EXTENSION pgcrypto;
mobymask-watcher-job-queue=# CREATE EXTENSION pgcrypto;
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.
Expand All @@ -86,7 +86,7 @@
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
yarn server
Expand Down Expand Up @@ -217,7 +217,7 @@

* 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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
type = "postgres"
host = "localhost"
port = 5432
database = "moby-mask-watcher"
database = "mobymask-watcher"
username = "postgres"
password = "postgres"
synchronize = true
Expand All @@ -26,15 +26,15 @@
[upstream.ethServer]
gqlApiEndpoint = "http://127.0.0.1:8082/graphql"
rpcProviderEndpoint = "http://127.0.0.1:8081"
blockDelayInMilliSecs = 2000
blockDelayInMilliSecs = 60000

[upstream.cache]
name = "requests"
enabled = false
deleteOnStart = false

[jobQueue]
dbConnectionString = "postgres://postgres:postgres@localhost/moby-mask-watcher-job-queue"
dbConnectionString = "postgres://postgres:postgres@localhost/mobymask-watcher-job-queue"
maxCompletionLagInSecs = 300
jobDelayInMilliSecs = 100
eventsInBatch = 50
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@vulcanize/moby-mask-watcher",
"name": "@vulcanize/mobymask-watcher",
"version": "0.1.0",
"description": "moby-mask-watcher",
"description": "mobymask-watcher",
"private": true,
"main": "dist/index.js",
"scripts": {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@ export const createResolvers = async (indexer: Indexer, eventWatcher: EventWatch
eventsInRange: async (_: any, { fromBlockNumber, toBlockNumber }: { fromBlockNumber: number, toBlockNumber: number }) => {
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);
return events.map(event => indexer.getResultEvent(event));
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit bd31130

Please sign in to comment.