Skip to content

p2p: Improve error types #2193

@iostat

Description

@iostat

discovery_reducer.rs, line 378

All answer failures return InternalError. Can't distinguish between: network failure, peer rejection, relay failure, decryption failure, or timeout.

// TODO(binier): custom error
None => dispatcher.push(P2pConnectionOutgoingAction::AnswerRecvError {
    peer_id: target_public_key.peer_id(),
    error: P2pConnectionErrorResponse::InternalError,
}),

p2p_channels_effectful_effects.rs, lines 89-95

When an offer's embedded identity key doesn't match the expected public key, the same OfferDecryptError is dispatched as for actual decryption failures. This could indicate a malicious relayer or spoofed offer, but the error path doesn't distinguish.

Ok(offer) if offer.identity_pub_key != pub_key => {
    // TODO(binier): propagate specific error.
    // This is invalid behavior either from relayer or offerer.
    store.dispatch(P2pChannelsSignalingExchangeAction::OfferDecryptError {
        peer_id,
    });
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions