Skip to content

Commit

Permalink
feat(monitor): moving some alerts to monitors
Browse files Browse the repository at this point in the history
  • Loading branch information
k-kaddal committed Sep 20, 2024
1 parent 1be53a4 commit 7fec512
Show file tree
Hide file tree
Showing 4 changed files with 214 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/protocol-monitors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
contents: write
steps:
- name: Deploy Monitors on OZ Defender
working-directory: ./packages/monitors
working-directory: ./packages/monitors/defender/mainnet
env:
SERVERLESS_API_KEY: ${{ secrets.DEFENDER_API_KEY }}
SERVERLESS_API_SECRET: ${{ secrets.DEFENDER_API_SECRET }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async function calculateBlockTime(provider) {
async function calculateBlockRange(provider) {
const currentBlockNumber = await getLatestBlockNumber(provider);
const blockTimeInSeconds = await calculateBlockTime(provider);
const blocksInOneHour = Math.floor((16 * 60) / blockTimeInSeconds);
const blocksInOneHour = Math.floor((15 * 60) / blockTimeInSeconds);

const fromBlock = currentBlockNumber - blocksInOneHour;
const toBlock = currentBlockNumber;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ exports.handler = async function (event, context) {

const currentBlockNumber = await getLatestBlockNumber(taikoL1Provider);
const blockTimeInSeconds = await calculateBlockTime(taikoL1Provider);
const blocksInFiveMinutes = Math.floor((5 * 60) / blockTimeInSeconds);
const blocksInFiveMinutes = Math.floor((15 * 60) / blockTimeInSeconds);

const fromBlock = currentBlockNumber - blocksInFiveMinutes;
const toBlock = currentBlockNumber;
Expand Down
242 changes: 211 additions & 31 deletions packages/monitors/defender/mainnet/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ defender:
resources:
actions:
erc-20-vault-balance-drop:
name: "ERC20Vault: Balance Drop Test"
name: "ERC20Vault: Balance Drop"
trigger:
type: schedule
frequency: 15
Expand Down Expand Up @@ -64,21 +64,21 @@ resources:
paused: false
path: ./actions/TaikoL1-CalldataTxListCount

guardian-prover-proving-auto-pause-enabled-alert:
name: "GuardianProver: ProvingAutoPauseEnabled Alert"
trigger:
type: schedule
frequency: 4
paused: false
path: ./actions/GuardianProver-ProvingAutoPauseEnabled

guardian-prover-conflicting-proofs-alert:
name: "GuardianProver: ConflictingProofs Alert"
trigger:
type: schedule
frequency: 4
paused: false
path: ./actions/GuardianProver-ConflictingProofs
# guardian-prover-proving-auto-pause-enabled-alert:
# name: "GuardianProver: ProvingAutoPauseEnabled Alert"
# trigger:
# type: schedule
# frequency: 4
# paused: false
# path: ./actions/GuardianProver-ProvingAutoPauseEnabled

# guardian-prover-conflicting-proofs-alert:
# name: "GuardianProver: ConflictingProofs Alert"
# trigger:
# type: schedule
# frequency: 4
# paused: false
# path: ./actions/GuardianProver-ConflictingProofs

guardian-prover-approved-count:
name: "GuardianProver: Approved Count"
Expand All @@ -88,21 +88,21 @@ resources:
paused: false
path: ./actions/GuardianProver-ApprovedCount

guardian-prover-guardians-updated-alert:
name: "GuardianProver: GuardiansUpdated Alert"
trigger:
type: schedule
frequency: 4
paused: false
path: ./actions/GuardianProver-GuardiansUpdated

taiko-l-1-proving-paused-alert:
name: "TaikoL1: ProvingPaused Alert"
trigger:
type: schedule
frequency: 4
paused: false
path: ./actions/TaikoL1-ProvingPaused
# guardian-prover-guardians-updated-alert:
# name: "GuardianProver: GuardiansUpdated Alert"
# trigger:
# type: schedule
# frequency: 4
# paused: false
# path: ./actions/GuardianProver-GuardiansUpdated

# taiko-l-1-proving-paused-alert:
# name: "TaikoL1: ProvingPaused Alert"
# trigger:
# type: schedule
# frequency: 4
# paused: false
# path: ./actions/TaikoL1-ProvingPaused

taiko-l-1-transition-contested-count:
name: "TaikoL1: TransitionContested Count"
Expand Down Expand Up @@ -256,6 +256,186 @@ resources:
https://discord.com/api/webhooks/1079966997816811520/RdYRjk74nbjEPb44tKFGAgYqDRSmmk2BAmShGkpnmm6QpK-21n-Avw5TnVEaJ1CWhE0s
paused: false
monitors:
taiko-l-1-proving-paused-alert:
name: "TaikoL1: ProvingPaused Alert"
type: BLOCK
network: mainnet
addresses:
- "0x06a9Ab27c7e2255df1815E6CC0168d7755Feb19a"
skip-abi-validation: false
paused: false
confirm-level: 1
notify-config:
timeout: 60000
message: |-
**Defender Monitor {{ sentinel.name }} Triggered**
**Network**
{{ sentinel.network }}
**Block Hash**
{{ blockHash }}
**Transaction Hash**
{{ transaction.transactionHash }}
**Explorer Link**
{{ transaction.link }}
**Match Reasons**
{{ matchReasonsFormatted }}
**Metadata**
{{ metadataFormatted }}
message-subject: "⚠️ TaikoL1: ProvingPaused Alert"
channels:
- ${self:resources.notifications.discord-bridging}
severity-level: HIGH
conditions:
event:
- expression: null
signature: ProvingPaused(bool)
guardian-prover-guardians-updated-alert:
name: "GuardianProver: GuardiansUpdated Alert"
type: BLOCK
network: mainnet
addresses:
- "0xE3D777143Ea25A6E031d1e921F396750885f43aC"
skip-abi-validation: false
paused: false
confirm-level: 1
notify-config:
timeout: 60000
message: |-
**Defender Monitor {{ sentinel.name }} Triggered**
**Network**
{{ sentinel.network }}
**Block Hash**
{{ blockHash }}
**Transaction Hash**
{{ transaction.transactionHash }}
**Explorer Link**
{{ transaction.link }}
**Match Reasons**
{{ matchReasonsFormatted }}
**Metadata**
{{ metadataFormatted }}
message-subject: "⚠️ GuardianProver: GuardiansUpdated Alert"
channels:
- ${self:resources.notifications.discord-bridging}
severity-level: MEDIUM
conditions:
event:
- expression: null
signature: GuardiansUpdated(unit32, address[])
guardian-prover-conflicting-proofs-alert:
name: "GuardianProver: ConflictingProofs Alert"
type: BLOCK
network: mainnet
addresses:
- "0xE3D777143Ea25A6E031d1e921F396750885f43aC"
skip-abi-validation: false
paused: false
confirm-level: 1
notify-config:
timeout: 60000
message: |-
**Defender Monitor {{ sentinel.name }} Triggered**
**Network**
{{ sentinel.network }}
**Block Hash**
{{ blockHash }}
**Transaction Hash**
{{ transaction.transactionHash }}
**Explorer Link**
{{ transaction.link }}
**Match Reasons**
{{ matchReasonsFormatted }}
**Metadata**
{{ metadataFormatted }}
message-subject: "🚨 GuardianProver: ConflictingProofs Alert"
channels:
- ${self:resources.notifications.discord-bridging}
severity-level: MEDIUM
conditions:
event:
- expression: null
signature: ConflictingProofs(uint256,address,bytes32,bytes32,bool)
guardian-prover-proving-auto-pause-enabled-alert:
name: "GuardianProver: ProvingAutoPauseEnabled Alert"
type: BLOCK
network: mainnet
addresses:
- "0xE3D777143Ea25A6E031d1e921F396750885f43aC"
skip-abi-validation: false
paused: false
confirm-level: 1
notify-config:
timeout: 60000
message: |-
**Defender Monitor {{ sentinel.name }} Triggered**
**Network**
{{ sentinel.network }}
**Block Hash**
{{ blockHash }}
**Transaction Hash**
{{ transaction.transactionHash }}
**Explorer Link**
{{ transaction.link }}
**Match Reasons**
{{ matchReasonsFormatted }}
**Metadata**
{{ metadataFormatted }}
message-subject: "⚠️ GuardianProver: ProvingAutoPauseEnabled Alert"
channels:
- ${self:resources.notifications.discord-bridging}
severity-level: MEDIUM
conditions:
event:
- expression: null
signature: ProvingAutoPauseEnabled(bool)
address-manager-l-2-address-set:
name: "Address Manager (L2): AddressSet"
type: BLOCK
Expand Down

0 comments on commit 7fec512

Please sign in to comment.