-
Notifications
You must be signed in to change notification settings - Fork 634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft NIP for filter by time seen #79
Conversation
Will a client that uses this feature still work if the relay doesn't support it? |
Even though this looks like a harmless change I think it is a slippery slope if we add new querying capabilities for every new app that decides it needs new querying primitives to provide a better UX. I think the current filters are already too big and confusing and bloated, adding a new one dislikes me very much -- although I understand the need for it and it looks like a good thing. I've raised a point that wasn't addressed at #78 (comment), to which I want to add that Nostr cannot be expected to offer the same guarantees a centralized system can, so I think clients should embrace the looseness of everything and be prepared to deal with faulty relays, relays that go offline, relays that do not have all events you expect them to have, relays that delete events and relays that do not know how to count or order things. If clients are programmed to only work with pristine relays that work wonderfully that will seriously degrade the decentralization of the protocol and make it so in the end everybody will only be using the very good and fast and perfect Google relay. I am not saying that this change will ruin Nostr or that this change will necessarily open the door for more changes that will ruin Nostr. I cannot even at this time think of new querying primitives that anyone would want to add (but I hadn't thought of this one either, so I am sure people will be creating and come up with new ideas very soon). All I am saying is that we should be more mindful of trading the simplicity and openness of the protocol for better UX. |
Another small problem I see here: when implementing my JS and my Go libraries I did it such that the client library would automatically run events received from relays through the same filters it sent, so it would protect the application from faulty relays sending events invalid for the specified filter. With these clauses that same check can't be made. Again, it's a small thing, but just noting. |
Here is one suggestion that would fix all my concerns: instead of adding two new filters, For relays implementing this NIP (I refer here to my suggestion of NIP), a filter On the client side, clients that choose to implement this NIP (or activate it on a query-by-query basis) will not filter out an event that has a For clients that do not implement this NIP, they will just ignore the 2021 event as they should normally if they're protecting themselves against faulty relays. For frontdated event (e.g. I create an event today with |
I'd prefer this as well, if relays simply also forward events received after the since that also match the rest of the filter, then it's perfect and the new filters are not needed. |
after thinking about a little more, I think this will lead to worst experience, as you're no longer receiving events only for that timerange, forever from that relay. so I think this should be explicit, so the behaviour of current queries doesn't change. |
To me That said I do agree that clients should not expect consistency and instead expect events showing up out of order, duplicated, missing references, significantly out of date, etc. |
Depends what the relay does. If relays ignore fields they don't understand, then the client might be querying far too many events that it didn't want. If relays error when they see fields they don't understand, then the client can fallback to something else (which I will elaborate on in my next reply to your next comment). |
You are right, and I've been thinking about that. If relays censors (or drops) posts, how would you know about it? You just won't see the post. Asking the more refined question does not fix this bigger issue. I think the right solution to this is to chain posts together by including the ID of your previous post. Then you can know that you are missing posts (according to the author of them), suspect the relay of censoring or at least being faulty, and tell the author to maybe find a different relay that works. Could be in an 'e' tag. But maybe that is not simple enough for you. |
Chaining posts is fine with me. I think we could standardize it, probably with a tag named By looking at a I personally think this approach comes with other UX problems (for example, a user cannot easily use multiple clients for multiple purposes without risking creating a fork in their own chain of events), but I can see myself using it for some things in the future and I wouldn't object to it being nipped at all. |
I still maintain that my suggestion at #79 (comment) is a good and simple and backwards-compatible approach for the problem at hand. I would like to hear your opinions on it, @cameri and @mikedilger. @eskema I've addressed your point already above:
|
but the thing is, I don't know if I want to receive events outside of the range I asked, and that's what will happen if relays simply start to send backdated events I didn't ask for, just because they received them after... it would be a very different behaviour than right now.. for this to happen, I'd prefer to explicitly ask for it. |
@fiatjaf I think your suggestion is good, I'm fine with it. After a bit of thought, I think I have to side with @fiatjaf in that these should probably be implicit. The reason is that if it is made explicit, and a client asks a relay which does not support these fields to filter on these fields, that relay is probably going to think the filter is empty and dump everything on them. Other than that concern, I would have preferred it to be explicit. If it was clear that relays receiving filter fields they don't understand should reject the request, then I would vote for explicit fields, but I don't think that is clear anywhere (unless I missed it). Implicit feels more complex and surprising that explicit so I don't feel great about it. The post-chaining that I mentioned here would be a separate future nip. |
My thought is that it would be bad if the relay rejected it too. Because the client would then not work since it was expecting the Or the client would limit itself to only talking to relays that support
|
@eskema my point was that right now you can't really expect relays to send you pristine data, you have to filter the data locally too (otherwise if you ask for events from X and the relay send events from Y you will show those?). So if you are already filtering that the behavior doesn't change. You'll get a very small number of backdated events and automatically ignore those. |
I am not happy about the surprise factor of returning events whose I think we can do much better. If we agree that both clients and relay operators are incentivized to reduce the bandwidth used, most clients will eventually use this since it also guarantees they won't lose events. I propose instead Suppose the client knows it disconnected from the relay at 1669693970. To resume their subscriptions, the client hints to the relay it is only interested in receiving events that have been seen AFTER 1669693970.
Supporting relays will only send the events that have been seen AFTER the given timestamp. A client wishing to use this would store the timestamp of the last received event from each relay and provide it the next time it subscribes. The client does not need to update the timestamp unless an event is received, EOSE can be ignored for this purpose. Notice that the hint affects all filters equally so there's no need to repeat it. |
@cameri while that seems to solve the same problem as fiatjaf's solution and is more explicit (and more complex), it also fails to solve another problem as does fiatjaf's solution which is: The client has no way of knowing if it is talking to a relay that supports this or not, so it doesn't know what set of events it received. All that the relays reply with are events. So I'm going to have to just keep asking relays the same questions over and over again because I'll never know if a well behaved relay picked up an old event recently and I had no way to know about it or ask for it. I hope relays are happy with all that traffic. I'm beginning to think that the desire to make nostr simple has made it too simple to improve. The lack of version numbers or reserved fields was always kind of conspicuous to me. Oh well, it was fun to believe in something for a few weeks. 🙁 |
Maybe this can be done with a new version negotiation message. Client sends ["VERSION", 2] relay responds with it's version... except when the relay doesn't respond because it doesn't know about versioning. Or is it just slow? Oops. Another thing we can't add. (10 minutes pass) Maybe the relay can send a NOTICE to the client right when the client first connects in a predetermined format with protocol version number. While the client hasn't gotten one of these, it continues to presume the relay is protocol version 1. Clients of version 1 will just display the version like an error message as suggested in NIP-01. |
Have you read this? |
This was a conscious decision that I hope never has to change. I believe version numbers and other cheap ways to introduce backwards-incompatible changes are pernicious to any open protocol. |
EDIT: I'm wrong. I just got very frustrated. And I read your comment just after I had test implemented Sec-WebSocket-Protocol for last-resort versioning, which then obviously I didn't feel like sharing after your comment. I have to think long and hard about how nostr solves problems by going out of protocol (e.g. NIP-11) as there are no in-protocol mechanisms. Maybe that's not wrong, maybe I'm wrong. I haven't thought about it enough. |
This was a sad moment. |
that person is not me, it's mostly @eskema everywhere but telegram :P |
we may as well put subscription hints in filters, relays should ignore anything they do not know about. |
@cameri I like your proposal, but I like mine more. I like my first proposal even more though. |
I like your first proposal too. I also think we could do something about the inefficiency of sending events that the client already has with one simple trick 😁 |
Oh, if you frame it like that I want to fix that too, specially if it can work across multiple relays. In the context of a single relay the But across multiple relays I don't know, maybe we can get fancy and use this: https://github.com/sipa/minisketch |
@mikedilger even if you decide Nostr is not good enough, please don't hold bad feelings about us here, we're trying to fix the entire world and that may be a sensitive topic sometimes. |
@fiatjaf I'm embarrassed at my behavior. I've been laying low, not sleeping well, feeling sick to my stomach. I'm continuing to build Gossip, and also probably fork nostr-rs-relay so I can try new things on both ends. But I'm going to stay away from NIPs work. I'd rather just write code. I'm going to build new features without NIP-ping them right away. They should all be backwards compatible and I won't pollute on any event.type numbers or single-letter tag names. If I feel like I need one of those, I'll file an issue. They can be NIP-ped later after proving themselves in the wild if they work out. And if later on after other people look at them they suggest it should have been done differently and I concur, I'll just change my code (which is way easier for me than debating things ahead of time). Sorry I was an ass. |
@mikedilger I knew you'd come around <3 'cause I know you believe in this project more than you'd like to admit :D Don't beat yourself up about what happened, you've acknowledged it and apologized and now what happened is behind us and we can focus on what we do best: building.
I'm gonna go down that rabbit hole and report back if I find something we can use. |
@cameri If the therapist works for you keep going. I never felt therapy did me any good. Generally time alone to think and plenty of sleep cures my ills. I'm not good with conflict. But I figured out a way to avoid it and also make peace with my issues with nostr at the same time: https://github.com/mikedilger/nostr-odyssey |
This relates to issue #78
@cameri I can add you as author too if you want