Skip to content

tests: NIP-42 and NIP-98 have no unit tests, nostreamd has none, and LMDB recovery is untested #1215

Open

Description

@chappie-daemon

Measured on rewrite/main at ff045445. The security-relevant paths with no test at all:

  • crates/nostream-core/src/nip42.rs is 377 lines with zero test attributes and no mod tests. NIP-42 is the authentication path; the relay's handler tests cover the seven outcomes over the wire, but the module's own parsing and validation has no unit test, so a change that keeps the wire tests green while breaking an edge case in the module has nothing to fail.
  • crates/nostream-core/src/nip98.rs is 30 lines and has no direct test anywhere. verify is reached only through callers that exercise other behaviour.
  • crates/nostreamd/src has zero test attributes. The composition root — the place this repository has already been wrong once about which backend is wired — is untested by construction.
  • LMDB has no corruption, torn-write or crash-recovery test, and its rollback path is untested, so the failure mode that matters most for an embedded store is asserted only by the code's shape.
  • NIP-50 ranking has no dedicated test on either backend; the store's search tests assert membership and order on recorded rows, not the ranking itself against a fresh index.

Acceptance:

  • nip42.rs and nip98.rs each carry unit tests with inversions: a signature that verifies under one tag and not another, a replay outside the window, a NIP-98 token with the wrong u or a stale created_at.
  • nostreamd has a test that asserts the wired backend, so the "resolves the name then discards it" defect cannot recur silently.
  • An LMDB test opens a store, kills the process mid-write, and asserts the reopened environment is consistent — or documents why the guarantee comes from LMDB's own design and pins that with a test of the recovery path the code actually has.
  • NIP-50 ranking is asserted against a freshly built index on both backends, by rank position rather than membership.

Activity

  1. added
    rewrite
    rust
    on Nov 21, 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

    rewriterust

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions