Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat(indexer): add to modules and implement proto fields #22544
feat(indexer): add to modules and implement proto fields #22544
Changes from 6 commits
24879d0
8047466
5a52970
ce8b931
86fc09a
7e5a665
4ebf63f
38fcf4c
ee06bf2
5381823
748bac9
3cd0277
4b3b800
0a73e70
ebd7397
5196e56
6ed03b5
6c03930
f4a3aa0
5bb37a3
de642e1
668838f
f3cd58f
80d762e
91674b1
228ffb5
e320f48
d94bde6
dc20c04
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead can we just have the
nil
case be handled properly?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, it was already there for keys
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add validation for header data presence
The current implementation doesn't validate that at least one of
HeaderJSON
orHeaderBytes
is present. This could lead tonil
being inserted into the database.Consider adding this validation at the start:
📝 Committable suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add validation for headerBz to prevent SQL errors
The current implementation lacks validation for the header data before inserting it into the database, which could lead to SQL errors as noted in the TODO comment.
Consider adding validation before the SQL execution:
Additionally, consider adding debug logging to help with troubleshooting:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Enhance error handling and use prepared statements
The TODO comment indicates a potential SQL error due to invalid JSON format. Additionally, the query could benefit from using prepared statements for better security and performance.
Consider this implementation:
This change:
jsonb
type cast for better type safety📝 Committable suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does ValidateName not handle this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it does handle it but I thought it was nice to have a more descriptive error for the empty case which would be the most common while implementing