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
{{ message }}
Repository navigation
Commit bc6d2bb
Browse filesBrowse the repository at this point in the historyBrowse files
feat(peering): treat authenticated peers as feeds (#1034)
<!--- Provide a general summary of your changes in the Title above -->
## Description
<!--- Describe your changes in detail -->
This PR :-
- Adds \`limits.peer\` with separate subscription caps and message rate
limits for authenticated peering peers.
- Peer REQ, COUNT and NIP-77 filter handling use peer caps instead of
client caps; a full-feed subscription no longer trips
\`max_subscriptions\` or the client EWMA message bucket.
- \`limits.peer.subscription.maxLimit\` defaults to 0 (no cap), so a
peer can request a full feed.
- Peer messages are counted in a separate rate-limit bucket; defaults
remain high but finite.
- Only a verified AUTH from an enabled \`peering.peers\` pubkey selects
peer limits. Unauthenticated and unconfigured connections keep the
existing client limits exactly as before.
- Documents and validates the new limits.
## Related Issue
<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Please link to the issue here: -->
Closes :- #934
## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
## How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
## Screenshots (if appropriate):
## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [ ] Non-functional change (docs, style, minor refactor)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the **CONTRIBUTING** document.
- [ ] I have added tests to cover my code changes.
- [ ] I added a changeset, or this is docs-only and I added an empty
changeset.
- [ ] All new and existing tests passed.
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->
## Summary by CodeRabbit
* **New Features**
* Authenticated connections from configured peers now use separate
subscription and message-rate limits; other connections retain client
limits.
* Peer defaults allow up to 100 subscriptions, 100 filters, and 10,000
filter values. Subscription IDs can be up to 256 characters.
* Peer feeds have no result-limit cap by default and exclude deleted or
expired events. Filter counts are governed by connection-specific
limits, checked before duplicate filters are removed.
* Feed reads wait for pending sends to complete, helping accommodate
slower connections.
* **Documentation**
* Added guidance on peer feed limits and documented available settings
and defaults.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Copy file name to clipboardExpand all lines: CONFIGURATION.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -195,6 +195,13 @@ The settings below are listed in alphabetical order by name. Please keep this ta
195
195
| limits.client.subscription.maxFilters | Maximum number of filters per subscription. Defaults to 10. Disabled when set to zero. |
196
196
| limits.message.rateLimits[].period | Rate limiting period in milliseconds. For `sliding_window`: the time window. For `ewma`: the half-life of the decay function. |
197
197
| limits.message.rateLimits[].rate | Maximum number of messages during period. |
198
+
| limits.peer.message.rateLimits[].period | Rate limit period in milliseconds for authenticated peering peers. Separate from `limits.message`, so a peer feed never spends client message budget. |
199
+
| limits.peer.message.rateLimits[].rate | Maximum peer messages during period. Defaults to 6000/min. |
200
+
| limits.peer.subscription.maxFilters | Maximum number of filters per peer subscription. Defaults to 100. Disabled when set to zero. |
201
+
| limits.peer.subscription.maxFilterValues | Maximum number of values allowed in each peer filter. Defaults to 10000. Disabled when set to zero. |
202
+
| limits.peer.subscription.maxLimit | Maximum REQ `limit` for peers. Defaults to 0 (no cap), so a peer can request a full feed. |
203
+
| limits.peer.subscription.maxSubscriptionIdLength | Maximum peer subscription id length. Defaults to 256. |
204
+
| limits.peer.subscription.maxSubscriptions | Maximum number of subscriptions per authenticated peer. Defaults to 100. Disabled when set to zero. |
198
205
| mirroring.static | Removed: the static mirroring worker no longer exists, so this setting is ignored and logs a warning at start-up. To sync events with another relay, use NIP-77 (Negentropy) from a client that speaks it, for example `strfry sync`, against a relay with `nip77.enabled` set. |
199
206
| network.maxPayloadSize | Maximum number of bytes accepted per WebSocket frame |
200
207
| network.remoteIpHeader | HTTP header from proxy containing IP address from client. |
0 commit comments