Skip to content

Conversation

sunwavesun
Copy link
Contributor

@sunwavesun sunwavesun commented Jul 30, 2025

Todo

  • Utilize AddTrustedNode
  • Ensure that trusted nodes are added regardless of the max limit (this might have to do with EOF issue)

Summary

In streammanager.go, discoverAndSetupStream establishes application-level protocols with peers from the peer store, including setting up underlying protocol connections. Meanwhile, AddTrustedNodes in host.go handles protocol handshakes and adds trusted nodes to the peer store. Currently, Start() is invoked before AddTrustedNodes, so trusted nodes may be missing from the peer store when discoverAndSetupStream runs, causing them to be skipped. To fix this, trusted nodes should be added to the peer storage during host creation, ensuring they are available during stream setup. With this change, AddTrustedNodes becomes unnecessary and can be removed.

EOF Issue

We suspect that failed to negotiate security protocol: EOF is triggered by resource exhaustion from an excessive number of connected peers. At present, thousands of nodes are subscribing to topics unrelated to the Harmony network, causing each Harmony node to maintain between 2,000 and 6,000 active connections. This load can overwhelm file descriptors, goroutines, and CPU/​memory resources, leading the connection manager to prune aggressively or reject new dials.

Note: A dedicated PR () will address the root cause—unrestricted random subscriptions—to prevent off-topic peers from joining our PubSub mesh.

Changes

host.go:

  • Remove AddTrustedNodes(), which adds the peer to peer storage and sets up the connection, from the main loop.
  • Add the trusted nodes to peer storage during new host creation, prior to stream connection.

streammanager.go:

  • Handle the trusted node stream establishment.
  • Skip trusted nodes during discovered peer stream connection.

@sunwavesun sunwavesun changed the title [WIP] Trusted Node Sync Fix Fix Trusted Node Peer Connection Aug 6, 2025
@sunwavesun sunwavesun changed the title Fix Trusted Node Peer Connection [Trusted Node] Ensure Trusted Node Creation and Prevent Duplicate Streams Aug 6, 2025
@sunwavesun sunwavesun marked this pull request as ready for review August 6, 2025 07:30
@sunwavesun sunwavesun self-assigned this Aug 6, 2025
@sunwavesun sunwavesun changed the title [Trusted Node] Ensure Trusted Node Creation and Prevent Duplicate Streams [WIP] Ensure Trusted Node Creation and Prevent Duplicate Streams Aug 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant