From 4ee0efca44406e3f609711d89e4aeeb9bce5d81d Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Mon, 30 Jan 2023 16:02:26 -0500 Subject: [PATCH] feat(mon): set up chain-mon package Sets up the chain-mon package by adapting the drippie-mon package. All new chain monitoring services will be placed in chain-mon instead. --- .circleci/config.yml | 6 ++-- .github/CODEOWNERS | 2 +- .vscode/settings.json | 4 +-- README.md | 2 +- codecov.yml | 2 +- ops/docker/Dockerfile.packages | 6 ++-- .../{drippie-mon => chain-mon}/.depcheckrc | 0 packages/chain-mon/.env.example | 9 ++++++ .../{drippie-mon => chain-mon}/.eslintrc.js | 0 .../.lintstagedrc.yml | 0 .../{drippie-mon => chain-mon}/.prettierrc.js | 0 .../{drippie-mon => chain-mon}/CHANGELOG.md | 0 packages/{drippie-mon => chain-mon}/LICENSE | 0 packages/chain-mon/README.md | 30 +++++++++++++++++++ .../{drippie-mon => chain-mon}/package.json | 11 ++++--- .../src/drippie-mon}/service.ts | 2 +- packages/chain-mon/src/index.ts | 1 + .../{drippie-mon => chain-mon}/tsconfig.json | 0 packages/drippie-mon/.env.example | 5 ---- packages/drippie-mon/README.md | 24 --------------- packages/drippie-mon/src/index.ts | 1 - 21 files changed, 57 insertions(+), 48 deletions(-) rename packages/{drippie-mon => chain-mon}/.depcheckrc (100%) create mode 100644 packages/chain-mon/.env.example rename packages/{drippie-mon => chain-mon}/.eslintrc.js (100%) rename packages/{drippie-mon => chain-mon}/.lintstagedrc.yml (100%) rename packages/{drippie-mon => chain-mon}/.prettierrc.js (100%) rename packages/{drippie-mon => chain-mon}/CHANGELOG.md (100%) rename packages/{drippie-mon => chain-mon}/LICENSE (100%) create mode 100644 packages/chain-mon/README.md rename packages/{drippie-mon => chain-mon}/package.json (81%) rename packages/{drippie-mon/src => chain-mon/src/drippie-mon}/service.ts (99%) create mode 100644 packages/chain-mon/src/index.ts rename packages/{drippie-mon => chain-mon}/tsconfig.json (100%) delete mode 100644 packages/drippie-mon/.env.example delete mode 100644 packages/drippie-mon/README.md delete mode 100644 packages/drippie-mon/src/index.ts diff --git a/.circleci/config.yml b/.circleci/config.yml index cc0ed6ead..b0f117e55 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -846,9 +846,9 @@ workflows: requires: - yarn-monorepo - js-lint-test: - name: drippie-mon-tests - coverage_flag: drippie-mon-tests - package_name: drippie-mon + name: chain-mon-tests + coverage_flag: chain-mon-tests + package_name: chain-mon dependencies: "(common-ts|contracts-periphery|core-utils|sdk)" requires: - yarn-monorepo diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5d7e78fc0..eec544797 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -12,7 +12,7 @@ /packages/contracts-periphery @ethereum-optimism/contract-reviewers /packages/core-utils @ethereum-optimism/legacy-reviewers /packages/data-transport-layer @ethereum-optimism/legacy-reviewers -/packages/drippie-mon @smartcontracts +/packages/chain-mon @smartcontracts /packages/fault-detector @ethereum-optimism/legacy-reviewers /packages/hardhat-deploy-config @ethereum-optimism/legacy-reviewers /packages/message-relayer @ethereum-optimism/legacy-reviewers diff --git a/.vscode/settings.json b/.vscode/settings.json index 3291e9ece..1ce5fc9f1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -25,7 +25,7 @@ "changeProcessCWD": true }, { - "directory": "packages/drippie-mon", + "directory": "packages/chain-mon", "changeProcessCWD": true }, { @@ -45,4 +45,4 @@ "eslint.format.enable": true, "editorconfig.generateAuto": false, "files.trimTrailingWhitespace": true -} \ No newline at end of file +} diff --git a/README.md b/README.md index 3d1a9c4d5..bc06c8dd8 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ Refer to the Directory Structure section below to understand which packages are │ ├── contracts-periphery: Peripheral contracts for Optimism │ ├── core-utils: Low-level utilities that make building Optimism easier │ ├── data-transport-layer: Service for indexing Optimism-related L1 data -│ ├── drippie-mon: Service for monitoring Drippie instances +│ ├── chain-mon: Chain monitoring services │ ├── fault-detector: Service for detecting Sequencer faults │ ├── message-relayer: Tool for automatically relaying L1<>L2 messages in development │ ├── replica-healthcheck: Service for monitoring the health of a replica node diff --git a/codecov.yml b/codecov.yml index 297b65306..e65eccc35 100644 --- a/codecov.yml +++ b/codecov.yml @@ -37,7 +37,7 @@ flag_management: - name: actor-tests-tests - name: contracts-periphery-tests - name: dtl-tests - - name: drippie-mon-tests + - name: chain-mon-tests - name: fault-detector-tests - name: message-relayer-tests - name: replica-healthcheck-tests diff --git a/ops/docker/Dockerfile.packages b/ops/docker/Dockerfile.packages index 5034a04e6..0dcfb533b 100644 --- a/ops/docker/Dockerfile.packages +++ b/ops/docker/Dockerfile.packages @@ -46,7 +46,7 @@ COPY packages/hardhat-deploy-config/package.json ./packages/hardhat-deploy-confi COPY packages/message-relayer/package.json ./packages/message-relayer/package.json COPY packages/fault-detector/package.json ./packages/fault-detector/package.json COPY packages/replica-healthcheck/package.json ./packages/replica-healthcheck/package.json -COPY packages/drippie-mon/package.json ./packages/drippie-mon/package.json +COPY packages/chain-mon/package.json ./packages/chain-mon/package.json COPY packages/balance-monitor/package.json ./packages/balance-monitor/package.json COPY packages/two-step-monitor/package.json ./packages/two-step-monitor/package.json COPY integration-tests/package.json ./integration-tests/package.json @@ -106,8 +106,8 @@ WORKDIR /opt/optimism/packages/replica-healthcheck ENTRYPOINT ["npm", "run", "start"] FROM base as drippie-mon -WORKDIR /opt/optimism/packages/drippie-mon -ENTRYPOINT ["npm", "run", "start"] +WORKDIR /opt/optimism/packages/chain-mon +ENTRYPOINT ["npm", "run", "start:drippie-mon"] FROM base as balance-monitor WORKDIR /opt/optimism/packages/balance-monitor diff --git a/packages/drippie-mon/.depcheckrc b/packages/chain-mon/.depcheckrc similarity index 100% rename from packages/drippie-mon/.depcheckrc rename to packages/chain-mon/.depcheckrc diff --git a/packages/chain-mon/.env.example b/packages/chain-mon/.env.example new file mode 100644 index 000000000..e26999fbf --- /dev/null +++ b/packages/chain-mon/.env.example @@ -0,0 +1,9 @@ +############################################################################### +# ↓ drippie-mon ↓ # +############################################################################### + +# RPC pointing to network where Drippie is deployed +DRIPPIE_MON__RPC= + +# Address of the Drippie contract +DRIPPIE_MON__DRIPPIE_ADDRESS= diff --git a/packages/drippie-mon/.eslintrc.js b/packages/chain-mon/.eslintrc.js similarity index 100% rename from packages/drippie-mon/.eslintrc.js rename to packages/chain-mon/.eslintrc.js diff --git a/packages/drippie-mon/.lintstagedrc.yml b/packages/chain-mon/.lintstagedrc.yml similarity index 100% rename from packages/drippie-mon/.lintstagedrc.yml rename to packages/chain-mon/.lintstagedrc.yml diff --git a/packages/drippie-mon/.prettierrc.js b/packages/chain-mon/.prettierrc.js similarity index 100% rename from packages/drippie-mon/.prettierrc.js rename to packages/chain-mon/.prettierrc.js diff --git a/packages/drippie-mon/CHANGELOG.md b/packages/chain-mon/CHANGELOG.md similarity index 100% rename from packages/drippie-mon/CHANGELOG.md rename to packages/chain-mon/CHANGELOG.md diff --git a/packages/drippie-mon/LICENSE b/packages/chain-mon/LICENSE similarity index 100% rename from packages/drippie-mon/LICENSE rename to packages/chain-mon/LICENSE diff --git a/packages/chain-mon/README.md b/packages/chain-mon/README.md new file mode 100644 index 000000000..716aabb90 --- /dev/null +++ b/packages/chain-mon/README.md @@ -0,0 +1,30 @@ +# @eth-optimism/chain-mon + +[![codecov](https://codecov.io/gh/ethereum-optimism/optimism/branch/develop/graph/badge.svg?token=0VTG7PG7YR&flag=chain-mon-tests)](https://codecov.io/gh/ethereum-optimism/optimism) + +`chain-mon` is a collection of chain monitoring services. + +## Installation + +Clone, install, and build the Optimism monorepo: + +``` +git clone https://github.com/ethereum-optimism/optimism.git +yarn install +yarn build +``` + +## Running a service + +Copy `.env.example` into a new file named `.env`, then set the environment variables listed there depending on the service you want to run. +Once your environment variables have been set, run via: + +``` +yarn start: +``` + +For example, to run `drippie-mon`, execute: + +``` +yarn start:drippie-mon +``` diff --git a/packages/drippie-mon/package.json b/packages/chain-mon/package.json similarity index 81% rename from packages/drippie-mon/package.json rename to packages/chain-mon/package.json index f2ad2f5d9..360aa7fff 100644 --- a/packages/drippie-mon/package.json +++ b/packages/chain-mon/package.json @@ -1,15 +1,15 @@ { "private": true, - "name": "@eth-optimism/drippie-mon", - "version": "0.4.3", - "description": "[Optimism] Service for monitoring Drippie instances", + "name": "@eth-optimism/chain-mon", + "version": "0.1.0", + "description": "[Optimism] Chain monitoring services", "main": "dist/index", "types": "dist/index", "files": [ "dist/*" ], "scripts": { - "start": "ts-node ./src/service.ts", + "start:drippie-mon": "ts-node ./src/drippie-mon/service.ts", "test:coverage": "echo 'No tests defined.'", "build": "tsc -p ./tsconfig.json", "clean": "rimraf dist/ ./tsconfig.tsbuildinfo", @@ -21,10 +21,9 @@ "keywords": [ "optimism", "ethereum", - "drippie", "monitoring" ], - "homepage": "https://github.com/ethereum-optimism/optimism/tree/develop/packages/drippie-mon#readme", + "homepage": "https://github.com/ethereum-optimism/optimism/tree/develop/packages/chain-mon#readme", "license": "MIT", "author": "Optimism PBC", "repository": { diff --git a/packages/drippie-mon/src/service.ts b/packages/chain-mon/src/drippie-mon/service.ts similarity index 99% rename from packages/drippie-mon/src/service.ts rename to packages/chain-mon/src/drippie-mon/service.ts index 3794bfe7d..6aee1ee12 100644 --- a/packages/drippie-mon/src/service.ts +++ b/packages/chain-mon/src/drippie-mon/service.ts @@ -9,7 +9,7 @@ import { Provider } from '@ethersproject/abstract-provider' import { ethers } from 'ethers' import * as DrippieArtifact from '@eth-optimism/contracts-periphery/artifacts/contracts/universal/drippie/Drippie.sol/Drippie.json' -import { version } from '../package.json' +import { version } from '../../package.json' type DrippieMonOptions = { rpc: Provider diff --git a/packages/chain-mon/src/index.ts b/packages/chain-mon/src/index.ts new file mode 100644 index 000000000..e1d25135e --- /dev/null +++ b/packages/chain-mon/src/index.ts @@ -0,0 +1 @@ +export * from './drippie-mon/service' diff --git a/packages/drippie-mon/tsconfig.json b/packages/chain-mon/tsconfig.json similarity index 100% rename from packages/drippie-mon/tsconfig.json rename to packages/chain-mon/tsconfig.json diff --git a/packages/drippie-mon/.env.example b/packages/drippie-mon/.env.example deleted file mode 100644 index 2db348516..000000000 --- a/packages/drippie-mon/.env.example +++ /dev/null @@ -1,5 +0,0 @@ -# RPC pointing to network where Drippie is deployed -DRIPPIE_MON__RPC= - -# Address of the Drippie contract -DRIPPIE_MON__DRIPPIE_ADDRESS= diff --git a/packages/drippie-mon/README.md b/packages/drippie-mon/README.md deleted file mode 100644 index e40c71517..000000000 --- a/packages/drippie-mon/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# @eth-optimism/drippie-mon - -[![codecov](https://codecov.io/gh/ethereum-optimism/optimism/branch/develop/graph/badge.svg?token=0VTG7PG7YR&flag=drippie-mon-tests)](https://codecov.io/gh/ethereum-optimism/optimism) - -`drippie-mon` is a simple service for monitoring Drippie contracts. - -## Installation - -Clone, install, and build the Optimism monorepo: - -``` -git clone https://github.com/ethereum-optimism/optimism.git -yarn install -yarn build -``` - -## Running the service - -Copy `.env.example` into a new file named `.env`, then set the environment variables listed there. -Once your environment variables have been set, run via: - -``` -yarn start -``` diff --git a/packages/drippie-mon/src/index.ts b/packages/drippie-mon/src/index.ts deleted file mode 100644 index caf7fffa1..000000000 --- a/packages/drippie-mon/src/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './service'