Commit 9e68cb0e authored by smartcontracts's avatar smartcontracts Committed by GitHub

maint: remove drippie-mon (#10945)

Drippie monitoring is now handled in monitorism.
parent 8e987923
......@@ -16,7 +16,6 @@ jobs:
# map the step outputs to job outputs
outputs:
balance-mon: ${{ steps.packages.outputs.balance-mon }}
drippie-mon: ${{ steps.packages.outputs.drippie-mon }}
fault-mon: ${{ steps.packages.outputs.fault-mon }}
multisig-mon: ${{ steps.packages.outputs.multisig-mon }}
replica-mon: ${{ steps.packages.outputs.replica-mon }}
......@@ -123,33 +122,6 @@ jobs:
push: true
tags: ethereumoptimism/multisig-mon:${{ needs.canary-publish.outputs.canary-docker-tag }}
drippie-mon:
name: Publish Drippie Monitor Version ${{ needs.canary-publish.outputs.canary-docker-tag }}
needs: canary-publish
if: needs.canary-publish.outputs.drippie-mon != ''
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_ACCESS_TOKEN_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN_SECRET }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ./ops/docker/Dockerfile.packages
target: drippie-mon
push: true
tags: ethereumoptimism/drippie-mon:${{ needs.canary-publish.outputs.canary-docker-tag }}
wd-mon:
name: Publish Withdrawal Monitor Version ${{ needs.canary-publish.outputs.canary-docker-tag }}
needs: canary-publish
......
......@@ -17,7 +17,6 @@ jobs:
# map the step outputs to job outputs
outputs:
balance-mon: ${{ steps.packages.outputs.balance-mon }}
drippie-mon: ${{ steps.packages.outputs.drippie-mon }}
fault-mon: ${{ steps.packages.outputs.fault-mon }}
multisig-mon: ${{ steps.packages.outputs.multisig-mon }}
replica-mon: ${{ steps.packages.outputs.replica-mon }}
......@@ -187,33 +186,6 @@ jobs:
push: true
tags: ethereumoptimism/multisig-mon:${{ needs.release.outputs.multisig-mon }},ethereumoptimism/multisig-mon:latest
drippie-mon:
name: Publish Drippie Monitor Version ${{ needs.release.outputs.drippie-mon }}
needs: release
if: needs.release.outputs.drippie-mon != ''
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_ACCESS_TOKEN_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN_SECRET }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ./ops/docker/Dockerfile.packages
target: drippie-mon
push: true
tags: ethereumoptimism/drippie-mon:${{ needs.release.outputs.drippie-mon }},ethereumoptimism/drippie-mon:latest
replica-mon:
name: Publish Replica Healthcheck Version ${{ needs.release.outputs.replica-mon }}
needs: release
......
......@@ -98,10 +98,6 @@ FROM base as balance-mon
WORKDIR /opt/optimism/packages/chain-mon/internal
CMD ["start:balance-mon"]
FROM base as drippie-mon
WORKDIR /opt/optimism/packages/chain-mon/contrib
CMD ["start:drippie-mon"]
from base as fault-mon
WORKDIR /opt/optimism/packages/chain-mon/
CMD ["start:fault-mon"]
......
......@@ -31,16 +31,6 @@ WALLET_MON__RPC=
# Defaults to the first bedrock block if unset.
WALLET_MON__START_BLOCK_NUMBER=
###############################################################################
# ↓ drippie-mon ↓ #
###############################################################################
# RPC pointing to network where Drippie is deployed
DRIPPIE_MON__RPC=
# Address of the Drippie contract
DRIPPIE_MON__DRIPPIE_ADDRESS=
###############################################################################
# ↓ wd-mon ↓ #
###############################################################################
......
......@@ -23,8 +23,8 @@ Once your environment variables have been set, run via:
pnpm start:<service name>
```
For example, to run `drippie-mon`, execute:
For example, to run `balance-mon`, execute:
```
pnpm start:drippie-mon
pnpm start:balance-mon
```
import {
BaseServiceV2,
StandardOptions,
Gauge,
Counter,
validators,
} from '@eth-optimism/common-ts'
import { Provider } from '@ethersproject/abstract-provider'
import { ethers } from 'ethers'
import * as DrippieArtifact from '@eth-optimism/contracts-bedrock/forge-artifacts/Drippie.sol/Drippie.json'
import { version } from '../../package.json'
type DrippieMonOptions = {
rpc: Provider
drippieAddress: string
}
type DrippieMonMetrics = {
isExecutable: Gauge
executedDripCount: Gauge
unexpectedRpcErrors: Counter
}
type DrippieMonState = {
drippie: ethers.Contract
}
export class DrippieMonService extends BaseServiceV2<
DrippieMonOptions,
DrippieMonMetrics,
DrippieMonState
> {
constructor(options?: Partial<DrippieMonOptions & StandardOptions>) {
super({
version,
name: 'drippie-mon',
loop: true,
options: {
loopIntervalMs: 60_000,
...options,
},
optionsSpec: {
rpc: {
validator: validators.provider,
desc: 'Provider for network where Drippie is deployed',
},
drippieAddress: {
validator: validators.str,
desc: 'Address of Drippie contract',
public: true,
},
},
metricsSpec: {
isExecutable: {
type: Gauge,
desc: 'Whether or not the drip is currently executable',
labels: ['name'],
},
executedDripCount: {
type: Gauge,
desc: 'Number of times a drip has been executed',
labels: ['name'],
},
unexpectedRpcErrors: {
type: Counter,
desc: 'Number of unexpected RPC errors',
labels: ['section', 'name'],
},
},
})
}
protected async init(): Promise<void> {
this.state.drippie = new ethers.Contract(
this.options.drippieAddress,
DrippieArtifact.abi,
this.options.rpc
)
}
protected async main(): Promise<void> {
let dripCreatedEvents: ethers.Event[]
try {
dripCreatedEvents = await this.state.drippie.queryFilter(
this.state.drippie.filters.DripCreated()
)
} catch (err) {
this.logger.info(`got unexpected RPC error`, {
section: 'creations',
name: 'NULL',
err,
})
this.metrics.unexpectedRpcErrors.inc({
section: 'creations',
name: 'NULL',
})
return
}
// Not the most efficient thing in the world. Will end up making one request for every drip
// created. We don't expect there to be many drips, so this is fine for now. We can also cache
// and skip any archived drips to cut down on a few requests. Worth keeping an eye on this to
// see if it's a bottleneck.
for (const event of dripCreatedEvents) {
const name = event.args.name
let drip: any
try {
drip = await this.state.drippie.drips(name)
} catch (err) {
this.logger.info(`got unexpected RPC error`, {
section: 'drips',
name,
err,
})
this.metrics.unexpectedRpcErrors.inc({
section: 'drips',
name,
})
continue
}
this.logger.info(`getting drip executable status`, {
name,
count: drip.count.toNumber(),
})
this.metrics.executedDripCount.set(
{
name,
},
drip.count.toNumber()
)
let executable: boolean
try {
// To avoid making unnecessary RPC requests, filter out any drips that we don't expect to
// be executable right now. Only active drips (status = 2) and drips that are due to be
// executed are expected to be executable (but might not be based on the dripcheck).
if (
drip.status === 2 &&
drip.last.toNumber() + drip.config.interval.toNumber() <
Date.now() / 1000
) {
executable = await this.state.drippie.executable(name)
} else {
executable = false
}
} catch (err) {
// All reverts include the string "Drippie:", so we can check for that.
if (err.message.includes('Drippie:')) {
// Not executable yet.
executable = false
} else {
this.logger.info(`got unexpected RPC error`, {
section: 'executable',
name,
err,
})
this.metrics.unexpectedRpcErrors.inc({
section: 'executable',
name,
})
continue
}
}
this.logger.info(`got drip executable status`, {
name,
executable,
})
this.metrics.isExecutable.set(
{
name,
},
executable ? 1 : 0
)
}
}
}
if (require.main === module) {
const service = new DrippieMonService()
service.run()
}
......@@ -10,7 +10,6 @@
],
"scripts": {
"dev:balance-mon": "tsx watch ./internal/balance-mon/service.ts",
"dev:drippie-mon": "tsx watch ./contrib/drippie/service.ts",
"dev:fault-mon": "tsx watch ./src/fault-mon/service.ts",
"dev:multisig-mon": "tsx watch ./internal/multisig-mon/service.ts",
"dev:replica-mon": "tsx watch ./contrib/replica-mon/service.ts",
......@@ -19,7 +18,6 @@
"dev:faultproof-wd-mon": "tsx ./src/faultproof-wd-mon/service.ts",
"dev:initialized-upgraded-mon": "tsx watch ./contrib/initialized-upgraded-mon/service.ts",
"start:balance-mon": "tsx ./internal/balance-mon/service.ts",
"start:drippie-mon": "tsx ./contrib/drippie/service.ts",
"start:fault-mon": "tsx ./src/fault-mon/service.ts",
"start:multisig-mon": "tsx ./internal/multisig-mon/service.ts",
"start:replica-mon": "tsx ./contrib/replica-mon/service.ts",
......
export * from '../internal/balance-mon/service'
export * from '../contrib/drippie-mon/service'
export * from './fault-mon/index'
export * from '../internal/multisig-mon/service'
export * from './wd-mon/service'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment