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

fix: ignore iris strange trace #127

Merged
merged 5 commits into from
Jun 1, 2022
Merged

fix: ignore iris strange trace #127

merged 5 commits into from
Jun 1, 2022

Conversation

tbruyelle
Copy link
Contributor

@tbruyelle tbruyelle commented May 25, 2022

insert balances fails because the amount field has non-UTF-8 characters.

This is due to a strange iris trace that is interpreted as bank balance trace with a value \n$\n\x05uiris\x12\x1b509625143506063788050678455. When this value is unmarshaled into a sdk.Coin, it doesn't trigger any error but fills the sdk.Coin.Amount field with invalid UTF-8 characters, leading to the database error mentioned earlier.

Actually, this iris trace is not a balance bank trace, because the format of the key is 0x02+len(addr)+addr, whereas the balance key format is 0x02+len(addr)+addr+denom.

So, despite we didn't manage to find the module corresponding to this trace, what appears to be the best fix is to ensure the bank processor ignores this trace.

  • This commit adds tests to the existing code: edef1fc
  • This commit ensures the bank processor ignores traces like the one of Iris: 8c0c7df

insert balances fails because the amount field has non-UTF-8
characters.

the test added in this commit takes balance trace from various chain and
demonstrate a clear difference in the value of the trace for Iris.

The next question is why?
@tbruyelle tbruyelle requested a review from a team as a code owner May 25, 2022 13:09
@tbruyelle
Copy link
Contributor Author

Thread with Iris engineers https://allinbits.slack.com/archives/C804L75B2/p1653498282585879

tbruyelle added 2 commits May 30, 2022 14:23
By rejecting the trace during the processing phrase, we allow an
other processor to handle it, and we also prevent a database error
that occurs during the insert when the unmarshaled coin contains invalid
UTF-8 characters (see EmerisHQ/demeris-backend#794).
@tbruyelle tbruyelle changed the title fix: investigate iris bug fix: ignore iris strange trace May 30, 2022
Copy link
Contributor

@Pitasi Pitasi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks :)

@mergify mergify bot merged commit 7da0f0e into main Jun 1, 2022
@mergify mergify bot deleted the fix/iris-794 branch June 1, 2022 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants