-
Notifications
You must be signed in to change notification settings - Fork 134
Return null in case token with negative num value is being read #12124
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
Conversation
Signed-off-by: Ivan Kavaldzhiev <[email protected]>
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) |
web3/src/main/java/org/hiero/mirror/web3/state/keyvalue/TokenReadableKVState.java
Outdated
Show resolved
Hide resolved
web3/src/test/java/org/hiero/mirror/web3/service/ContractCallAirdropSystemContractTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Ivan Kavaldzhiev <[email protected]>
…-invalid-token-id
Signed-off-by: Ivan Kavaldzhiev <[email protected]>
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
web3/src/main/java/org/hiero/mirror/web3/state/keyvalue/TokenReadableKVState.java
Outdated
Show resolved
Hide resolved
…-invalid-token-id
Signed-off-by: Ivan Kavaldzhiev <[email protected]>
web3/src/test/java/org/hiero/mirror/web3/service/ContractCallAirdropSystemContractTest.java
Outdated
Show resolved
Hide resolved
…-invalid-token-id
Signed-off-by: Ivan Kavaldzhiev <[email protected]>
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.
LGTM
Description:
It seems users are passing evm address value as token addresses, which results to decoding them in a very big number that overflows Long type and produces TokenID with negative num value.
In case of such a wrong input in the calldata this PR returns null, instead of trying to decode this TokenID, the PR changes the logic to just return a null value and most likely lead to the transaction getting reverted. This will also clear out Grafana logs with unnecessary exception statements.
Fixes #12082
Checklist