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(torii-grpc): erc tokens and balances #2698
feat(torii-grpc): erc tokens and balances #2698
Changes from 10 commits
025d5a7
a19f1f2
a28545d
78a341d
4aece4a
e72bc05
cd0528b
a4b8a2a
52277da
97b1165
9aa02f2
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Check warning on line 97 in crates/torii/client/src/client/mod.rs
Codecov / codecov/patch
crates/torii/client/src/client/mod.rs#L92-L97
Check warning on line 109 in crates/torii/client/src/client/mod.rs
Codecov / codecov/patch
crates/torii/client/src/client/mod.rs#L100-L109
Check warning on line 125 in crates/torii/core/src/types.rs
Codecov / codecov/patch
crates/torii/core/src/types.rs#L125
Check warning on line 136 in crates/torii/core/src/types.rs
Codecov / codecov/patch
crates/torii/core/src/types.rs#L136
Check warning on line 109 in crates/torii/grpc/src/client.rs
Codecov / codecov/patch
crates/torii/grpc/src/client.rs#L95-L109
Check warning on line 130 in crates/torii/grpc/src/client.rs
Codecov / codecov/patch
crates/torii/grpc/src/client.rs#L111-L130
Check warning on line 101 in crates/torii/grpc/src/server/mod.rs
Codecov / codecov/patch
crates/torii/grpc/src/server/mod.rs#L93-L101
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.
Handle potential serialization errors in Token conversion.
The
serde_json::to_string(&value.metadata).unwrap()
call could panic if the metadata is not valid JSON. Consider proper error handling.Check warning on line 112 in crates/torii/grpc/src/server/mod.rs
Codecov / codecov/patch
crates/torii/grpc/src/server/mod.rs#L105-L112
Check warning on line 822 in crates/torii/grpc/src/server/mod.rs
Codecov / codecov/patch
crates/torii/grpc/src/server/mod.rs#L817-L822
Check warning on line 831 in crates/torii/grpc/src/server/mod.rs
Codecov / codecov/patch
crates/torii/grpc/src/server/mod.rs#L824-L831
Check warning on line 837 in crates/torii/grpc/src/server/mod.rs
Codecov / codecov/patch
crates/torii/grpc/src/server/mod.rs#L834-L837
Check warning on line 841 in crates/torii/grpc/src/server/mod.rs
Codecov / codecov/patch
crates/torii/grpc/src/server/mod.rs#L839-L841
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.
Ohayo sensei! Address SQL injection and input validation in
retrieve_tokens
.The current implementation constructs SQL queries using
format!
, which can lead to SQL injection vulnerabilities. Additionally, there's no input validation or limit on the number of contract addresses.Apply this diff to fix the issues:
Would you like assistance implementing these changes?
📝 Committable suggestion
Check warning on line 870 in crates/torii/grpc/src/server/mod.rs
Codecov / codecov/patch
crates/torii/grpc/src/server/mod.rs#L843-L870
Check warning on line 874 in crates/torii/grpc/src/server/mod.rs
Codecov / codecov/patch
crates/torii/grpc/src/server/mod.rs#L872-L874
Check warning on line 879 in crates/torii/grpc/src/server/mod.rs
Codecov / codecov/patch
crates/torii/grpc/src/server/mod.rs#L876-L879
Check warning on line 883 in crates/torii/grpc/src/server/mod.rs
Codecov / codecov/patch
crates/torii/grpc/src/server/mod.rs#L881-L883
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.
Ohayo sensei! Secure
retrieve_token_balances
and improve error handling.Similar to
retrieve_tokens
, constructing SQL queries usingformat!
can cause SQL injection vulnerabilities. Additionally, there's insufficient input validation and no limit on the number of addresses.Apply this diff to address the issues:
Let me know if you'd like help applying these changes.
📝 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.
Ohayo sensei! Enhance error handling for
retrieve_tokens
endpoint.The current implementation doesn't validate input contract addresses and lacks error handling for
Felt
conversions, which can cause silent failures.Apply this diff to improve error handling:
📝 Committable suggestion
Check warning on line 1276 in crates/torii/grpc/src/server/mod.rs
Codecov / codecov/patch
crates/torii/grpc/src/server/mod.rs#L1264-L1276
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.
Ohayo sensei! Enhance error handling for the gRPC endpoint.
The implementation needs better input validation and error handling:
Consider this improved implementation:
📝 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.
Enhance error handling for the gRPC endpoint.
The implementation needs better input validation and error handling:
Consider this improved implementation:
📝 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.
Ohayo sensei! Improve error handling for
retrieve_token_balances
endpoint.There's a need to validate input addresses and handle potential conversion errors to prevent silent failures.
Apply this diff to enhance error handling:
📝 Committable suggestion
Check warning on line 1298 in crates/torii/grpc/src/server/mod.rs
Codecov / codecov/patch
crates/torii/grpc/src/server/mod.rs#L1281-L1298
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.
Ohayo sensei! Enhance error handling for address conversions.
The implementation needs better error handling for Felt conversions:
Consider this improved implementation:
📝 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.
Ohayo sensei! Enhance error handling for address conversions.
The implementation needs better error handling for Felt conversions:
Consider this improved implementation:
📝 Committable suggestion