[PR #2822] [MERGED] Telemetry server: count IPv6 clients by /64 in the rate limits #4639

Closed
opened 2026-11-03 05:06:51 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2822
Author: @sirrayi
Created: 10/27/2026
Status: ✅ Merged
Merged: 10/28/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/telemetry-ipv6-buckets


📝 Commits (1)

  • c0bf77f Telemetry server: count IPv6 clients by /64 in the rate limits

📊 Changes

2 files changed (+57 additions, -4 deletions)

View changed files

📝 crates/horizon-telemetry-server/src/lib.rs (+42 -4)
📝 crates/horizon-telemetry-server/tests/server.rs (+15 -0)

📄 Description

🤖 Opened by sirrayi's AI agent (Devin), not by sirrayi themselves.

What and why

Every rate limit in the telemetry server is keyed on App::client()'s address exactly as it comes in: allow (batches, forget), allow_live (live pings), and the hub's hashed buckets (votes, reports, suggestions). An IPv6 client can rotate addresses inside its /64, which gives it 2^64 of them, and each new address got a fresh bucket. So:

  • the per-address limits didn't hold for IPv6 (vote stuffing on /hub/vote, report and suggestion spam, batch spam);
  • the bucket maps grew without bound until the daily maintain.

client() now returns rate_key(...) of the address. IPv4 and IPv4-mapped addresses count as IPv4, and other IPv6 addresses count by their /64, which one home or host holds whole. horizon-relay already does this (limits::address_key). Nothing new is stored: the hub's buckets still hash the key.

Vanilla reference

none (Horizon's telemetry server).

Self-check

Run in crates/horizon-telemetry-server (its own workspace):

  • cargo fmt --all -- --check ✅
  • cargo clippy --all-targets -- -D warnings ✅
  • cargo test (35) ✅
  • New tests: unit test tests::ipv6_rates_count_by_64, and an_address_is_rate_limited now also checks that three addresses of one /64 share a bucket while another /64 doesn't.

Generated with Devin


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/2822 **Author:** [@sirrayi](https://github.com/sirrayi) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/28/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/telemetry-ipv6-buckets` --- ### 📝 Commits (1) - [`c0bf77f`](https://github.com/horizon-rust/horizon/commit/c0bf77f3c3048928685b60ed376fd913f327679e) Telemetry server: count IPv6 clients by /64 in the rate limits ### 📊 Changes **2 files changed** (+57 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-telemetry-server/src/lib.rs` (+42 -4) 📝 `crates/horizon-telemetry-server/tests/server.rs` (+15 -0) </details> ### 📄 Description > 🤖 Opened by sirrayi's AI agent (Devin), not by sirrayi themselves. ## What and why Every rate limit in the telemetry server is keyed on `App::client()`'s address exactly as it comes in: `allow` (batches, forget), `allow_live` (live pings), and the hub's hashed buckets (votes, reports, suggestions). An IPv6 client can rotate addresses inside its /64, which gives it 2^64 of them, and each new address got a fresh bucket. So: - the per-address limits didn't hold for IPv6 (vote stuffing on `/hub/vote`, report and suggestion spam, batch spam); - the bucket maps grew without bound until the daily `maintain`. `client()` now returns `rate_key(...)` of the address. IPv4 and IPv4-mapped addresses count as IPv4, and other IPv6 addresses count by their /64, which one home or host holds whole. `horizon-relay` already does this (`limits::address_key`). Nothing new is stored: the hub's buckets still hash the key. ## Vanilla reference none (Horizon's telemetry server). ## Self-check Run in `crates/horizon-telemetry-server` (its own workspace): - `cargo fmt --all -- --check` ✅ - `cargo clippy --all-targets -- -D warnings` ✅ - `cargo test` (35) ✅ - New tests: unit test `tests::ipv6_rates_count_by_64`, and `an_address_is_rate_limited` now also checks that three addresses of one /64 share a bucket while another /64 doesn't. Generated with [Devin](https://devin.ai) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:06:51 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#4639
No description provided.