NIP-42 does not work [500k Bounty] #520

Closed
opened 2023-04-17 15:17:52 +00:00 by nostr-wine · 11 comments
nostr-wine commented 2023-04-17 15:17:52 +00:00 (Migrated from github.com)

Describe the bug
It seems NIP-42 was once added to snort but no longer works. We are offering a 500k sats bounty to fix this feature.

To Reproduce
Steps to reproduce the behavior:

  1. Add a relay that requires auth (Kollider's pay relay, filter.nostr.wine with no path)
  2. Try to browse global/any view
  3. No content and console errors.

Expected behavior
It should respond to the AUTH correctly and then re-send the REQs (poorly defined in the NIP-42 spec how to handle the "lost" REQs).

**Describe the bug** It seems NIP-42 was once added to snort but no longer works. We are offering a 500k sats bounty to fix this feature. **To Reproduce** Steps to reproduce the behavior: 1. Add a relay that requires auth (Kollider's pay relay, filter.nostr.wine with no path) 2. Try to browse global/any view 3. No content and console errors. **Expected behavior** It should respond to the AUTH correctly and then re-send the REQs (poorly defined in the NIP-42 spec how to handle the "lost" REQs).
LiranCohen commented 2023-04-17 16:16:43 +00:00 (Migrated from github.com)

I originally implemented NIP-42 a long while ago.

I'll try to make time this week to take a look and see what broke.

Is it just broken with this particular server? Do other NIP-42 servers respond ok?

Currently on mobile so can't debug but will def look at this week.

I originally implemented NIP-42 a long while ago. I'll try to make time this week to take a look and see what broke. Is it just broken with this particular server? Do other NIP-42 servers respond ok? Currently on mobile so can't debug but will def look at this week.
nostr-wine commented 2023-04-17 17:45:52 +00:00 (Migrated from github.com)

Thank you for taking a look! The only two I know of are wss://nostr.kollider.xyz and wss://filter.nostr.wine and it does not work with either.

Thank you for taking a look! The only two I know of are wss://nostr.kollider.xyz and wss://filter.nostr.wine and it does not work with either.
nostr-wine commented 2023-04-18 18:43:16 +00:00 (Migrated from github.com)

Playing with this a bit more today, it seems if you select an AUTH relay in global, then select a different one, then go back to the AUTH relay, it will load events (sometimes).

So it does seem to be working, but perhaps the flow of what happens to the REQs that were sent before/simultaneously the AUTH event is received needs to be improved. I don't expect relays to keep track of the missing state with the way the NIP is currently written.

Playing with this a bit more today, it seems if you select an AUTH relay in global, then select a different one, then go back to the AUTH relay, it will load events (sometimes). So it does seem to be working, but perhaps the flow of what happens to the REQs that were sent before/simultaneously the AUTH event is received needs to be improved. I don't expect relays to keep track of the missing state with the way the NIP is currently written.
LiranCohen commented 2023-04-18 19:02:29 +00:00 (Migrated from github.com)

Ah yeah, I think I know what's going on.

When we originally implemented it the global feed did not allow you to select a specific relay.

I'm going to try to find some time and dig into how it can be fixed.

Like you said, the REQ has a race condition with AUTH. I have some ideas but will need to find some time this week to mess with it.

Ah yeah, I think I know what's going on. When we originally implemented it the global feed did not allow you to select a specific relay. I'm going to try to find some time and dig into how it can be fixed. Like you said, the REQ has a race condition with AUTH. I have some ideas but will need to find some time this week to mess with it.
nostr-wine commented 2023-04-18 19:03:22 +00:00 (Migrated from github.com)

No rush, thanks for your help. We appreciate it.

No rush, thanks for your help. We appreciate it.
v0l commented 2023-04-18 19:42:46 +00:00 (Migrated from github.com)

On some of the other relays, they implemented some buffering of pending REQ messages, seems like your relay doesnt do this, any chance you could send AUTH on connect?

On some of the other relays, they implemented some buffering of pending REQ messages, seems like your relay doesnt do this, any chance you could send AUTH on connect?
nostr-wine commented 2023-04-18 19:44:03 +00:00 (Migrated from github.com)

We do prompt for AUTH on connect at wss://filter.nostr.wine (but we do not buffer pending REQs).

We do prompt for AUTH on connect at wss://filter.nostr.wine (but we do not buffer pending REQs).
v0l commented 2023-04-18 19:44:41 +00:00 (Migrated from github.com)

Ok, can you enable auth_required in limitations ?

Ok, can you enable `auth_required` in `limitations` ?
nostr-wine commented 2023-04-18 19:45:35 +00:00 (Migrated from github.com)

I can. It's a bit unclear because right now its optional (we still support using /npub if you don't use AUTH) but I will add it regardless. I don't think there is any harm. I'm on it now.

I can. It's a bit unclear because right now its optional (we still support using /npub if you don't use AUTH) but I will add it regardless. I don't think there is any harm. I'm on it now.
nostr-wine commented 2023-04-18 19:50:36 +00:00 (Migrated from github.com)

auth_required has been flipped to "true" in limitations.

I just want to add that we sympathize with the REQ/AUTH race condition and really wish there was some clarity in the NIP of how clients and relays are expected to address it. Using NIP-42 to do some granular limiting (like only on kind 4 REQs) will result in these same issues.

auth_required has been flipped to "true" in limitations. I just want to add that we sympathize with the REQ/AUTH race condition and really wish there was some clarity in the NIP of how clients and relays are expected to address it. Using NIP-42 to do some granular limiting (like only on kind 4 REQs) will result in these same issues.
nostr-wine commented 2023-04-19 14:42:33 +00:00 (Migrated from github.com)

Thank you! Bounty paid.

Thank you! Bounty paid.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Kieran/snort#520
No description provided.