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

Master fix node country decoding #145

Merged
merged 5 commits into from
Dec 19, 2023

Conversation

MarioBassem
Copy link
Contributor

newNode.country = ""
}
if (newNode.city?.toString().startsWith('0x')) {
if (newNode.city?.includes('\x00')) {
Copy link
Member

@sameh-farouk sameh-farouk Dec 19, 2023

Choose a reason for hiding this comment

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

The issue here is that one of the bytes we try to parse is the null character, which BTW a valid character in UTF-8. It is just PostgreSQL doesn't support storing NULL (\0x00) characters in text fields.

So would it better to patch this for the rest of text fields ? it mean more work but at least this won't come up again tomorrow when we get another null character in different field?
Also, would it be sufficient to only replace the null char instead of truncate the whole value ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, will add this to all text fields.
i don't really like replacing the null character as the processor is expected to parse the events and write them to the sql db without manipulation, so i would prefer that this happens on the chain's side if it was accepted at all.

Copy link
Member

@sameh-farouk sameh-farouk Dec 19, 2023

Choose a reason for hiding this comment

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

The input validation is a something need to happen on tfchain side but it would take sometime. I expect that upgrading the processor would be quicker than upgrading the runtime. otherwise, why we are patching this here at first place.
Beside, chain store bytes, indexer have no issue with encoding this, the value can be stored on different db with no issue or using postgersql bytea filed. so it is more about how the processor store this info and a limitation in postgersql. so we can indeed patch it here. make sense ?

@sameh-farouk sameh-farouk merged commit da00000 into master Dec 19, 2023
1 check passed
@sameh-farouk sameh-farouk deleted the master_fix_node_country_decoding branch December 19, 2023 16:51
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

Successfully merging this pull request may close these issues.

2 participants