Skip to content
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

'a' tag treatment #870

Open
mikedilger opened this issue Nov 8, 2023 · 14 comments
Open

'a' tag treatment #870

mikedilger opened this issue Nov 8, 2023 · 14 comments

Comments

@mikedilger
Copy link
Contributor

I have a question around 'a' tag treatment.

In NIP-10 we have positional 'e' tags and marked 'e' tags. We now also have 'a' tags defined in NIP-01 to work very similarly to 'e' tags. I'm confused now about how similarly they should work.

As an example, should I count either an 'e' tag or an 'a' tag as a positional event reference, such that this sequence of tags (a, e, a) means that the first 'a' tag is a root, the second 'e' tag is a mention and the last 'a' tag is the reply? Or does positional strictly only apply to 'e' tags?

And what about marked tags, can 'a' tags be marked?

@fiatjaf

@mikedilger
Copy link
Contributor Author

My opinion is that:

  1. Positional is deprecated and should only apply to 'e' tags
  2. 'a' tags should support markers. Sometimes the meaning of an 'a' tag is implied by the event kind (e.g. in a GenericRepost), but replies are not event kinds and if there is a thread of replaceable events mixed with non-replaceable events, having a marker seems to make sense to me.

@mikedilger
Copy link
Contributor Author

I'm going to stop trying to differentiate between replies and mentions. it's become neigh impossible and I think maybe that was a dumb distinction in the first place.

@fiatjaf
Copy link
Member

fiatjaf commented Nov 12, 2023

I agree it is a distraction and we should stop it. Mentions are replies.

@arthurfranca
Copy link
Contributor

NIP-10 markers are pure chaos.
An alternative path: #877

@staab
Copy link
Member

staab commented Nov 13, 2023

I'm going to stop trying to differentiate between replies and mentions.

I don't know if this is feasible, coracle inherits all e and a tags when replying, so that if you mute a note somewhere in the hierarchy all children can be filtered out easily.

@mikedilger
Copy link
Contributor Author

I'm going to stop trying to differentiate between replies and mentions.

I didn't end up doing that.

But an ambiguity comes up when you reply to a thread where the root and/or the direct parent are replaceable events (such as long form). Then your reply uses 'a' tags to do the reply, but 'a' tags don't have markers so you can't mark an 'a' tag as being the root.

@fiatjaf
Copy link
Member

fiatjaf commented Nov 13, 2023

I think we can put the same markers on the 'a' tags. But also I think when replying to a replaceable event we should include the 'e' tag.

@vitorpamplona
Copy link
Collaborator

I think we can put the same markers on the 'a' tags

We will have to. It's just a matter of time until somebody makes a Twitter client using a replaceable kind as a base for posts. When that happens then we will have a tags for root and replies at the same time.

@fiatjaf
Copy link
Member

fiatjaf commented Nov 13, 2023

God forbid.

@franzaps
Copy link
Contributor

I have definitely seen a tags with a mention marker in the wild.

We already agreed on only using e to mark replies, and that replying to replaceable identifiers was a nostr cardinal sin, correct? I refactored a significant part of the zapthreads codebase to reflect this

@staab
Copy link
Member

staab commented Nov 16, 2023

I don't know if we really reached consensus. You said:

So we all agree that every reply to a kind 30023 (no matter how nested) should:

  • include its a tag
  • include an e tag with a root marker, that points to the id of the kind 30023 event it's replying to
  • optionally include an e tag with a reply marker if it's a reply to a reply

This:

  • doesn't specify if the a tag has a mark. If it's following NIP-10, it should have a root marker
  • doesn't specify how to quote replaceable events. I'd assume we'd do [a, address, hint, mention] following nip 10
  • doesn't include an a tag with a reply mark, which I think it should.

So if you're replying to a long-form-post which is also a reply to a long-form post (degenerate case, I know), you should have four tags:

  ["e", <event id>, hint, "root"],
  ["e", <event id>, hint, "reply"],
  ["a", <event id>, hint, "root"],
  ["a", <event id>, hint, "reply"],

This way, clients can choose whether to use the replaceable or snapshotted version.

@franzaps
Copy link
Contributor

@staab thanks, my answer was incomplete so I'll clarify:

The PR I opened suggested that since NIP-01 treats a tags as first-class citizens, so should NIP-10.

However that was met with resistance, especially by Will who got mad because using a tags as root events would break things, etc. There was some consensus to use event IDs to specify roots and replies, that is, use e tags, at least that's what I got.

That is why I did not clarify which markers a tags should have. I believe none as it should be implicit that they are all mentions.

In this case your last example would become:

  ["e", <event id>, hint, "root"],
  ["e", <event id>, hint, "reply"],
  ["a", <replaceable event id>, hint],

Following this discussion @fiatjaf suggested If the reply has an e tag that doesn't match the current id of the replaceable event, display a notice in the zapthreads repo.

I reworked a lot of the internals to start showing appropriate warnings such as:

img

(There are three different cases, can also be seen live in https://habla.news or https://zapthreads.dev )

In general, I'm curious if we're still seeing many positional tags as deprecated in NIP-10? @mikedilger All the ones I've encountered predate May '23

@staab
Copy link
Member

staab commented Nov 21, 2023

The problem with that is the way most relays handle replaceable events. If the e for the root/reply doesn't de-reference, you can't know whether the a tag was the root or the reply, or something entirely unrelated.

The NIPs repo is meant to be descriptive rather than prescriptive. It seems there is demand for replies to replaceable events, so we should document what's actually out there, regardless of our own personal opinions (I think replaceables should be burned with fire, but short of that I think Semisol/Will's idea of just serving them all would work ok as a poor-man's versioned event).

@franzaps
Copy link
Contributor

Ok I get your point. Replies to a naddr should have properly marked both a and e tags.

Out in the wild I've seen a tags with a mention but most of them with no markers (which I assumed as root). The reply case as you said is quite contrived.

So yes, I agree with being more explicit. The only thing I ask is let's keep e tags when replying to long-form 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants