Skip to content

Node-local client acceptance policy: de-prioritize / rate-limit / reject keys with elevated voucher-withhold history #482

Closed

Description

@alpergundogdu

Background

ADR 003 §Corrupted delivery (per PR #480) frames per-encounter wire risk as bounded by voucher_interval on each side, with node-local acceptance policy as the right place to handle persistent client misbehavior:

Both sides set local acceptance policies — nodes refuse continued service to keys with elevated voucher-withhold rates and may cap total bytes for keys without established history […] without protocol-level coordination. Client reputation is a node-local concern; this ADR does not specify a wire format or on-chain surface for it.

This issue tracks the node-side implementation so the framing in ADR 003 has a concrete realization.

Goals

Track per-channel-funder reputation locally and apply progressively stricter responses to bad actors:

  1. Track voucher-completion ratio per channel.client address over a sliding window (e.g. last 100 streams or last 7 days, whichever is smaller). A "withheld" stream = bytes shipped, no voucher returned for the corresponding window.
  2. Three-tier response:
    • Trusted (high completion ratio, established history): full service.
    • Untrusted-new (no history, or borderline ratio): cap total bytes per encounter (e.g. 1 GB before requiring a completed voucher cycle), apply a small admission rate-limit.
    • Rejected (sustained withhold pattern): refuse StreamRequest outright — return StreamResponse{ok: false, redirect: 0} or QUIC reset.
  3. Sybil resistance is structural (channel-open cost on L2 + minimum funded amount), so the policy doesn't need cryptographic anti-Sybil — just persistent local accounting.

Suggested implementation seam

crates/node's admission path. Probably a small new struct in crates/incentive (since vouchers live there) — e.g. ClientReputationLedger keyed by Address with:

  • completion_ratio_ewma: f32 (alpha ~0.1, similar to ADR 008's reputation EWMA)
  • total_bytes_in_window: u64, last_seen_us: u64
  • methods: on_voucher_received(client, bytes), on_voucher_withheld(client, bytes), should_admit(client, requested_bytes) -> Admission where Admission = { Accept, AcceptCapped(u64), Reject }

Persistence: a small key-value file in the node's data dir; OK to lose on crash (the deterrent is statistical, not cryptographic).

Out of scope for this issue

  • Cross-node gossip of client reputation (would re-introduce the on-chain client-reputation surface ADR 003 explicitly avoids).
  • Slashing or any on-chain consequence — this stays node-local.
  • Specific threshold tuning — defaults can be conservative and tunable per node operator.

References

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions