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: docs/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ Welcome to Panurus documentation.
16
16
## Security
17
17
18
18
*[**HTLC Deadlines and Clock Synchronisation**](security/htlc_deadline_clock_assumptions.md): The clock-synchronisation assumption that the HTLC claim/reclaim deadline rests on, and the deadline margin it requires of a deployment.
19
-
*[**Selector Resource Limits**](security/selector_resource_limits.md): How to throttle token selectionby supplying a custom`Locker`.
19
+
*[**Selector Resource Limits**](security/selector_resource_limits.md): How to throttle token selection, either with the opt-in built-in per-wallet rate limiter or by supplying your own limiter or`Locker`.
Copy file name to clipboardExpand all lines: docs/configuration.md
+27Lines changed: 27 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,24 @@ token:
39
39
# fetcherCacheMaxQueries is the number of queries after which a soft refresh (non-blocking background update) is triggered.
40
40
# This helps keep the cache fresh without blocking queries. If not specified or set to 0, defaults to 5 queries.
41
41
fetcherCacheMaxQueries: 5
42
+
# Built-in per-wallet rate limiter for token selection (both drivers).
43
+
# It is disabled by default: without these keys, selection requests are not metered.
44
+
# One selection request (a Selector.Select call) costs one unit, no matter how many tokens it
45
+
# locks or how often it retries internally. Unlocking tokens is never throttled.
46
+
# A throttled request fails fast with an error wrapping token.SelectorRateLimited.
47
+
# See docs/security/selector_resource_limits.md.
48
+
# rateLimitEnabled turns the limiter on with the default rate and burst below.
49
+
rateLimitEnabled: true
50
+
# rateLimit is the maximum number of selection requests per second a single wallet may issue.
51
+
# A positive value implies rateLimitEnabled: true. If not specified or set to 0, defaults to 100.
52
+
rateLimit: 100
53
+
# rateLimitBurst is the maximum number of selection requests a single wallet may issue
54
+
# back-to-back. If not specified or set to 0, defaults to twice rateLimit.
55
+
rateLimitBurst: 200
56
+
# rateLimitMaxBuckets caps the number of per-wallet buckets kept in memory. When the cap is
57
+
# reached, idle buckets are pruned first and, if that is not enough, the least recently used
58
+
# ones are dropped. If not specified or set to 0, defaults to 4096.
59
+
rateLimitMaxBuckets: 4096
42
60
43
61
# When we are interested in knowing when a transaction reaches finality, we subscribe to the Finality Listener Manager for the finality event of that transaction.
44
62
# This configuration specifies the way the manager is instantiated (i.e., how it gets notified about the finality events, how often it checks).
@@ -471,6 +489,15 @@ Default values:
471
489
- numRetries: 3
472
490
- leaseExpiry: 3m
473
491
- leaseCleanupTickPeriod: 90s
492
+
- rateLimitEnabled: false (the built-in per-wallet selection rate limiter is opt-in)
493
+
- rateLimit: 100 requests/s per wallet, when rate limiting is enabled
494
+
- rateLimitBurst: 2 × rateLimit, so 200 requests, when rate limiting is enabled
495
+
- rateLimitMaxBuckets: 4096
496
+
497
+
Setting a positive `rateLimit` is enough to enable the limiter; `rateLimitEnabled: true` alone
498
+
enables it with the defaults above. See
499
+
[docs/security/selector_resource_limits.md](security/selector_resource_limits.md) for what is
500
+
metered and how to plug in your own limiter instead.
0 commit comments