Skip to content

Conversation

@kaimast
Copy link
Contributor

@kaimast kaimast commented Oct 1, 2025

Fixes #3893.

The main purpose of this PR is to propagate errors during handshakes up, so the error is logged at the appropriate location. It also enables filtering out benign errors such as "Already connecting".

Additionally, the PR adds a four new disconnect reasons "already connecting", "already connected", "connecting to myself", "no untrusted external peers allowed". This avoids those confusing peer disconnected before sending "Message::ChallengeResponse" messages.

@ljedrz
Copy link
Collaborator

ljedrz commented Oct 1, 2025

Some of the goals of this PR are achieved with #3900 (which is also a bugfix). In addition, I can see that some of the changes here are conflicting with the aforementioned PR, which deduplicates some of the related code.

That being said, the idea to introduce a new, concrete error type is solid, and so is the Result change in the Handshake protocol. Since I've been tinkering with peering quite a lot lately, my recommendation would be as follows:

  1. close this PR for now, as the code it is applied to can still be compacted, making the change surface smaller
  2. simplify/deduplicate the network-related code further (we still have plenty of duplicate functionalities between the Gateway and the Router)
  3. update and extend the connectivity/peering tests to make sure they cover everything we need (it's been a long time since their introduction)
  4. reconsider these changes and apply them in small chunks, without any unrelated adjustments

@vicsn
Copy link
Collaborator

vicsn commented Oct 1, 2025

Agreed with all of the above except:

simplify/deduplicate the network-related code further (we still have plenty of duplicate functionalities between the Gateway and the Router)

Please no refactors unless agreed upon and resolving an existing issue.

@ljedrz
Copy link
Collaborator

ljedrz commented Oct 1, 2025

Please no refactors unless agreed upon and resolving an existing issue.

Fair enough; I was mostly thinking about the prospect of a new node type (BootstrapClient), and some of the existing issues (like #3888), which are likely to naturally lead to such a result.

@kaimast kaimast force-pushed the fix/already-connecting branch 5 times, most recently from 2540eb9 to a43475f Compare October 1, 2025 21:49
@kaimast kaimast force-pushed the fix/already-connecting branch 2 times, most recently from 6e30d1b to d5b7767 Compare October 15, 2025 04:40
@kaimast kaimast force-pushed the fix/already-connecting branch 2 times, most recently from a44a36e to 3772564 Compare November 6, 2025 02:49
@kaimast kaimast force-pushed the fix/already-connecting branch from 3772564 to 9ca9004 Compare November 13, 2025 23:23
@kaimast kaimast force-pushed the fix/already-connecting branch from 9ca9004 to 9d514fd Compare November 27, 2025 02:53
@kaimast kaimast force-pushed the fix/already-connecting branch from 9d514fd to cddd288 Compare December 3, 2025 19:37
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.

[Bug] Remove/reduce "already connecting to node" warnings

4 participants