Skip to content

[codex] fix gossip rate limit bounds#1485

Open
jjyr wants to merge 1 commit into
nervosnetwork:developfrom
jjyr:codex/fix-gossip-rate-limit-bounds
Open

[codex] fix gossip rate limit bounds#1485
jjyr wants to merge 1 commit into
nervosnetwork:developfrom
jjyr:codex/fix-gossip-rate-limit-bounds

Conversation

@jjyr

@jjyr jjyr commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • reject new inbound channel-update limiter keys when tracked keys are full, after pruning idle keys
  • count inbound limiter drops as PolicyRejectedMessage so sustained abuse reaches the gossip ban path
  • add per-peer and global queued-byte budgets for delayed outbound gossip payloads

Root Cause

The inbound limiter was keyed by (peer, channel_outpoint, is_node1), but remote peers control channel_outpoint. When the tracked-key cap was reached, the limiter evicted an older key and admitted the new one, so unique bogus outpoints could keep feeding pending gossip work.

The delayed outbound queue was capped by item count only. Large delayed GetBroadcastMessagesResult and QueryBroadcastMessagesResult payloads could still accumulate with unclear memory bounds.

Validation

  • cargo nextest run -p fnn --features rocksdb -E 'test(test_channel_update_limiter_rejects_new_keys_when_full) | test(test_delayed_outbound_queue_rejects_peer_byte_budget_overflow) | test(test_delayed_outbound_queue_rejects_global_byte_budget_overflow) | test(test_rate_limited_channel_update_from_no_channel_peer_triggers_disconnect_and_temp_ban)'
  • cargo nextest run -p fnn --features rocksdb -E 'test(test_channel_update_limiter_prunes_idle_keys_before_accepting_new_key) | test(gossip_policy)'
  • cargo fmt --all -- --check
  • CARGO_BUILD_JOBS=1 cargo clippy -p fnn --features rocksdb --lib -- -D warnings

@jjyr jjyr force-pushed the codex/fix-gossip-rate-limit-bounds branch from babd37f to 771db35 Compare June 22, 2026 10:03
@jjyr jjyr force-pushed the codex/fix-gossip-rate-limit-bounds branch from 771db35 to 27fc94c Compare June 22, 2026 10:17
@jjyr jjyr marked this pull request as ready for review June 22, 2026 10:22
@jjyr jjyr requested a review from quake June 23, 2026 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant