You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: backend/docs/rate-limiting.md
+41Lines changed: 41 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,47 @@ This means authenticated users behind a shared corporate NAT are not penalised c
19
19
> Limits for claim submission (`POST /api/claims/submit`) are additionally governed by
20
20
> a per-policy ledger-window counter (see claim rate limiting docs).
21
21
22
+
## Claim Submission Rate Limits
23
+
24
+
Claim submission (`POST /api/claims/submit`) is protected by **three layers** of rate limiting:
25
+
26
+
1.**Global circuit breaker** — prevents system overload from any source.
27
+
2.**Per-wallet sliding window** — prevents a single wallet from flooding claims.
28
+
3.**Per-policy ledger window** — prevents spam against a single policy.
29
+
30
+
### Layer 1: Global Circuit Breaker
31
+
32
+
| Limit | Window | Rationale |
33
+
|---|---|---|
34
+
| 100 claims | 5 minutes | Protects governance capacity and DAO voter attention across all policies. If triggered, all claim submissions are rejected until the window slides. |
35
+
36
+
### Layer 2: Per-Wallet Sliding Window
37
+
38
+
| Limit | Window | Rationale |
39
+
|---|---|---|
40
+
| 3 claims | 1 hour | Prevents a single wallet from exhausting governance for a specific tenant or policy type. Aligns with typical legitimate catastrophic-event filing patterns (1–2 claims per hour). |
41
+
42
+
### Layer 3: Per-Policy Ledger Window
43
+
44
+
| Limit | Window | Rationale |
45
+
|---|---|---|
46
+
| 5 claims | 17,280 ledgers (~24h) | Prevents spam against an individual policy. Uses ledger-based windows to avoid clock-skew issues. |
47
+
48
+
### Claim Rate Limit Configuration
49
+
50
+
Environment variables:
51
+
52
+
| Variable | Default | Description |
53
+
|---|---|---|
54
+
|`GLOBAL_RATE_LIMIT`| 100 | Global claim submissions per window |
55
+
|`GLOBAL_RATE_LIMIT_WINDOW_SECONDS`| 300 | Global window in seconds |
56
+
|`WALLET_RATE_LIMIT`| 3 | Claims per wallet per window |
57
+
|`WALLET_RATE_LIMIT_WINDOW_SECONDS`| 3600 | Wallet window in seconds |
0 commit comments