-
Notifications
You must be signed in to change notification settings - Fork 48
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
Remove the automatic registration of emoji reactions #145
Comments
So if I understood this well, only shortcodes will be registered, emoji reaction will not right? |
Exactly |
How about we have a global predefined list of registered emoji? e.g., register a list of Github supported emoji shortcodes by default. It's similar to how the Cosmos SDK handle errors. |
@kwunyeung I've thought about this as well, but there are two issues with this approach:
If we just check the code that the user sends against the current list of known emoji shortcodes, it will make sure that future updates do not require a chain upgrade (the validator nodes can just do a software upgrade and everything will be fine) and also we do not pollute the state with useless lists that are already present somewhere else (i.e. inside the emoji library). |
Context
Currently, when an emoji is used a reaction to a post, a new reaction is registered inside the state to make sure that when it's stored, no errors are returned. While this methods works great and ensures that each reaction is registered before being added to a post, it also has one big downside: duplication.
When we register reactions, each one of them is associated to a subspace which identifies a client application. This means that if we consider having 10 different client applications, and inside each one of them the ":smile:" reaction is used, we will have 10 different registered reaction with the same shortcode and the same value, but a different subspace each time. Also, if there's one emoji which has multiple shortcodes, this will be registered multiple times for the same client.
While this might seem like a small thing, considering that there are currently more than 3,000 emojis this lead in the future to an unnecessary increased size in the store.
Solution
A possible solution to this problem is changing how reactions are currently handled inside Desmos. This could be done as follows.
Once a user adds a reaction to a post, the following operations will take place:
If not throw an error.
Otherwise, store inside the state the shortcode associated to the reaction.
Once a user removes a reaction to a post, the following operations will take place:
This way we will be able to have a store inside which the reactions are all represented by their shortcodes which will allow us in a later time to get both the
value
andshortocode
when returning them to the clients that asks them.Notes
Note that emoji-based reactions are not checked for registration, thus reducing the size of the used disk space as well as making the whole process a lot more faster.
Conclusion
I think this system will perform better in a long run, but I want to hear if you have suggestions about it @kwunyeung @bragaz
The text was updated successfully, but these errors were encountered: