Skip to content

feat(moderation): add background contribution burst detector and mode…#976

Open
shakourllahfashola-dev wants to merge 2 commits into
Pulsefy:mainfrom
shakourllahfashola-dev:feat/contribution-burst-detector
Open

feat(moderation): add background contribution burst detector and mode…#976
shakourllahfashola-dev wants to merge 2 commits into
Pulsefy:mainfrom
shakourllahfashola-dev:feat/contribution-burst-detector

Conversation

@shakourllahfashola-dev

Copy link
Copy Markdown

Summary

This PR implements the Suspicious Contribution Burst Detector and Moderation Flagging feature to identify anomalous or repeating wallet behavior indicating testnet manipulation.

Key Changes:

  • Asynchronous Queueing: Contribution details (projectId, senderPublicKey, amount, timestamp, transactionHash) are pushed to a new BullMQ contribution-moderation queue asynchronously via .catch() on contribute() in CrowdfundService. This avoids blocking synchronous writes in the request path.
  • Rule Engine: A background ContributionModerationProcessor checks the sorted contribution history using 4 rules:
    1. Velocity Alert: > 5 contributions within 10 seconds.
    2. Wallet Spammer Alert: Same wallet contributing > 3 times within 15 seconds.
    3. Large Amount Alert: Single contribution > 10,000 tokens or > 50% of target funding amount.
    4. Coordination Alert: > 4 unique wallets contributing within 30 seconds.
  • Auto-moderation Flags: Automatically generates programmatic ContentReport entities under a dedicated, seeded system administrator account (system-detector@lumenpulse.com), feeding directly into the moderation review queue.
  • Tests: Created comprehensive unit tests validating all rules in contribution-moderation.processor.spec.ts.

Linked Issue

Closes #851

Type of Change

  • feat
  • fix
  • docs
  • refactor
  • test
  • chore

Validation

  • Lint passed for affected area(s)
  • Tests passed for affected area(s)
  • Manual verification completed (if applicable)

Documentation

  • Documentation updated (or N/A with explanation)
  • Screenshots/videos attached for UI changes

Checklist

  • Branch name uses feat/, fix/, or docs/
  • Commit messages follow Conventional Commits
  • PR scope matches linked issue acceptance criteria

@drips-wave

drips-wave Bot commented Jun 28, 2026

Copy link
Copy Markdown

@shakourllahfashola-dev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Cedarich

Copy link
Copy Markdown
Contributor

@shakourllahfashola-dev Fix CI

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.

Backend: Suspicious contribution burst detector and moderation flagging

2 participants