Description
To switch to a local query model, we need to move away from trusting remote relays.
There are many issues with what we are currently doing:
-
We don't check to see if the results returned from the relay actually match the query we sent. This enables rogue relays to inject ads or other bad data. This is particularily bad in the gossip model, since users can force clients to make requests to evil relays outside of the user's configured relay pool.
-
Since we don't check signatures on all note types (only profiles), this would enable users to spoof DMs. This is technically possible today but is mitigated by some level of trust in the current mega-relays.
-
We have to spin off async processes parse note contents once we get them off the wire. Swift's concurrency model is decent but it is still kind of annoying to delay timeline insertion based off a bunch of asyncronous tasks.
-
Since we're currently inserting data into nostrdb already we technically are doing twice the amount of processing work for no reason
Switching to a nostrdb for local queries fixes all of these issues:
-
All notes in nostrdb are validated, so we don't have to worry about spoofing
-
We don't have to worry about relays sending bad data, because we only ever query the local relay which we know will always match the query we are executing.
-
Local subscriptions are notified only after we parse note contents, so we don't have to wait for async processing to render the note.
-
nostrdb is much more efficient at ingesting notes, so we will save CPU and battery.
-
Having notes locally will allow us to use negentropy for keeping nostrdb nodes in sync.
This is already implemented in Damus notedeck and android, now we need to overhaul Damus iOS to support this model. This issue is for tracking this!
Once we switch to this model we can begin work on adding support for the gossip model!
Metadata
Metadata
Assignees
Labels
Type
Projects
Status