Repository navigation
GRAIN🌾 v0.8.4
Fixes and speedups from the weekly relay bench
Release · 11.30.2026
Full Changelog: v0.8.3...v0.8.4
The weekly relay bench turned up three problems in v0.8.3: refusals that weren't really refusals, multi-filter REQs that came back short, and live fan-out that fell behind under load. This release fixes all three, and makes most of the relay's hot path faster. Each one reproduces on v0.8.3 and is gone in this release's binary, tested locally with the bench's own tools. The next bench run will confirm it on the bench box.
⚙️ What you might notice
- A superseded replaceable event gets
duplicate:, notblocked:. Sending an older version of a replaceable or addressable event than the one stored is nowOK false "duplicate: ...". Nothing was wrong with the event; the relay already had a newer one. An event its author deleted is stillblocked:. - Each filter in a REQ gets its own limit. v0.8.3 made search filters share one limit with the rest of the REQ (#122). That starved later filters, so a REQ with several filters could come back short. Every filter now gets its own
limit, capped atmax_limit, as NIP-01 says. - A refused event gets its
OK falseand nothing else. grain used to follow it with a NOTICE repeating the reason.
⚡ Faster
Measured on one core, release binary against release binary:
- Queries return about twice as fast.
latest_100went from 927 to 2,055 a second,kindfrom 897 to 2,127, multi-filter from 688 to 1,307. grain used to write each message to the socket on its own. It now writes everything queued for a connection in one go. - Live fan-out keeps up. Live subscriptions are indexed by kind, author and tag, so a new event isn't checked against every open filter. With 1,000 subscribers at 2,000 events a second, v0.8.3 fell about 15 seconds behind and dropped deliveries. v0.8.4 delivers all of them, p99 56 ms.
- Ingest is about 1.4x faster, and duplicates about 5x. Each signature is checked once, in C, on the exact bytes nostrdb stores, and only after the duplicate lookup. Before, a new event was checked twice and a duplicate paid for a check it didn't need.
- An EVENT is decoded once.
🧪 Tests and CI
- The Go package tests now run in CI. Until now CI only ran the Docker integration suite, so tests like the ack-after-commit ones never ran there. Every push now builds nostrdb, checks gofmt, runs
go vet, and runs the package tests under the race detector. A release waits for them too. - New handler tests cover EVENT, REQ, CLOSE, COUNT, AUTH and deletion against a real nostrdb.
- New end-to-end tests run the relay over real websockets: pipelined publishing, stored queries, live fan-out and CLOSE.