Let mentions() return all 'e' tags #7
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nostr/nostr-types!7
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "process-all-mentions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Currently mentions() discards the first and last unmarked 'e' tag (due to legacy NIP-10 positional mentions logic). As the result of this function is used to fetch related notes in gossip client, this results in reposts not getting fetched where some clients use a single unmarked 'e' tag as a mention to create a repost.
This pull request discards different treatment of marked and unmarked 'e' tags and just returns all 'e' tags.
To see an example of a note that benefits from this change, build the latest from this branch https://github.com/mikedilger/gossip/pull/310 and search for this note (provided you only follow the reposter and not the original poster): note1ts55uz7kn7a5vu97hj27a04xjqakf2uc26zfunmp0mmvhq2exaqq2365g4
@fiatjaf I think you would be the right person to review this. This function is used in two locations in gossip code. One is to build the list of related posts that should be fetched and the other is to store post relationships in the database. I believe based on current use that I have seen in my feed is that unmarked 'e' tags are used (by some users/some clients) for no-comment mentions and those would not be included if we are discarding first and last unmarked 'e' tags.
Shouldn't we exclude
etags marked with"reply"or"root"here?Presuming you want a function that returns all 'e' tags irrespective of their position (root, mention, reply), I think you should create a new function for that.
Ok, please understand what I am trying to fix, so you can advise me on how you want it fixed. We are getting notes that have a single unmarked 'e' tag and have a single mention "#[0]" as the content.
Those currently do not get fetched by the overlord because this function
mentions()will not return that unmarked mention. So there are 3 solutions that I see:mentions()get_etags()that returns all 'e' tags. Then replace both uses ofmention()in gossip to use this new function. Gossip would not usementions()function anymore.I just updated nostr-types with
referred_events()that you can use which brings in the data from alletags.I also went looking for this call to
event.mentions()in gossip that you are referring to which signals the minions to subscribe to these and I couldn't find it. Granted I'm working very fast and spending very little time here.In the process of searching for it, I found two references that were buggy, so I fixed those bugs. But neither of those fixes uses this new
referred_events()function.So I'm curious where you would make the change in gossip.
Ok
.replies_to_ancestors()was already doing this (but was enforcing TextNote). Let's go back to that, but take out the enforcement. I can't do it, gotta run.The call to
mentions()I was referring to was atsrc/overlord/mod.rsline 1198 where it adds the mentions to the list of missing ancestors. You are of course the author and expert on this code, but I did notice that when I modified thementions()function to return that first unmarked mention note id, then it would show up inGLOBALS.events.get(id). So in some way it's adding it to the list of stuff to fetch.Yes I can see how that would happen. The particular call to
mentions()was wrong however, if you read the comment above it, this block of code was supposed to look for recommended_relay_urls in 'p' tags. That was a suggestion from fiatjaf long ago (so this was a bug for a long time apparently).The block just above at line 1188 is doing the heavy lifting. It now calls
.referred_events()which looks at all the 'e' tags, whether root or mention or reply, and uses all the recommended_relay_url fields it can find to try to find the ancestor event. It used to only use the mentions.Thanks for addressing this issue, the only time I don't see a mention in the cache now is if the tag doesn't include a relay url.
Perhaps at some point in the future we could offer searching on other relays to the user.
I now also actually believe your implementation of mentions is the correct way to handle it while there still are unmarked tags out there.
Pull request closed