NullPointerException when calling triggerconstantcontract with blacklisted address
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- java
- Domain
- api, blockchain
Research direction
Start by reproducing the POST /wallet/triggerconstantcontract request for isBlackListed(address) on the supplied blacklisted address, then trace the Java implementation of constant-contract execution and response handling. Compare it with a non-blacklisted call. Done means the endpoint returns a boolean constant_result without a NullPointerException and regression coverage exists for the blacklisted case.
Written by the indexing model from the issue text.
Description
Issue Description
When calling the triggerconstantcontract endpoint to check if a TRON address is blacklisted using the isBlackListed(address) function, a NullPointerException is thrown when the address is actually blacklisted.
Environment
- TRON Network: Mainnet
- API Endpoint:
https://tron-mainnet.gateway.tatum.io/wallet/triggerconstantcontract - Contract Address:
TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t(USDT TRC-20) - Function:
isBlackListed(address)
Steps to Reproduce
- Call the
triggerconstantcontractendpoint with the following payload:
{
"owner_address": "TKgD8Qnx9Zw3RNjdiU2i5y2Swa2y4QvG6v",
"contract_address": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
"function_selector": "isBlackListed(address)",
"parameter": "0000000000000000000000418a8e8b8c8d8e8f9a9b9c9d9e9f0a1b2c3d4e5f6",
"visible": true
}
- The address
TKgD8Qnx9Zw3RNjdiU2i5y2Swa2y4QvG6vis confirmed to be blacklisted.
Expected Behavior
The endpoint should return a successful response with the blacklist status in the constant_result field, for example:
{
"result": {
"result": true,
"constant_result": ["0000000000000000000000000000000000000000000000000000000000000001"]
}
}
Actual Behavior
The endpoint returns an error:
{
"result": {
"code": "OTHER_ERROR",
"message": "class java.lang.NullPointerException : null"
}
}
Error Details
- Error Type:
java.lang.NullPointerException - Error Code:
OTHER_ERROR - Message:
class java.lang.NullPointerException : null
Additional Information
Test Cases
-
Blacklisted Address (Fails with NullPointerException):
- Address:
TKgD8Qnx9Zw3RNjdiU2i5y2Swa2y4QvG6v - Expected: Should return
trueor1in constant_result - Actual: Returns NullPointerException
- Address:
-
Non-blacklisted Address (May work correctly):
- Should be tested to confirm if the issue only occurs with blacklisted addresses
Request Details
- Method: POST
- URL:
/wallet/triggerconstantcontract - Content-Type:
application/json - Parameter Encoding: The address is converted from Base58 to hex format, padded to 64 characters (32 bytes)
Address Conversion
The address TKgD8Qnx9Zw3RNjdiU2i5y2Swa2y4QvG6v is converted as follows:
- Base58 to hex:
418a8e8b8c8d8e8f9a9b9c9d9e9f0a1b2c3d4e5f6 - Ensure
41prefix (TRON address prefix) - Pad to 64 hex characters:
0000000000000000000000418a8e8b8c8d8e8f9a9b9c9d9e9f0a1b2c3d4e5f6
Possible Root Cause
The NullPointerException suggests that when processing a blacklisted address, the TRON node may be encountering a null reference when:
- Accessing the blacklist mapping
- Processing the return value
- Encoding the response
This could indicate a bug in the contract execution or response encoding logic when dealing with blacklisted addresses.
Impact
This issue prevents applications from properly checking blacklist status for addresses that are actually blacklisted, which is critical for compliance and security purposes.
Requested Action
Please investigate and fix the NullPointerException that occurs when calling triggerconstantcontract with isBlackListed(address) for blacklisted addresses. The function should return a proper boolean value instead of throwing an exception.
Related Information
- TRON USDT Contract:
TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t - Function Signature:
isBlackListed(address) - Test Address:
TKgD8Qnx9Zw3RNjdiU2i5y2Swa2y4QvG6v(confirmed blacklisted)
- Dominant language
- Java
- Stars
- 4.2k
- Forks
- 1.8k
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 51
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from tronprotocol/java-tron
-
Difficulty 3/5 1-2 days Newbie friendliness 70/100
tronprotocol/java-tron#7044 · 4 comments ·
Maintainers usually reply within 1 day
-
[Feature] Remove unused discovery message definitionsPossibly taken A pull request linked to this issue is open or already merged. Opentype:feature
Difficulty 4/5 3-5 days Newbie friendliness 35/100
tronprotocol/java-tron#7013 · 3 comments ·
Maintainers usually reply within 1 day
-
[Feature] Validate ECKey inputs and improve key handlingPossibly taken A pull request linked to this issue is open or already merged. Opentype:feature
Difficulty 4/5 3-5 days Newbie friendliness 40/100
tronprotocol/java-tron#6994 · 5 comments ·
Maintainers usually reply within 1 day
-
type:feature
Difficulty 5/5 Over a week Newbie friendliness 25/100
tronprotocol/java-tron#6989 · 7 comments ·
Maintainers usually reply within 1 day
-
[Feature] decouple json-rpc filter processing from ManagerPossibly taken A pull request linked to this issue is open or already merged. Opentype:feature
Difficulty 5/5 Over a week Newbie friendliness 48/100
tronprotocol/java-tron#6963 · 8 comments ·
Maintainers usually reply within 1 day
All issues in tronprotocol/java-tron
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
citrusframework/citrus#2044 ·
Maintainers usually reply within 1 day
-
[bug]打火石不能被放在厨具架上Open
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
KaleidoscopeMods/KaleidoscopeCookery#237 · 1 comment ·
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
molgenis/molgenis-emx2#7059 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
quarkiverse/quarkus-flow#1169 ·
Maintainers usually reply within 1 day