Skip to content

feat: add rate limiting and suspicious activity detection (#103, #102)#165

Merged
mijinummi merged 1 commit intoMDTechLabs:mainfrom
portableDD:feat/rate-limit-and-suspicious-activity
Mar 29, 2026
Merged

feat: add rate limiting and suspicious activity detection (#103, #102)#165
mijinummi merged 1 commit intoMDTechLabs:mainfrom
portableDD:feat/rate-limit-and-suspicious-activity

Conversation

@portableDD
Copy link
Copy Markdown
Contributor

  • RateLimitService: enforces per-merchant limits (10 tx/min, 100 tx/hour) with 429 on breach and a GET /api/v1/rate-limit/:merchantId status endpoint
  • SuspiciousActivityService: detects burst transactions (≥5 in 10s), high failure rate (>70% of last 10 tx), and gas spikes (>4x rolling avg); emits structured Logger warnings on each alert
  • TransactionsService.record() now runs rate-limit check before saving and suspicious-activity analysis after, returning { transaction, rateLimit, suspiciousActivity }
  • Full unit test coverage for both new services and the updated record() method

closes #102 , closes #103

…#103, MDTechLabs#102)

- RateLimitService: enforces per-merchant limits (10 tx/min, 100 tx/hour) with 429 on breach and a GET /api/v1/rate-limit/:merchantId status endpoint
- SuspiciousActivityService: detects burst transactions (≥5 in 10s), high failure rate (>70% of last 10 tx), and gas spikes (>4x rolling avg); emits structured Logger warnings on each alert
- TransactionsService.record() now runs rate-limit check before saving and suspicious-activity analysis after, returning { transaction, rateLimit, suspiciousActivity }
- Full unit test coverage for both new services and the updated record() method
@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 29, 2026

@portableDD 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

@mijinummi mijinummi merged commit 1c23e4b into MDTechLabs:main Mar 29, 2026
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.

Rate Limit Transactions Suspicious Activity Detection

2 participants