Skip to content

DHT BatchStore handler: admission + two-stage rate-limit accounting #1616

Closed

Description

@alpergundogdu

DHT BatchStore handler (crates/protocol/src/dht.rs:28,179,308): ADR 022 discriminants 4/5 exist as wire types only; inbound BatchStore is closed with APP_ERR_UNSUPPORTED_MESSAGE and senders fall back to per-hash Store. Correct but chatty; the deferred handler (admission + two-stage rate-limit accounting) is untracked.

Split from #1565.

Activity

  1. added
    rust
    prio:low
    on Aug 5, 2026
  2. github-actions commented on Aug 5, 2026

    @github-actions

    🎯 Triage report

    This is a concrete, well-scoped deferred implementation task split from #1565. The BatchStore wire types (ADR 022 discriminants 4/5) are already defined in crates/protocol/src/dht.rs; the missing piece is the handler-side admission logic — two-stage rate-limit accounting on DhtRateLimiter plus the publisher-side fallback cache. Issue #648 (now closed/completed) covered the same ground but was closed as completed in May 2026 — it's worth verifying whether that work actually landed or was closed prematurely before starting fresh implementation.

    📊 Assessment

    Dimension Value Reasoning
    Type Task Deferred implementation with clear acceptance criteria inherited from ADR 022 / #648
    Labels technical, rust, low (existing) Already correctly labeled; no changes needed
    Coding agent Suitable Clear scope: extend DhtRateLimiter, replace stub handler arm, add per-receiver unsupported_until cache. Wire types and ADR ACs 17-20 provide well-defined success criteria

    🔗 Similar issues

    💡 Notes and suggestions

    Before starting, verify #648's closure:

    • Check whether DhtRateLimiter has a partial-admit method and whether read_dht_request still sends APP_ERR_UNSUPPORTED_MESSAGE for BatchStore.
    • crates/node/src/handlers/dht.rs — look for the BatchStore arm in read_dht_request.
    • crates/protocol/src/dht.rs:28,179,308 — wire type stubs mentioned in issue body.

    Implementation checklist (from ADR 022 ACs 17-20):

    • Replace APP_ERR_UNSUPPORTED_MESSAGE arm in read_dht_request with real handler routing BatchStore through RecordStore::insert_at per-hash
    • Add partial_admit(n: usize) -> (usize, bool) (or equivalent) method on DhtRateLimiter for two-stage token consumption
    • Enforce hashes.len() > 256 → MALFORMED_MESSAGE (0x03) rejection (AC 19)
    • Add outbound client::batch_store primitive in the publisher path
    • Add per-receiver unsupported_until: Option<Instant> fallback cache (AC 20)

    References:

    • adr/022-content-discovery.md §STORE Flow and §DHT Bandwidth Analysis
    • crates/protocol/src/dht.rs — BatchStoreRequest, BatchStoreAck, MAX_BATCH_STORE_HASHES
    • crates/node/src/handlers/dht.rs — current stub rejection arm

    Generated by Agentic Triage for #1616 · sonnet46 · 15.1 AIC · ⌖ 5.67 AIC · ⊞ 6K · ◷

    Add this agentic workflow to your repo

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/issue-triage.md@94ec5db57374c5b04a4b8eef8b4413f9af44d63f
    
  3. moved this from Backlog to Done in deCDNon Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

prio:lowrust

Type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions