blepwr/fairness: opravy z review-three

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5.5 committed 2026-10-06 23:46:40 +02:00
1 parent b3db81151f
commit 81ccbc2051
4 files changed
+37 -15

No files matched your search

+10 -5
View File
@@ -19,10 +19,14 @@
#include <Packet.h>
#include <stdint.h>
// Sender hashes 0x00 and 0xFF are NOT special here: repeaters, room servers
// and sensors re-roll such identities, but companions do not, so real users
// send with them (~1 in 128). Denying them always (as the original branch did)
// dropped every flood DM/PATH/REQ of those users.
// Sender hashes 0x00 and 0xFF are NOT special here. Our firmware never creates
// such an identity (re-roll on create, validatePrivateKey() on import), but the
// mesh still carries them: over 30 days (Sep-Oct 2026, CZ mesh) 50 floods of
// REQ/PATH/TXT_MSG/RESPONSE came from 0x00/0xFF senders -- older identities and
// other implementations. And for ANON_REQ payload[1] is the first byte of a
// random ephemeral key, so "always deny" also dropped 2 in 256 anonymous
// requests from anyone. Denying them always (as the original branch did)
// dropped every such flood; now they are limited like any other bucket.
// Note: mask, cap and refill interval are highly connected parameters.
#define GROUP_MASK 0b00011111 // 5-bit address
#define SENDER_NORMAL_MASK 0b00111111 // 6-bit address
@@ -32,7 +36,8 @@
// 1/interval, cap bounds the burst. Overridable per env from platformio ini.
//
// Sized from real traffic (6 Sep - 6 Oct 2026: 207k floods heard on the CZ
// mesh at one-site, replayed through this limiter). The zero-loss frontier
// mesh at one-site, replayed through this limiter with
// tools/fairness_replay.py -- rerun it when the traffic changes). The zero-loss frontier
// over those 30 days was group 60 s/cap 60, sender 10 s/cap 60, advert 600 s/
// cap 12; the defaults below keep about 2x headroom on top. The busiest
// legitimate channel runs ~26 msg/h around the clock, so the limiter is a net