MatrixAI / Polykey

Polykey Core Library
https://polykey.com
GNU General Public License v3.0
29 stars 4 forks source link

Add clearer warning when failing to resolve seedNodes via DNS #752

Open tegefaulkes opened 3 weeks ago

tegefaulkes commented 3 weeks ago

Specification

During testing we found the warning WARN:polykey:No seednodes could be found for for mainnet.polykey.com This comes from resolveSeednodes src/nodes/utils.ts:427.

cmcdragonkai ➜ matrix-framework-13-ryzen-7040  ➜ ~/Projects/Polykey-CLI
 $ node ./dist/polykey.js agent start
✔ Please enter the password … ******
WARN:polykey:No seednodes could be found for for mainnet.polykey.com
(node:103397) [DEP0112] DeprecationWarning: Socket.prototype._handle is deprecated
(Use `node --trace-deprecation ...` to show where the warning was created)
pid           103397
nodeId        vcj3ufun2506jn44q7rr9bc1hv4c6eebicusfj1bl9sr27ookknlg
clientHost    ::1
clientPort    39329
agentHost     ::
agentPort     43009
WARN:polykey.PolykeyAgent.task v0pjgubeia5o0182k4d99n8vep4:Failed - Reason: ErrorUtilsUndefinedBehaviour

This was a result of the tailscale magic DNS acting up and preventing the ability to resolve the seed node addresses via DNS. As far as the behaviour goes, this is working as intended. However the messaging can be improved.

We need to be clearer with the following details

  1. The failure was due to DNS failing to resolve.
  2. Failing to resolve any seed nodes without proving a list of the directly with the seedNodes error will cause the syncNodeGraph logic to skip entirely. So we wont get any warnings about a failure at that stage.
  3. Connections can still be made automatically using details in the NodeGraph. These will trigger in the background.

We can also look into actively using the nodeGraph as a fallback for entering the network. We can use either the closest nodes to us as the starting set, Nodes we've succeeded via direct connections in the past. Or keep better track of seed nodes in the graph and use them. Needs some discussion.

Tasks

  1. Modify the warning to be much clearer why things failed. Include details about the error that caused it.
  2. Add an info message that shares details when resolving via DNS succeeds.
  3. Look into using the nodeGraph entries as a fallback seednode list if resolving fails.
linear[bot] commented 3 weeks ago

ENG-350 Add clearer warning when failing to resolve seedNodes via DNS