Skip to content

node: separate the expired-capability refusal at admission, meter capability intake drops, add a wire-level intake test #2631

Closed

Description

@yigitdot

Summary

Three small hardening and test items for capability handling in the cdn/client/v1 handler (crates/node/src/handlers/client/). None of them changes the wire format.

1. Give the admission refusal for an expired capability its own outcome

The admission gate in dispatch.rs refuses a lane whose capability is inside the node expiry margin with ServeRejectReason::SignerCapExhausted. The voucher and preimage paths refuse the same condition with VoucherRejectReason::CapabilityExpired.

The client sees no difference: both admission causes go out as StreamError::Unfunded. The operator does see one. Both land in the signer_cap_exhausted outcome, and the remedy text for that outcome says to raise the signer cap. For an expired capability, the remedy is a fresh capability.

Proposed:

  • Add a node-local ServeRejectReason::CapabilityExpired that maps to StreamError::Unfunded, so the wire stays unchanged.
  • Record it under its own outcome label.
  • Update the outcome docs and the remedy text.

2. Meter capability intake drops

intake_capability drops a capability whose owner signature is not a recoverable EOA signature, is malformed, or recovers to an address other than the pool owner. Each drop only logs: at debug, or at warn for a wrong owner. No drop has a metric.

To the client, a dropped capability looks like an unknown-lane refusal, which is the same as an ordinary miss. So the operator cannot see how often intake drops capabilities, or why.

Proposed:

  • Add a labeled counter, for example decdn_capability_intake_dropped_total{reason}, with one label value per drop arm.
  • Keep the current log levels.

3. Add a wire-level test for an intake rejection

Intake rejections are covered only by unit tests that call intake_capability directly. Add a crates/node/tests/client_loopback.rs test that:

  • sends a bound request through dispatch, with a pool view wired, that carries a capability intake refuses (for example one signed by a key other than the pool owner);
  • asserts the refusal on the wire (unknown lane);
  • asserts that the lane store holds no row for the lane.

This guards against a future registration path that skips intake.

Acceptance criteria

  • An admission refusal for a capability inside the expiry margin records a distinct outcome label. The wire response is unchanged.
  • Each intake drop arm increments a labeled counter, and a unit test covers each label.
  • A loopback test covers one intake rejection end to end, including the lane-store check.
  • cargo clippy --workspace --all-targets -- -D warnings and cargo nextest run --workspace --no-fail-fast pass.

Activity

  1. added
    area:node
    area:payments
    kind:feature
    kind:test
    prio:low
    on Oct 26, 2026
  2. moved this from Backlog to In progress in deCDNon Nov 1, 2026
  3. added a commit that references this issue on Nov 1, 2026
  4. moved this from In progress to Done in deCDNon Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:nodearea:paymentskind:featurekind:testprio:low

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions