Skip to content

Add Multisig Alerts#1

Merged
chapati23 merged 13 commits intomainfrom
feat/multisig-alerts
Nov 20, 2025
Merged

Add Multisig Alerts#1
chapati23 merged 13 commits intomainfrom
feat/multisig-alerts

Conversation

@chapati23
Copy link
Contributor

@chapati23 chapati23 commented Nov 17, 2025

Description

This PR adds a complete infrastructure-as-code system for monitoring Safe multisig wallets on multiple blockchain networks.

Overview

This PR introduces a complete Terraform-managed alerting infrastructure for monitoring Safe multisig wallets across multiple blockchain networks (Celo, Ethereum). The system automatically monitors 16 different Safe contract events and routes them to appropriate Discord channels based on event type (security alerts vs operational events).

Key Components

Infrastructure Modules:

  • discord-channel-manager/ - Creates Discord channels and webhooks via Terraform REST API provider
  • onchain-event-listeners/ - Manages QuickNode webhooks with JavaScript filter functions
  • onchain-event-handler/ - TypeScript Cloud Function that processes webhooks, verifies signatures, and sends Discord messages
  • sentry-alerts/ - Sentry error monitoring integration with automatic Discord channel creation

Event Monitoring:

  • Security Events (→ alerts channel): SafeSetup, AddedOwner, RemovedOwner, ChangedThreshold, ChangedFallbackHandler, EnabledModule, DisabledModule, ChangedGuard
  • Operational Events (→ events channel): ExecutionSuccess, ExecutionFailure, ApproveHash, SignMsg, SafeModuleTransaction, ExecutionFromModuleSuccess, SafeReceived, SafeMultiSigTransaction

How to Review

1. Review Infrastructure Architecture

  • Check main.tf for module orchestration and resource dependencies
  • Review each module's README.md for architecture decisions:
    • discord-channel-manager/README.md - Discord infrastructure approach
    • onchain-event-listeners/README.md - QuickNode webhook management
    • onchain-event-handler/README.md - Cloud Function deployment
    • sentry-alerts/README.md - Sentry integration

2. Review Code Quality

Key files to review:

  • onchain-event-handler/src/process-events.ts - Core event processing logic
  • onchain-event-handler/src/verify-quicknode-signature.ts - Security-critical signature verification
  • onchain-event-handler/src/event-formatters/ - Discord message formatting

3. Test Terraform Plan (Dry Run)

Copy example vars

cp terraform.tfvars.example terraform.tfvars

Edit terraform.tfvars with test values (use dummy values for secrets)

Then run plan

terraform init
terraform plan

Verify:

  • All modules are properly configured
  • No unexpected resource creations
  • Variable validation works correctly

4. Review Security Implementation

Focus areas:

  • onchain-event-handler/src/verify-quicknode-signature.ts - Signature verification logic
  • onchain-event-handler/src/validate-quicknode-webhook.ts - Webhook validation
  • Secret management in Terraform (GCP Secret Manager usage)
  • IAM permissions in onchain-event-handler/main.tf

5. Documentation Review

  • Verify README.md provides clear setup instructions
  • Check module READMEs are comprehensive
  • Review inline code comments for clarity

6. Manual Testing (If Deploying)

Test Steps:
0. Set up Terraform ./scripts/set-up-terraform.sh

  1. Deploy infrastructure: terraform apply
  2. Verify Cloud Function is accessible: curl $(terraform output -raw cloud_function_url)
  3. Check Discord channels were created
  4. Verify QuickNode webhooks are configured (use scripts/manage-quicknode-webhook.sh)
  5. Test webhook processing with sample payload: scripts/test-local.sh

Note: Full manual testing requires actual GCP/Discord/QuickNode credentials. For code review, focus on architecture, code quality, and security implementation.

@chapati23 chapati23 force-pushed the feat/multisig-alerts branch from 956f140 to 0891368 Compare November 18, 2025 12:52
@chapati23 chapati23 marked this pull request as ready for review November 18, 2025 13:00
@chapati23 chapati23 merged commit 29017c0 into main Nov 20, 2025
3 checks passed
@chapati23 chapati23 deleted the feat/multisig-alerts branch December 2, 2025 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant