Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: Merge NegociatedError with SubstreamError #128

Open
Tracked by #140
lexnv opened this issue May 28, 2024 · 0 comments
Open
Tracked by #140

error: Merge NegociatedError with SubstreamError #128

lexnv opened this issue May 28, 2024 · 0 comments

Comments

@lexnv
Copy link
Collaborator

lexnv commented May 28, 2024

litep2p/src/error.rs

Lines 42 to 121 in 467a457

pub enum Error {
#[error("Peer `{0}` does not exist")]
PeerDoesntExist(PeerId),
#[error("Peer `{0}` already exists")]
PeerAlreadyExists(PeerId),
#[error("Protocol `{0}` not supported")]
ProtocolNotSupported(String),
#[error("Address error: `{0}`")]
AddressError(AddressError),
#[error("Parse error: `{0}`")]
ParseError(ParseError),
#[error("I/O error: `{0}`")]
IoError(ErrorKind),
#[error("Negotiation error: `{0}`")]
NegotiationError(NegotiationError),
#[error("Substream error: `{0}`")]
SubstreamError(SubstreamError),
#[error("Substream error: `{0}`")]
NotificationError(NotificationError),
#[error("Essential task closed")]
EssentialTaskClosed,
#[error("Unknown error occurred")]
Unknown,
#[error("Cannot dial self: `{0}`")]
CannotDialSelf(Multiaddr),
#[error("Transport not supported")]
TransportNotSupported(Multiaddr),
#[error("Yamux error for substream `{0:?}`: `{1}`")]
YamuxError(Direction, crate::yamux::ConnectionError),
#[error("Operation not supported: `{0}`")]
NotSupported(String),
#[error("Other error occurred: `{0}`")]
Other(String),
#[error("Protocol already exists: `{0:?}`")]
ProtocolAlreadyExists(ProtocolName),
#[error("Operation timed out")]
Timeout,
#[error("Invalid state transition")]
InvalidState,
#[error("DNS address resolution failed")]
DnsAddressResolutionFailed,
#[error("Transport error: `{0}`")]
TransportError(String),
#[error("Failed to generate certificate: `{0}`")]
CertificateGeneration(#[from] crate::crypto::tls::certificate::GenError),
#[error("Invalid data")]
InvalidData,
#[error("Input rejected")]
InputRejected,
#[error("WebSocket error: `{0}`")]
WebSocket(#[from] tokio_tungstenite::tungstenite::error::Error),
#[error("Insufficient peers")]
InsufficientPeers,
#[error("Substream doens't exist")]
SubstreamDoesntExist,
#[error("`str0m` error: `{0}`")]
WebRtc(#[from] str0m::RtcError),
#[error("Remote peer disconnected")]
Disconnected,
#[error("Channel does not exist")]
ChannelDoesntExist,
#[error("Tried to dial self")]
TriedToDialSelf,
#[error("Litep2p is already connected to the peer")]
AlreadyConnected,
#[error("No addres available for `{0}`")]
NoAddressAvailable(PeerId),
#[error("Connection closed")]
ConnectionClosed,
#[error("Quinn error: `{0}`")]
Quinn(quinn::ConnectionError),
#[error("Invalid certificate")]
InvalidCertificate,
#[error("Peer ID mismatch: expected `{0}`, got `{1}`")]
PeerIdMismatch(PeerId, PeerId),
#[error("Channel is clogged")]
ChannelClogged,
#[error("Connection doesn't exist: `{0:?}`")]
ConnectionDoesntExist(ConnectionId),
}

lexnv added a commit that referenced this issue Aug 21, 2024
… error reporting (#206)

The purpose of this PR is to pave the way for making the Identify
protocol more robust, which is currently linked with the low number of
peers and connective issues over a long period of time
- paritytech/polkadot-sdk#4925

This PR adds a coherent `DialError` that exposes the minimal information
users need to know about dial failures.
- paritytech/polkadot-sdk#5239

A new litep2p event is added for reporting multiple dial errors that
occur on different protocols back to the user:

```rust
    /// A list of multiple dial failures.
    ListDialFailures {
        /// List of errors.
        ///
        /// Depending on the transport, the address might be different for each error.
        errors: Vec<(Multiaddr, DialError)>,
    },
```

This event eases the debugging of substrate connectivity issues. At the
same time, it can be used in a future PR to inform back to the Identify
protocol which self-reported addresses of some peers are unreachable:
- #203

### Next Steps
- Add more tests
- Warp sync + sync full nodes since this is touching individual
transports

### Future Work
- The overarching `litep2p::Error` needs a closer look and a
refactoring:
  - #204
  - #128
  
- ConnectionError event for individual transports can be simplified:
  - #205
  
- I've observed some inconsistencies in handling TCP vs WebSocket
connection timeouts. I believe that we can have another pass and share
even more code between them:
  - #70

---------

Signed-off-by: Alexandru Vasile <[email protected]>
Co-authored-by: Dmitry Markin <[email protected]>
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

No branches or pull requests

1 participant