Skip to content

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Jul 18, 2025

🎉 This pull request has been checked successfully and will be merged soon. 🎉

Branch unstable (9e587bd) and #432 are embarked together for merge.

This pull request has been created by Mergify to speculatively check the mergeability of #432.
You don't need to do anything. Mergify will close this pull request automatically when it is complete.

Required conditions of queue default for merge:

Required conditions to stay in the queue:

---
previous_failed_batches: []
pull_requests:
  - number: 432
...

diegomrsantos and others added 10 commits July 16, 2025 18:05
This commit fully integrates the peer blocking features from the block-peers branch
into the new modular peer manager architecture. Key changes:

Blocking Infrastructure:
- Add BlockingManager wrapping libp2p-allow-block-list for connection denial
- Integrate blocking checks into all connection handlers (pending/established)
- Add automatic peer unblocking after RETAIN_SCORE_EPOCH_MULTIPLIER duration

Score-Based Blocking:
- Implement check_and_block_peers_by_score() to automatically block peers
  with gossipsub scores below GRAYLIST_THRESHOLD
- Integrate peer score checking into heartbeat system for periodic execution
- Automatically disconnect blocked peers immediately

Connection Prevention:
- Update should_dial_peer() to check blocked peers before dialing
- Filter blocked peers in discovery and subnet peer selection
- Ensure all connection paths respect the blocked peer list

Event System Updates:
- Replace ConnectActions events with PeerManagerHeartbeat events
- Consolidate peer management actions and score checking into single heartbeat
- Update Network to handle new event structure with integrated score checking

API Cleanup:
- Remove unused manual blocking API methods (block_peer, unblock_peer)
- Keep essential methods for score-based blocking and status queries
- Maintain clean separation between manual and automatic blocking

The implementation ensures that peers with poor gossipsub scores are automatically
blocked and prevented from connecting, while maintaining the modular architecture
and ensuring no behavioral changes from the original peer manager.
- Remove redundant HeartbeatManager::heartbeat() wrapper function
- Consolidate all heartbeat logic directly in PeerManager::heartbeat()
- Simplify HeartbeatManager to only handle timing (poll_tick)
- Clean up unused imports in heartbeat.rs
- Improve code organization with clear separation of concerns:
  - HeartbeatManager: Timer management only
  - PeerManager: All heartbeat logic and orchestration
  - PeerDiscovery: Peer discovery/connection logic

This eliminates an unnecessary layer of indirection and centralizes
heartbeat functionality for better maintainability.
@mergify mergify bot closed this Jul 18, 2025
@mergify mergify bot deleted the mergify/merge-queue/7d37ff460a branch July 18, 2025 10:52
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