tronprotocol / tronprotocol/java-tron
NullPointerException when calling triggerconstantcontract with blacklisted address
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.2k
- Forks
- 1.7k
- Avg merge
- 6d 20h
- Merged PRs (30d)
- 14
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)
Contributor 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.
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.
Assessment
- Tech stack
- java
- Domain
- api, blockchain
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100