rust-libp2p icon indicating copy to clipboard operation
rust-libp2p copied to clipboard

core/transport: Extend `MultiaddrNotSupported` error

Open mxinden opened this issue 3 years ago • 1 comments

I have had the problem multiple times where I pass a malformed Multiaddr to a hierarchy of Transport implementations (e.g. relayed addresses are tricky) and my Multiaddr is being denied via MutliaddrNotSupported.

Say I have the following address: /dns6/xxx/tcp/xxx/p2p/xxx/p2p-circuit/p2p/xxx. When I get a MultiaddrNotSupported I don't know whether this is due to:

  • The address being malformed for libp2p-relay.
  • The address being malformed for libp2p-dns.
  • The addresses resolved by libp2p-dns being malformed for libp2p-tcp.

In addition to not knowing where it has been denied, I don't know what the reason for denial was.

Extending MultiaddrNotSupported with something implementign Error would allow Transport implementations to add details to the error.

Originally posted by @mxinden in https://github.com/libp2p/rust-libp2p/pull/2289#discussion_r987176349

mxinden avatar Oct 04 '22 17:10 mxinden

Perhaps it might be worth picking up https://github.com/libp2p/rust-libp2p/issues/1533 again.

If we were to integrate with tracing, you would be able to see the span-stack of each message.

So instead of extending the error, we could add more logs which would allow you to see what happened. There are also crates like tracing-error which allow you to carry the span trace as a value.

Tools like jaeger allow you to visualise these span trees: Jaeger

thomaseizinger avatar Oct 05 '22 01:10 thomaseizinger