Skip to content

Test strfry + noteguard relay with allowed_kinds filter #13

@alltheseas

Description

@alltheseas

Objective

Validate the bugstr relay setup using strfry + noteguard with the new allowed_kinds filter that only accepts crash report event kinds (10420, 10421, 10422).

Background

  • strfry: High-performance C++ nostr relay with plugin support
  • noteguard: Rust-based filter plugin system for strfry
  • allowed_kinds filter: New filter (PR pending to alltheseas/noteguard) that allowlists specific event kinds

Prerequisites

  • Linux machine (strfry has Linux-specific dependencies like inotify)
  • Docker installed
  • Rust toolchain installed
  • nak CLI tool for nostr testing

Setup Instructions

1. Clone repositories

mkdir bugstr-relay-test && cd bugstr-relay-test
git clone https://github.com/alltheseas/noteguard.git
git clone https://github.com/hoytech/strfry.git

2. Build noteguard with allowed_kinds filter

cd noteguard
git checkout feat/allowed-kinds-filter  # or apply the PR
cargo build --release
cp target/release/noteguard ../
cd ..

3. Build strfry

cd strfry
git submodule update --init
make setup-golpe
make -j4
cp strfry ../
cd ..

4. Create configuration files

noteguard.toml:

pipeline = ["allowed_kinds", "ratelimit"]

[filters.allowed_kinds]
kinds = [10420, 10421, 10422]
message = "blocked: only crash reports (kinds 10420, 10421, 10422) are accepted on this relay"

[filters.ratelimit]
posts_per_minute = 60
message = "rate-limited: too many crash reports"

strfry.conf (key sections):

db = "./strfry-db/"

relay {
    bind = "0.0.0.0"
    port = 7777

    info {
        name = "bugstr-test"
        description = "Bugstr crash report relay - only accepts kinds 10420, 10421, 10422"
    }

    writePolicy {
        plugin = "./noteguard"
    }
}

5. Start the relay

mkdir -p strfry-db
./strfry relay

Test Cases

Test 1: Regular note (kind 1) should be REJECTED

nak event -k 1 -c "test note" ws://localhost:7777

Expected: Event rejected with message "blocked: only crash reports (kinds 10420, 10421, 10422) are accepted on this relay"

Test 2: Crash report direct (kind 10420) should be ACCEPTED

nak event -k 10420 -c '{"app":"test","version":"1.0","error":"test crash"}' ws://localhost:7777

Expected: Event accepted, can be queried back

Test 3: Crash report manifest (kind 10421) should be ACCEPTED

nak event -k 10421 -c '{"chunks":["abc123"]}' ws://localhost:7777

Expected: Event accepted

Test 4: Crash report chunk (kind 10422) should be ACCEPTED

nak event -k 10422 -c 'base64encodedchunkdata' ws://localhost:7777

Expected: Event accepted

Test 5: DM (kind 4) should be REJECTED

nak event -k 4 -c "secret message" ws://localhost:7777

Expected: Event rejected

Test 6: Rate limiting works

for i in {1..100}; do
  nak event -k 10420 -c "crash $i" ws://localhost:7777 &
done
wait

Expected: After ~60 events/minute, subsequent events should be rate-limited

Test 7: Query accepted events

nak req -k 10420 ws://localhost:7777

Expected: Returns previously accepted crash report events

Verification Checklist

  • strfry starts without errors
  • noteguard loads configuration correctly
  • Kind 1 events are rejected with correct message
  • Kind 10420 events are accepted
  • Kind 10421 events are accepted
  • Kind 10422 events are accepted
  • Other kinds (4, 7, 30023, etc.) are rejected
  • Rate limiting kicks in at configured threshold
  • Accepted events persist and can be queried

Known Issues

  • macOS + Colima: Websocket connections may fail with "Resource temporarily unavailable". Use native Linux instead.
  • strfry on macOS: Does not compile due to inotify dependency. Use Docker on Linux or native Linux.

Related

  • noteguard PR: alltheseas/noteguard#TBD (allowed_kinds filter)
  • Bugstr event kinds: 10420 (direct), 10421 (manifest), 10422 (chunk)
  • NIP-40: Event expiration (30 day auto-delete)

Files

Docker-based setup files available at: zapstorebugstr/strfry-docker/

  • Dockerfile - Multi-stage build combining strfry + noteguard
  • config/strfry.conf - Relay configuration
  • config/noteguard.toml - Filter configuration

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions