• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

cameri / nostream / 46675915412
78%
main: 81%

Build:
Build:
LAST BUILD BRANCH: rewrite/main
DEFAULT BRANCH: main
Ran 01 Dec 2026 03:13PM UTC
Jobs 2
Files 322
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

01 Dec 2026 03:10PM UTC coverage: 77.855% (-0.005%) from 77.86%
46675915412

push

github

web-flow
test(relay): pin the handler's PoW rate conversion at non-zero rates (#1263) (#1343)

## Description

Pins the event handler's dynamic PoW rate conversion at a non-zero rate
with a socket-level test where accepted events advance `context.pow` and
raise required difficulty above the floor.

## Related Issue

Closes #1263

## Motivation and Context

In `crates/nostream-relay/src/handlers/event.rs`, `context.pow` computes
the current events-per-second rate and passes it to
`required_difficulty(Some(limits), rate, None)`. Previously, all
socket-level tests ran at a rate of zero (`HandlerContext.pow` starts
empty and was never advanced in tests), meaning substituting the literal
`0.0` for that conversion would leave the whole suite green.

This PR adds:
- A socket-level test in `tests/handlers.rs` where an accepted event
advances `context.pow` under `target_events_per_second: 0.01`, verifying
that the gate dynamically raises required difficulty above the floor and
rejects a subsequent event.
- A unit test in `handlers/event.rs` verifying `required_difficulty`
scaling at rates above target.

## How Has This Been Tested?

- Ran socket-level tests in `crates/nostream-relay/tests/handlers.rs`:
- `cargo test -p nostream-relay --test handlers --
the_handler_scales_difficulty_above_floor_as_accepted_events_arrive`
(passed)
  - `cargo test -p nostream-relay --test handlers` (67/67 passed)
- Ran unit tests:
  - `cargo test -p nostream-relay --lib` (30/30 passed)
- Ran formatting and lints:
  - `cargo fmt --all --check`
- `cargo clippy -p nostream-relay --all-targets --all-features -- -D
warnings`
  - Strict clippy with `-D clippy::unwrap_used -D clippy::expect_used`

## Types of changes

- [x] Non-functional change (docs, style, minor refactor)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)

## Checklist... (continued)

4634 of 6495 branches covered (71.35%)

Branch coverage included in aggregate %.

10012 of 12317 relevant lines covered (81.29%)

748.37 hits per line

Jobs
ID Job ID Ran Files Coverage
1 Integration - 46675915412.1 01 Dec 2026 03:13PM UTC 322
32.46
GitHub Action Run
2 Unit - 46675915412.2 01 Dec 2026 03:15PM UTC 322
75.36
GitHub Action Run
Source Files on build 46675915412
  • Tree
  • List 322
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #46675915412
  • ead3997e on github
  • Prev Build on rewrite/main (#46412195511)
  • Next Build on rewrite/main (#46936313438)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc