feat(wot): add web of trust graph service for NIP-02 follow distance - #745
Conversation
Signed-off-by: Priyanshubhartistm <bhartipriyanshustm@gmail.com>
Signed-off-by: Priyanshubhartistm <bhartipriyanshustm@gmail.com>
🦋 Changeset detectedLatest commit: 9806a5e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
I reviewed the pull request for the WoT graph service. The design is sound when the service is off or at the default depth. Two blocking issues prevent a merge. Both live in 1. A kind-3 event can start a full graph rebuild. When the seed, or any pubkey already in the graph, publishes a kind-3 event, Fix this in
2. One failed build breaks every later call.
Fix this in
Non-blocking items:
I ran the unit tests for this change. All 178 tests pass. |
Signed-off-by: Priyanshubhartistm <bhartipriyanshustm@gmail.com>
Re-review: fix-up verified (ca2da03)Thanks for addressing the review feedback. I re-read the diff at head Prior findings1. Full graph rebuild per kind-3 event, awaited in the event path — FIXED ✅
2. Rejected build promise poisoned
3. 4. 5. New-issue scanNo blocking issues introduced. The kind-3 interception in
CI
Verdict: APPROVE — both blockers fixed with correct implementations, non-blocking items addressed or honestly documented, failure/coalescing behavior now directly covered by specs. |
phoenix-server
left a comment
There was a problem hiding this comment.
Approve - both blocking issues fixed and verified, re-review clean.
Description
Adds a WotService that builds a trust graph rooted at an operator-configured seed pubkey, ingesting NIP-02 contact lists (kind 3). The graph is updated in real time as kind-3 events come in, exposes
getDistance(pubkey)isTrusted(pubkey)for other parts of the relay to query, and supports a configurable trust depth plus a minimum-followers threshold for anything past direct (1-hop) follows.Storage is Redis-backed (per-pubkey follow sets), with the in-memory graph rebuilt from Redis on demand and lazily primed from already-stored contact-list events in Postgres when a pubkey's follow set isn't cached
yet. Pure logic only, matching the issue's scope no background refresh worker is wired up in this PR.
Related Issue
Closes #626
Motivation and Context
Nostream has no way to filter or weight events by social trust today any pubkey can publish regardless of whether the relay owner actually knows them. This is the foundation piece: a queryable trust graph that later anti-spam work (adaptive PoW reductions, WoT-gated content reporting) can build on top of.