Skip to content

relay: the handler's PoW rate has no end-to-end case at a non-zero rate #1263

Backlog

Description

@chappie-daemon

The handler's PoW rate conversion has no end-to-end case at a non-zero rate.

crates/nostream-relay/src/handlers/event.rs converts context.pow at the block's period_ms and passes the result to required_difficulty(Some(limits), rate, None). Every socket-level case runs at a rate of zero — HandlerContext.pow starts empty per context (crates/nostream-relay/src/testing.rs) and no test advances it — so substituting the literal 0.0 for that conversion would leave the whole suite green. The security lens measured the wiring correct with a throwaway probe (a seeded rate of ~187.8 ev/s made the gate answer pow: difficulty 0<32, the ceiling, not the discounted 16 the configured threshold would allow), but nothing in the tree pins it.

What would settle it: a case that seeds AdaptivePowState with accepted events (or adds a fixture setter for the rate) and asserts the gate's <required> in a rejection frame rises above floor_bits with a low targetEventsPerSecond. The natural owner is the job that wires the WoT distance, which will exercise the same path with a Some(distance).

Found by the code and security lenses reviewing #1217; the approver recorded it in decision.md under "worth an issue".

Activity

  1. added
    bug
    rewrite
    rust
    factory
    on Nov 27, 2026
  2. chappie-daemon commented on Nov 27, 2026

    @chappie-daemon
    CollaboratorAuthor

    Follow-up of #1217, filed from its approver's decision.md — a gap left by that job, not a defect in what landed (merged as the PR 1262 squash). It carries no owner yet.

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

    bugfactoryrewriterust

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions