Skip to content

Commit b20a764

Browse files
committed
feat: add static limits for IPv4 subnets and subnet floor overrides
- Introduced static caps for IPv4 subnets to match existing IPv6 tiers. - Added `ipv4_limit_floor` and `ipv6_limit_floor` to prevent bottlenecks in small testnets.
1 parent ee674b3 commit b20a764

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

src/security.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -388,14 +388,15 @@ impl IPDiversityConfig {
388388
max_nodes_per_ipv6_64: 100, // Allow many nodes per /64 subnet
389389
max_nodes_per_ipv6_48: 500, // Allow many nodes per /48 allocation
390390
max_nodes_per_ipv6_32: 1000, // Allow many nodes per /32 region
391-
// IPv4 — no static caps for testnet (dynamic limits suffice)
392-
max_nodes_per_ipv4_32: None,
393-
max_nodes_per_ipv4_24: None,
394-
max_nodes_per_ipv4_16: None,
395-
// Per-protocol overrides — None = no override
396-
ipv4_limit_floor: None,
391+
// IPv4 caps — match IPv6 tiers for consistency
392+
max_nodes_per_ipv4_32: Some(100),
393+
max_nodes_per_ipv4_24: Some(500),
394+
max_nodes_per_ipv4_16: Some(1000),
395+
// Floors ensure small testnets (< 100 nodes) aren't bottlenecked
396+
// by the dynamic per-IP formula, which yields 1 for tiny networks.
397+
ipv4_limit_floor: Some(5),
397398
ipv4_limit_ceiling: None,
398-
ipv6_limit_floor: None,
399+
ipv6_limit_floor: Some(5),
399400
ipv6_limit_ceiling: None,
400401
// Network-relative limits (relaxed for testnet)
401402
max_per_ip_cap: 100, // Higher cap for testing

0 commit comments

Comments
 (0)