From a84ae9f2a241a9ab5239ffad23537d3c0be1ccfc Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Sat, 10 Jan 2026 00:29:46 +0000 Subject: fix: reduce log noise for expected state event rejections during sync State events from remote relays for repos we don't host are expected rejections during proactive sync. Changed to only WARN for user-submitted events (potential misconfiguration/attack) while using DEBUG for synced events (normal operation). This reduces log noise from ~1967 warnings to <10 warnings in a 30-second production sync test, making real issues visible again. --- src/nostr/policy/state.rs | 45 ++++++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/nostr/policy/state.rs b/src/nostr/policy/state.rs index b850e7b..f94f004 100644 --- a/src/nostr/policy/state.rs +++ b/src/nostr/policy/state.rs @@ -81,12 +81,21 @@ impl StatePolicy { // CRITICAL: Check if author is authorized via maintainer set // State events MUST be rejected if author is not in maintainer set of any accepted announcement if db_repo_data.announcements.is_empty() { - tracing::warn!( - event_id = %event.id, - identifier = %state.identifier, - author = %event.pubkey.to_hex(), - "Rejecting state event: no announcement exists for this repository" - ); + if is_synced { + tracing::debug!( + event_id = %event.id, + identifier = %state.identifier, + author = %event.pubkey.to_hex(), + "Rejecting state event: no announcement exists for this repository" + ); + } else { + tracing::warn!( + event_id = %event.id, + identifier = %state.identifier, + author = %event.pubkey.to_hex(), + "Rejecting state event: no announcement exists for this repository" + ); + } return Ok(WritePolicyResult::Reject { status: false, message: "invalid: no announcement exists for this repository".into(), @@ -99,13 +108,23 @@ impl StatePolicy { ); if authorized_owners.is_empty() { - tracing::warn!( - event_id = %event.id, - identifier = %state.identifier, - author = %event.pubkey.to_hex(), - announcements_count = db_repo_data.announcements.len(), - "Rejecting state event: author not in maintainer set of any announcement" - ); + if is_synced { + tracing::debug!( + event_id = %event.id, + identifier = %state.identifier, + author = %event.pubkey.to_hex(), + announcements_count = db_repo_data.announcements.len(), + "Rejecting state event: author not in maintainer set of any announcement" + ); + } else { + tracing::warn!( + event_id = %event.id, + identifier = %state.identifier, + author = %event.pubkey.to_hex(), + announcements_count = db_repo_data.announcements.len(), + "Rejecting state event: author not in maintainer set of any announcement" + ); + } return Ok(WritePolicyResult::Reject { status: false, message: "invalid: author not authorized for this repository".into(), -- cgit v1.2.3