Skip to content

Correct peer penalty for publishing messages already in the network #573

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

Closed
wants to merge 21 commits into from

Conversation

AgeManning
Copy link
Member

Description

There is a possible race condition that can happen that results in us inadvertently penalizing a peer.

  • Message A gets published on the network
  • We receive an IHAVE for message A
  • We request an IWANT for message from Peer Z
  • We then publish message A
  • Peer Z responds with our requested message, but we ignore it as its now a duplicate
  • We penalize Peer Z for not responding to our IWANT.

This PR removes the promise for a message when we publish it.

RolandSherwin and others added 14 commits February 27, 2025 23:41
When a relay server has no more connection with a reserved client, it would remove the reservation and the drop the circuits without any information passed to the server. It will be useful to for a server to track all its reservations and to know when they're removed (without keeping track of the connections themselves).

This PR aims to notify the server when a reservation closes, with the emission of the following event
```
/// A reservation has been closed.
ReservationClosed { src_peer_id: PeerId },
```

Pull-Request: libp2p#5869.
There is a special `Idle connection timeout` section in the ping tutorial which says that we should include connection timeout settings, but the settings are not included.

I have checked previous versions and they had it so it was either lost by mistake, or the section is not relevant anymore.
This is a very minor PR to update the docs.

Pull-Request: libp2p#5893.
Deprecate support_draft_version field from QUIC protocol.

resolves libp2p#3395

Pull-Request: libp2p#5786.
This PR handles the `DialError::WrongPeerID` event in `identify` protocol.
Scenario:
Consider a network with two nodes, N1 and N2, where N2 periodically initiates a connection/substream to N1. Now, if N1 is shut down and a new node, N3, starts up on the same transport address but with a different keypair, the identify protocol in N2 will continue to associate the old (PeerId, Multiaddr) pair in its cache. However, since N1 no longer exists and N3 has a different identity, this cached entry is now invalid.

This PR ensures that the protocol properly detects and handles such situations, preventing stale peer information from causing connectivity issues.

Pull-Request: libp2p#5890.
Introduce `libp2p-peer-store` for a peer store implementation.

Related: libp2p#4103

Pull-Request: libp2p#5724.
This PR ensures that the node respects `IDONTWANT` messages that have already been received, when handling `IWANT`.

Pull-Request: libp2p#5901.
messages weren't forwarded to floodsub peers

Pull-Request: libp2p#5908.
Add edition to workspace Cargo.toml and Inherits workspace edition. Additionally, inherits rust-version in `libp2p-upnp` and `libp2p-websocket-websys`.

Pull-Request: libp2p#5896.
The `InsufficientPeers` error was unclear about whether it meant no peers were connected at all or no peers were subscribed to the topic. Rename it to `NoPeersSubscribedToTopic` to make it clear that this error occurs when trying to publish to a topic that has no subscribed peers.
Fixes libp2p#5907

Pull-Request: libp2p#5912.
This PR tries to fix [RUSTSEC-2025-0009](https://rustsec.org/advisories/RUSTSEC-2025-0009.html) in `libp2p-tls` and `libp2p-websocket` by bumping `rcgen`.

Note: Upgrading `rcgen` in `libp2p-webrtc` is non-trival, so it's not included in this PR.

Pull-Request: libp2p#5917.
@AgeManning AgeManning requested a review from jxs March 11, 2025 05:07
Copy link
Member

@pawanjay176 pawanjay176 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

@jxs jxs force-pushed the race-condition-publish-iwant branch from 6b6f3da to ab936ed Compare March 13, 2025 10:38
@AgeManning
Copy link
Member Author

Resolved upstream

@AgeManning AgeManning closed this Mar 27, 2025
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.