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

Which is the reasoning to make the tags entry an array? #611

Closed
leoperegrino opened this issue Jun 16, 2023 · 6 comments
Closed

Which is the reasoning to make the tags entry an array? #611

leoperegrino opened this issue Jun 16, 2023 · 6 comments

Comments

@leoperegrino
Copy link

leoperegrino commented Jun 16, 2023

This comes into my mind when I try to understand which is the reasoning to define single letter tags.
Single letter tags present no context to the person reading it. It's not a problem for users but why not use something developers would instantly know what is refering to? Single letter tags also create the limitation of how many letter there are, which was discussed in issue 541.

Is it to save storage and bandwith since they can appear multiple times?
Appearing multiple times is a problem because the tags entry is defined as an array, or am I wrong?

If it was a dictionary, the tags key would have it's keys that each one could hold arrays, saving the need for writing multiple X tags. The way it is right now seems to create something like arrayctionary, an array of arrays which tries to emulate the exact behaviour of a dictionary key holding an array: multiple entries in a single key.

I know that this is already expected behaviour and there won't be any breaking changes but
can anyone elaborate on that so I can fully understand the reasoning?

@fiatjaf
Copy link
Member

fiatjaf commented Jun 16, 2023

Because they get serialized deterministically so they can be signed.

The single-letter stuff is just a rule of thumb. Relays are free to index other tags if they want. Also there are more than enough letters.

@leoperegrino
Copy link
Author

Fair enough, I didn't think about determinism.
And why is the serialization done with a 0 prepended?

I think using more descriptive names is preferable, regardless of how many letters there are. But this is just a personal take, not a rule.

@fiatjaf
Copy link
Member

fiatjaf commented Jun 17, 2023

And why is the serialization done with a 0 prepended?

It's for versioning or something like that. I can't think of a scenario in which the version would have to change, but who knows, it didn't cost anything to have the 0 there, so there it is.

@leoperegrino
Copy link
Author

Do you think that it's useful to clarify that in the NIP-01? If there are other NIPs refering to serialized object also too. Maybe clarify a parameter called protocol_version (or just version, whatever).

@fiatjaf
Copy link
Member

fiatjaf commented Jun 18, 2023

No, that's not a good thing. I don't want people to think there will be other versions, because there won't. Unless something really weird and unexpected happens, but it's not planned at all and it would be a catastrophe.

@leoperegrino
Copy link
Author

leoperegrino commented Jun 18, 2023

Sure, no problem. Thank you for the explanation.

Closing this now. I hope this issue serves for future reference.

@weex weex mentioned this issue Nov 15, 2023
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

2 participants