Skip to content

Commit

Permalink
fix: cleanup datafeed
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-bisonai committed Jul 17, 2024
1 parent c7a61ab commit 2202da9
Show file tree
Hide file tree
Showing 15 changed files with 2 additions and 889 deletions.
5 changes: 0 additions & 5 deletions core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
"Orakl Network",
"Blockchain",
"Web3",
"Data Feed",
"Price Feed",
"Request-Response",
"VRF",
"Verifiable Random Function",
Expand All @@ -36,13 +34,11 @@
"start:listener": "node --no-warnings --import=specifier-resolution-node/register --experimental-json-modules dist/listener/main.js",
"start:listener:vrf": "yarn start:listener --service VRF",
"start:listener:request_response": "yarn start:listener --service REQUEST_RESPONSE",
"start:listener:data_feed_l2": "yarn start:listener --service DATA_FEED_L2",
"start:listener:vrf_l2_request": "yarn start:listener --service VRF_L2_REQUEST",
"start:listener:vrf_l2_fulfill": "yarn start:listener --service VRF_L2_FULFILL",
"start:listener:rr_l2_request": "yarn start:listener --service REQUEST_RESPONSE_L2_REQUEST",
"start:listener:rr_l2_fulfill": "yarn start:listener --service REQUEST_RESPONSE_L2_FULFILL",
"start:worker": "node --no-warnings --import=specifier-resolution-node/register --experimental-json-modules dist/worker/main.js",
"start:worker:data_feed_l2": "yarn start:worker --worker DATA_FEED_L2",
"start:worker:vrf": "yarn start:worker --worker VRF",
"start:worker:vrf_l2_request": "yarn start:worker --worker VRF_L2_REQUEST",
"start:worker:vrf_l2_fulfill": "yarn start:worker --worker VRF_L2_FULFILL",
Expand All @@ -53,7 +49,6 @@
"start:reporter:vrf": "yarn start:reporter --reporter VRF",
"start:reporter:request_response": "yarn start:reporter --reporter REQUEST_RESPONSE",
"start:por": "node --no-warnings --import=specifier-resolution-node/register --experimental-json-modules dist/por/main.js",
"start:reporter:data_feed_l2": "yarn start:reporter --reporter DATA_FEED_L2",
"start:reporter:vrf_l2_request": "yarn start:reporter --reporter VRF_L2_REQUEST",
"start:reporter:vrf_l2_fulfill": "yarn start:reporter --reporter VRF_L2_FULFILL",
"start:reporter:rr_l2_request": "yarn start:reporter --reporter REQUEST_RESPONSE_L2_REQUEST",
Expand Down
54 changes: 1 addition & 53 deletions core/src/api.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import axios from 'axios'
import { Logger } from 'pino'
import { OraklError, OraklErrorCode } from './errors'
import {
CHAIN,
DATA_FEED_SERVICE_NAME,
L2_CHAIN,
L2_DATA_FEED_SERVICE_NAME,
ORAKL_NETWORK_API_URL,
} from './settings'
import { ORAKL_NETWORK_API_URL } from './settings'
import { IReporterConfig, IVrfConfig } from './types'
import { buildUrl } from './utils'

Expand Down Expand Up @@ -146,49 +140,3 @@ export async function getReporterByOracleAddress({
}
}
}

/**
* Get address of node operator given an `oracleAddress`. The data are
* fetched from the Orakl Network API.
*
* @param {string} oracle address
* @return {string} address of node operator
* @exception {OraklErrorCode.GetReporterRequestFailed} raises when request failed
*/
export async function getOperatorAddress({
oracleAddress,
logger,
}: {
oracleAddress: string
logger: Logger
}) {
logger.debug('getOperatorAddress')

return await (
await getReporterByOracleAddress({
service: DATA_FEED_SERVICE_NAME,
chain: CHAIN,
oracleAddress,
logger,
})
).address
}

export async function getOperatorAddressL2({
oracleAddress,
logger,
}: {
oracleAddress: string
logger: Logger
}) {
logger.debug('getOperatorAddressL2')

return await (
await getReporterByOracleAddress({
service: L2_DATA_FEED_SERVICE_NAME,
chain: L2_CHAIN,
oracleAddress,
logger,
})
).address
}
84 changes: 0 additions & 84 deletions core/src/listener/data-feed-L2.ts

This file was deleted.

2 changes: 0 additions & 2 deletions core/src/listener/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { buildLogger } from '../logger'
import { CHAIN, REDIS_HOST, REDIS_PORT } from '../settings'
import { hookConsoleError } from '../utils'
import { getListeners } from './api'
import { buildListener as buildL2DataFeedListener } from './data-feed-L2'
import { buildListener as buildRequestResponseListener } from './request-response'
import { buildListener as buildRequestResponseL2FulfillListener } from './request-response-L2-fulfill'
import { buildListener as buildRequestResponseL2RequestListener } from './request-response-L2-request'
Expand All @@ -20,7 +19,6 @@ import { buildListener as buildVrfL2RequestListener } from './vrf-L2-request'
const LISTENERS: IListeners = {
VRF: buildVrfListener,
REQUEST_RESPONSE: buildRequestResponseListener,
DATA_FEED_L2: buildL2DataFeedListener,
VRF_L2_REQUEST: buildVrfL2RequestListener,
VRF_L2_FULFILL: buildVrfL2FulfillListener,
REQUEST_RESPONSE_L2_REQUEST: buildRequestResponseL2RequestListener,
Expand Down
2 changes: 0 additions & 2 deletions core/src/listener/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ethers } from 'ethers'
import { Logger } from 'pino'
import type { RedisClientType } from 'redis'
import {
IDataFeedListenerWorkerL2,
IL2EndpointListenerWorker,
IL2RequestResponseFulfillListenerWorker,
IL2RequestResponseListenerWorker,
Expand Down Expand Up @@ -47,7 +46,6 @@ export type ProcessEventOutputType = {
jobData:
| IRequestResponseListenerWorker
| IVrfListenerWorker
| IDataFeedListenerWorkerL2
| IL2VrfFulfillListenerWorker
| IL2EndpointListenerWorker
| IL2RequestResponseListenerWorker
Expand Down
6 changes: 0 additions & 6 deletions core/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { parseArgs } from 'node:util'
import { buildLogger } from './logger'
import { hookConsoleError } from './utils'

import { buildListener as buildL2DataFeedListener } from './listener/data-feed-L2'
import { buildListener as buildRequestResponseListener } from './listener/request-response'
import { buildListener as buildRequestResponseL2FulfillListener } from './listener/request-response-L2-fulfill'
import { buildListener as buildRequestResponseL2RequestListener } from './listener/request-response-L2-request'
Expand All @@ -11,7 +10,6 @@ import { buildListener as buildVrfListener } from './listener/vrf'
import { buildListener as buildVrfL2FulfillListener } from './listener/vrf-L2-fulfill'
import { buildListener as buildVrfL2RequestListener } from './listener/vrf-L2-request'

import { worker as l2DataFeedWorker } from './worker/data-feed-L2'
import { worker as requestResponseWorker } from './worker/request-response'
import { worker as l2RequestResponseFulfillWorker } from './worker/request-response-L2-fulfill'
import { worker as l2RequestResponseRequestWorker } from './worker/request-response-L2-request'
Expand All @@ -25,7 +23,6 @@ import { OraklError, OraklErrorCode } from './errors'
import { launchHealthCheck } from './health-check'
import { getListeners } from './listener/api'
import { postprocessListeners } from './listener/utils'
import { buildReporter as buildL2DataFeedReporter } from './reporter/data-feed-L2'
import { buildReporter as buildRequestResponseReporter } from './reporter/request-response'
import { buildReporter as buildL2RequestResponseFulfillReporter } from './reporter/request-response-L2-fulfill'
import { buildReporter as buildL2RequestResponseRequestReporter } from './reporter/request-response-L2-request'
Expand All @@ -38,7 +35,6 @@ import { CHAIN, REDIS_HOST, REDIS_PORT } from './settings'
const LISTENERS: IListeners = {
VRF: buildVrfListener,
REQUEST_RESPONSE: buildRequestResponseListener,
DATA_FEED_L2: buildL2DataFeedListener,
VRF_L2_REQUEST: buildVrfL2RequestListener,
VRF_L2_FULFILL: buildVrfL2FulfillListener,
REQUEST_RESPONSE_L2_REQUEST: buildRequestResponseL2RequestListener,
Expand All @@ -48,7 +44,6 @@ const LISTENERS: IListeners = {
const WORKERS: IWorkers = {
VRF: vrfWorker,
REQUEST_RESPONSE: requestResponseWorker,
DATA_FEED_L2: l2DataFeedWorker,
VRF_L2_REQUEST: l2VrfRequestWorker,
VRF_L2_FULFILL: l2VrfFulfillWorker,
REQUEST_RESPONSE_L2_REQUEST: l2RequestResponseRequestWorker,
Expand All @@ -58,7 +53,6 @@ const WORKERS: IWorkers = {
const REPORTERS: IReporters = {
VRF: buildVrfReporter,
REQUEST_RESPONSE: buildRequestResponseReporter,
DATA_FEED_L2: buildL2DataFeedReporter,
VRF_L2_REQUEST: buildL2VrfRequestReporter,
VRF_L2_FULFILL: buildL2VrfFulfillReporter,
REQUEST_RESPONSE_L2_REQUEST: buildL2RequestResponseRequestReporter,
Expand Down
25 changes: 0 additions & 25 deletions core/src/reporter/data-feed-L2.ts

This file was deleted.

2 changes: 0 additions & 2 deletions core/src/reporter/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { launchHealthCheck } from '../health-check'
import { buildLogger } from '../logger'
import { REDIS_HOST, REDIS_PORT } from '../settings'
import { hookConsoleError } from '../utils'
import { buildReporter as buildL2DataFeedReporter } from './data-feed-L2'
import { buildReporter as buildRequestResponseReporter } from './request-response'
import { buildReporter as buildL2RequestResponseFulfillReporter } from './request-response-L2-fulfill'
import { buildReporter as buildL2RequestResponseRequestReporter } from './request-response-L2-request'
Expand All @@ -17,7 +16,6 @@ import { buildReporter as buildL2VrfRequestReporter } from './vrf-L2-request'
const REPORTERS: IReporters = {
VRF: buildVrfReporter,
REQUEST_RESPONSE: buildRequestResponseReporter,
DATA_FEED_L2: buildL2DataFeedReporter,
VRF_L2_REQUEST: buildL2VrfRequestReporter,
VRF_L2_FULFILL: buildL2VrfFulfillReporter,
REQUEST_RESPONSE_L2_REQUEST: buildL2RequestResponseRequestReporter,
Expand Down
24 changes: 1 addition & 23 deletions core/src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const POR_LATENCY_BUFFER = 60000 // submission latency buffer for POR in
// Gas mimimums
export const VRF_FULFILL_GAS_MINIMUM = 1_000_000
export const REQUEST_RESPONSE_FULFILL_GAS_MINIMUM = 400_000
export const DATA_FEED_FULFILL_GAS_MINIMUM = 400_000

export const POR_GAS_MINIMUM = 400_000
export const VRF_FULLFILL_GAS_PER_WORD = 1_000

Expand All @@ -40,48 +40,35 @@ export const LISTENER_PORT = process.env.LISTENER_PORT || 4_000
export const WORKER_PORT = process.env.WORKER_PORT || 5_001
export const REPORTER_PORT = process.env.REPORTER_PORT || 6_000

export const DATA_FEED_SERVICE_NAME = 'DATA_FEED'
export const VRF_SERVICE_NAME = 'VRF'
export const REQUEST_RESPONSE_SERVICE_NAME = 'REQUEST_RESPONSE'
export const L2_DATA_FEED_SERVICE_NAME = 'DATA_FEED_L2'
export const L2_VRF_REQUEST_SERVICE_NAME = 'VRF_L2_REQUEST'
export const L2_VRF_FULFILL_SERVICE_NAME = 'VRF_L2_FULFILL'
export const L2_REQUEST_RESPONSE_REQUEST_SERVICE_NAME = 'REQUEST_RESPONSE_L2_REQUEST'
export const L2_REQUEST_RESPONSE_FULFILL_SERVICE_NAME = 'REQUEST_RESPONSE_L2_FULFILL'
export const POR_SERVICE_NAME = 'POR'

// Data Feed
export const MAX_DATA_STALENESS = 5_000

// BullMQ
export const REMOVE_ON_COMPLETE = 500
export const REMOVE_ON_FAIL = 1_000
export const CONCURRENCY = 50
export const DATA_FEED_REPORTER_CONCURRENCY =
Number(process.env.DATA_FEED_REPORTER_CONCURRENCY) || 15

export const LISTENER_REQUEST_RESPONSE_LATEST_QUEUE_NAME = `${DEPLOYMENT_NAME}-listener-request-response-latest-queue`
export const LISTENER_VRF_LATEST_QUEUE_NAME = `${DEPLOYMENT_NAME}-listener-vrf-latest-queue`
export const LISTENER_DATA_FEED_LATEST_QUEUE_NAME = `${DEPLOYMENT_NAME}-listener-data-feed-latest-queue`
export const L2_LISTENER_DATA_FEED_LATEST_QUEUE_NAME = `${DEPLOYMENT_NAME}-listener-data-feed-l2-latest-queue`
export const L2_LISTENER_VRF_REQUEST_LATEST_QUEUE_NAME = `${DEPLOYMENT_NAME}-listener-vrf-l2-request-latest-queue`
export const L2_LISTENER_VRF_FULFILL_LATEST_QUEUE_NAME = `${DEPLOYMENT_NAME}-listener-vrf-l2-fulfill-latest-queue`
export const L2_LISTENER_REQUEST_RESPONSE_REQUEST_LATEST_QUEUE_NAME = `${DEPLOYMENT_NAME}-listener-request-response-l2-request-latest-queue`
export const L2_LISTENER_REQUEST_RESPONSE_FULFILL_LATEST_QUEUE_NAME = `${DEPLOYMENT_NAME}-listener-request-response-l2-fulfill-latest-queue`

export const LISTENER_REQUEST_RESPONSE_HISTORY_QUEUE_NAME = `${DEPLOYMENT_NAME}-listener-request-response-history-queue`
export const LISTENER_VRF_HISTORY_QUEUE_NAME = `${DEPLOYMENT_NAME}-listener-vrf-history-queue`
export const LISTENER_DATA_FEED_HISTORY_QUEUE_NAME = `${DEPLOYMENT_NAME}-listener-data-feed-history-queue`
export const L2_LISTENER_DATA_FEED_HISTORY_QUEUE_NAME = `${DEPLOYMENT_NAME}-listener-data-feed-l2-history-queue`
export const L2_LISTENER_VRF_REQUEST_HISTORY_QUEUE_NAME = `${DEPLOYMENT_NAME}-listener-vrf-l2-request-history-queue`
export const L2_LISTENER_VRF_FULFILL_HISTORY_QUEUE_NAME = `${DEPLOYMENT_NAME}-listener-vrf-l2-fulfill-history-queue`
export const L2_LISTENER_REQUEST_RESPONSE_REQUEST_HISTORY_QUEUE_NAME = `${DEPLOYMENT_NAME}-listener-request-response-l2-request-history-queue`
export const L2_LISTENER_REQUEST_RESPONSE_FULFILL_HISTORY_QUEUE_NAME = `${DEPLOYMENT_NAME}-listener-request-response-l2-fulfill-history-queue`

export const LISTENER_REQUEST_RESPONSE_PROCESS_EVENT_QUEUE_NAME = `${DEPLOYMENT_NAME}-listener-request-response-process-event-queue`
export const LISTENER_VRF_PROCESS_EVENT_QUEUE_NAME = `${DEPLOYMENT_NAME}-listener-vrf-process-event-queue`
export const LISTENER_DATA_FEED_PROCESS_EVENT_QUEUE_NAME = `${DEPLOYMENT_NAME}-listener-data-feed-process-event-queue`
export const L2_LISTENER_DATA_FEED_PROCESS_EVENT_QUEUE_NAME = `${DEPLOYMENT_NAME}-listener-data-feed-l2-process-event-queue`
export const L2_LISTENER_VRF_REQUEST_PROCESS_EVENT_QUEUE_NAME = `${DEPLOYMENT_NAME}-listener-vrf-l2-request-process-event-queue`
export const L2_LISTENER_VRF_FULFILL_PROCESS_EVENT_QUEUE_NAME = `${DEPLOYMENT_NAME}-listener-vrf-l2-fulfill-process-event-queue`
export const L2_LISTENER_REQUEST_RESPONSE_REQUEST_PROCESS_EVENT_QUEUE_NAME = `${DEPLOYMENT_NAME}-listener-request-response-l2-request-process-event-queue`
Expand Down Expand Up @@ -127,13 +114,10 @@ export const CYPRESS_CHAIN_ID = 8217
export const ALL_QUEUES = [
LISTENER_REQUEST_RESPONSE_LATEST_QUEUE_NAME,
LISTENER_VRF_LATEST_QUEUE_NAME,
LISTENER_DATA_FEED_LATEST_QUEUE_NAME,
LISTENER_REQUEST_RESPONSE_HISTORY_QUEUE_NAME,
LISTENER_VRF_HISTORY_QUEUE_NAME,
LISTENER_DATA_FEED_HISTORY_QUEUE_NAME,
LISTENER_REQUEST_RESPONSE_PROCESS_EVENT_QUEUE_NAME,
LISTENER_VRF_PROCESS_EVENT_QUEUE_NAME,
LISTENER_DATA_FEED_PROCESS_EVENT_QUEUE_NAME,
SUBMIT_HEARTBEAT_QUEUE_NAME,
HEARTBEAT_QUEUE_NAME,
WORKER_REQUEST_RESPONSE_QUEUE_NAME,
Expand All @@ -148,22 +132,16 @@ export const ALL_QUEUES = [

export const VRF_LISTENER_STATE_NAME = `${DEPLOYMENT_NAME}-listener-vrf-state`
export const REQUEST_RESPONSE_LISTENER_STATE_NAME = `${DEPLOYMENT_NAME}-listener-request-response-state`
export const DATA_FEED_LISTENER_STATE_NAME = `${DEPLOYMENT_NAME}-listener-data-feed-state`
export const L2_DATA_FEED_LISTENER_STATE_NAME = `${DEPLOYMENT_NAME}-listener-data-feed-state`
export const L2_VRF_REQUEST_LISTENER_STATE_NAME = `${DEPLOYMENT_NAME}-listener-vrf-request-l2-state`
export const L2_VRF_FULFILL_LISTENER_STATE_NAME = `${DEPLOYMENT_NAME}-listener-vrf-fulfill-l2-state`
export const L2_REQUEST_RESPONSE_REQUEST_LISTENER_STATE_NAME = `${DEPLOYMENT_NAME}-listener-request-response-request-l2-state`
export const L2_REQUEST_RESPONSE_FULFILL_LISTENER_STATE_NAME = `${DEPLOYMENT_NAME}-listener-request-response-fulfill-l2-state`

// export const VRF_WORKER_STATE_NAME = `${DEPLOYMENT_NAME}-worker-vrf-state`
// export const REQUEST_RESPONSE_WORKER_STATE_NAME = `${DEPLOYMENT_NAME}-worker-request-response-state`
export const DATA_FEED_WORKER_STATE_NAME = `${DEPLOYMENT_NAME}-worker-data-feed-state`
export const L2_DATA_FEED_WORKER_STATE_NAME = `${DEPLOYMENT_NAME}-worker-data-feed-l2-state`

export const VRF_REPORTER_STATE_NAME = `${DEPLOYMENT_NAME}-reporter-vrf-state`
export const REQUEST_RESPONSE_REPORTER_STATE_NAME = `${DEPLOYMENT_NAME}-reporter-request-response-state`
export const DATA_FEED_REPORTER_STATE_NAME = `${DEPLOYMENT_NAME}-reporter-data-feed-state`
export const L2_DATA_FEED_REPORTER_STATE_NAME = `${DEPLOYMENT_NAME}-reporter-data-feed-l2-state`
export const L2_VRF_REQUEST_REPORTER_STATE_NAME = `${DEPLOYMENT_NAME}-reporter-vrf-l2-request-state`
export const L2_VRF_FULFILL_REPORTER_STATE_NAME = `${DEPLOYMENT_NAME}-reporter-vrf-l2-fulfill-state`
export const L2_REQUEST_RESPONSE_REQUEST_REPORTER_STATE_NAME = `${DEPLOYMENT_NAME}-reporter-request-response-l2-request-state`
Expand Down
Loading

0 comments on commit 2202da9

Please sign in to comment.