libp2p / libp2p/py-libp2p

discussion(kad-dht): monotonic sequence numbers for silent-withholding detection in GET_VALUE

Open
#1,385 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
624
Forks
256
Avg merge
1d 34m
Merged PRs (30d)
47

Description

Problem

A GET_VALUE eclipse doesn't require the adversarial closest-set to answer incorrectly — they can simply answer "no record," which is indistinguishable to the resolver from a key that was never published. Silent withholding is currently undetectable at the application layer.

This is distinct from routing-layer hardening (#1383, #1384): even with subnet diversity and disjoint paths in place, an attacker who legitimately occupies the closest-K set for a key can still withhold silently.

Proposal

If the publisher signs a monotonic sequence number into the record, and resolvers retain the highest sequence number seen per key across lookups, then silent withholding degrades from "invisible" to "serving a stale-but-valid record" — which a client can at least flag as suspicious or trigger a re-lookup.

go-libp2p's record.Validator already carries a Select method for exactly this purpose; the IPNS validator uses it to prefer higher sequence numbers. py-libp2p has libp2p/records/ipns.py and libp2p/records/validator.py which are the analogous entry points.

Rough scope

  • Extend Record (or a wrapper) to carry a seq: uint64 field
  • Publisher increments and signs seq on each PUT_VALUE
  • Resolver tracks max_seq_seen[key] in the value store; after a GET_VALUE that returns "not found," if max_seq_seen[key] is set, surface a "possible withholding" signal rather than a clean miss
  • IPNSValidator.Select already implements higher-sequence-wins preference — the DHT value store could adopt the same pattern

Why this is a discussion issue

This touches the record format (proto-level change) and implies clients need to persist max_seq_seen across sessions to be useful. It needs:

  1. Confirmation that the Record proto can be extended without breaking go-libp2p interop
  2. A decision on where sequence numbers live — inside the existing Record.value payload (IPNS already has them), or as a DHT-level wrapper
  3. Whether this is purely advisory (log a warning) or load-bearing (affect quorum logic in libp2p/kad_dht/kad_dht.py)

This is deliberately filed as a discussion before any implementation. Happy to draft a spec sketch if maintainers think the direction is worth pursuing.

Related

  • #1383 — subnet diversity in k-buckets (routing-layer hardening)
  • #1384 — disjoint lookup paths (path-steering hardening)
  • #57 — original eclipse attack discussion

/cc @acul71 @sumanjeet0012 @asmit27rai

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with libp2p/records/ipns.py and libp2p/records/validator.py, then inspect libp2p/kad_dht/kad_dht.py and the Record definition. Resolve whether sequence numbers belong in the existing value payload or a DHT-level wrapper, and whether withholding detection is advisory or affects quorum logic. Done means maintainers have an agreed design covering proto compatibility and persistence across sessions.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
distributed-systems, security
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.