desmos-labs / desmos

Improving the well-being of users on social networks through the blockchain technology.
https://desmos.network
Apache License 2.0
104 stars 48 forks source link

Adding emojis as reactions doesn't work anymore #582

Closed leobragaz closed 2 years ago

leobragaz commented 3 years ago
## Bug description When adding a reaction to a post, if we use an emoji such as 👍, 🔥, etc...the transaction will be invalid due to an internal error (probably something related to the emojis library?). Need further investigation ```bash code: 111222 codespace: undefined data: "" gas_used: "44839" gas_wanted: "200000" height: "105" info: "" logs: [] raw_log: 'panic message redacted to hide potentially sensitive system info: panic ``` ## Steps to reproduce 1. Run a local chain 2. Create a subspace 3. Create a post in that subspace 4. Add a reaction to that post with an emoji ```desmos tx posts add-reaction 👍 --from --chain-id ``` ## Expected behavior Emoji reaction posted without any error.
dadamu commented 3 years ago

@bragaz I found that GetEmojiByShortCodeOrValue searches the emoji tables in emojidata.go. It loses the shortcodes list so the error happens. The table in emojidata.go should be updated to solve the problem.

dadamu commented 3 years ago

I think it could have an error handling here to avoid the panic with the following check.

if len(emojiReact.Shortcodes) {
    return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "short code doesn't exist")
}
leobragaz commented 3 years ago

@dadamu I've digged into this more and found that somehow, the init() function of the Go-Emoji-Utils library (which is ours) it's not working. Basically shortcodes are not initialized, and this looks very weird since an init() function should always be called...what do you think @dadamu ?

dadamu commented 3 years ago

@bragaz I tried a while. init() function is run properly. However, the Emoji struct is not correct in the downloaded package and /data/emoji.json is not included. The upstream release package should be updated.

RiccardoM commented 2 years ago

Closing this as the x/posts module will need to be implemented again anyway