Skip to content

Conversation

@dmitry-markin
Copy link
Collaborator

@dmitry-markin dmitry-markin commented Aug 28, 2025

Because previously litep2p didn't send/receive PUT_VALUE ACKs, we can't just enable this mechanism — this would lead to failures when older remote peers don't behave up to spec. This PR deals with this situation by implementing a workaround to handle such peers:

  1. Track PUT_VALUE send successes instead of ACK responses to determine the query success.
  2. Ignore send errors when the remote doesn't read the PUT_VALUE ACK message.

This should be seen as a temporary measure until most of the networks updates to litep2p with PUT_VALUE ACK support (this PR or newer). Suggested timing is in a year after releasing the version with this PR. This is tracked by issue #429.

Builds upon #427.

@dmitry-markin dmitry-markin self-assigned this Aug 28, 2025
@dmitry-markin dmitry-markin requested a review from lexnv August 28, 2025 09:17
@dmitry-markin dmitry-markin changed the title kademlia: Workaround for dealing with missing PUT_VALUE ACKs implementation kademlia: Workaround for dealing with not implemented PUT_VALUE ACKs Aug 28, 2025
let query_id = match action {
// `SendFindNode` includes `FIND_NODE`, `GET_VALUE` and `GET_PROVIDERS`
// queries.
PeerAction::SendFindNode(query_id)
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: Maybe we could add the fn query_id() in the PeerAction?

Copy link
Collaborator

@lexnv lexnv left a comment

Choose a reason for hiding this comment

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

LGTM!

Base automatically changed from dm-put-record-success to master November 11, 2025 11:04
@dmitry-markin dmitry-markin merged commit a57a1d4 into master Nov 11, 2025
8 checks passed
@dmitry-markin dmitry-markin deleted the dm-put-record-substream-tracking branch November 11, 2025 11:36
@github-project-automation github-project-automation bot moved this to Blocked ⛔️ in Networking Nov 11, 2025
dmitry-markin added a commit that referenced this pull request Nov 11, 2025
Track success of `ADD_PROVIDER` queries and emit `AddProviderSuccess` &
`QueryFailed` events.

This PR adds tracking of the last stage of `ADD_PROVIDER` query: putting
provider records to the target peers. Because libp2p spec doesn't have
`ADD_PROVIDER` ACK messages, we track only that the requests were sent
out to the target peers without errors. `Quorum` is respected when
determining whether the query was successful or not.

Builds upon #430.
dmitry-markin added a commit that referenced this pull request Nov 11, 2025
## [0.12.0] - 2025-11-11

This release adds `KademliaEvent::PutRecordSuccess` &
`KademliaEvent::AddProviderSuccess` events to Kademlia, allowing to
track whether publishing a record or a provider was successfull. While
`PutRecordSuccess` was present in the previous versions of litep2p, it
was actually never emitted. Note that `AddProviderSuccess` and
`QueryFailed` are also generated during automatic provider refresh, so
those may be emitted for `QueryId`s not known to the client code.

### Added

- kademlia: Track success of `ADD_PROVIDER` queries
([#432](#432))
- kademlia: Workaround for dealing with not implemented `PUT_VALUE` ACKs
([#430](#430))
- kademlia: Track success of `PUT_VALUE` queries
([#427](#427))

### Fixed

- Identify: gracefully close substream after sending payload
([#466](#466))
- fix: transport context polling order
([#456](#456))

### Changed

- refactor: implement builder pattern for TransportManager
([#453](#453))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Blocked ⛔️

Development

Successfully merging this pull request may close these issues.

3 participants