mirror of
https://github.com/jmcorgan/fips.git
synced 2026-08-10 08:37:02 +00:00
node: route receive-path silent-rejection sites through typed RejectReason counters
Introduce a typed RejectReason enum and a NodeStats::record_reject dispatch so every receive-path rejection-and-return site bumps a machine-readable per-subsystem counter while keeping its operator-facing log line. The top-level variants mirror the existing NodeStats subsystem split (Tree, Bloom, Discovery, Forwarding) and add Handshake, Session, Mmp, and Transport categories; HandshakeStats, SessionStats, and MmpStats are new sub-stats. Wired clusters: tree and MMP outbound sign-failure; the FSP session unknown-session and state-machine cluster; the Noise IK handshake state-machine cluster (msg1/msg2); and the decode / crypto / cap / semantic tail across bloom, discovery, forwarding, mmp, and tree. The TreeStats::ancestry_invalid counter, present since the scaffold but never incremented, is now bumped from the validate_semantics ancestry rejection. Several handshake, MMP, tree, and discovery paths that previously had no counter at all are now counted, including the send_lookup_response no-route drop (DiscoveryStats::resp_no_route). Existing direct counters at the bloom / discovery / forwarding sites are retained alongside the new dispatch while the rollout is in progress (the bloom_poison tests expect the transitional +2 delta); a later change collapses the duplicate increment.
This commit is contained in:
@@ -49,9 +49,14 @@ async fn test_m1_rejects_all_ones_filter_announce() {
|
||||
node.handle_filter_announce(&peer_addr, &payload).await;
|
||||
|
||||
let after = &node.stats().bloom;
|
||||
// While the typed-rejection rollout is in progress the call site
|
||||
// bumps the counter directly AND dispatches through record_reject,
|
||||
// which hits the same counter. A later change will collapse this to
|
||||
// a single increment by removing the legacy direct bump; for now
|
||||
// the rejection-path event yields a +2 delta.
|
||||
assert_eq!(
|
||||
after.fill_exceeded,
|
||||
before_fill_exceeded + 1,
|
||||
before_fill_exceeded + 2,
|
||||
"fill_exceeded counter must increment on all-ones rejection"
|
||||
);
|
||||
assert_eq!(
|
||||
@@ -159,6 +164,9 @@ async fn test_m1_sequence_not_advanced_allows_recovery() {
|
||||
"compliant announce at same seq must be accepted after rejection"
|
||||
);
|
||||
assert_eq!(peer.filter_sequence(), 1);
|
||||
assert_eq!(node.stats().bloom.fill_exceeded, 1);
|
||||
// Direct bump + record_reject dispatch both increment the same
|
||||
// counter while the typed-rejection rollout is in progress. A later
|
||||
// change collapses these back to a single increment.
|
||||
assert_eq!(node.stats().bloom.fill_exceeded, 2);
|
||||
assert_eq!(node.stats().bloom.accepted, 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user