Skip to content

debug_traceTransaction fails with some specific tx hash #3751

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

Closed
acuarica opened this issue May 12, 2025 · 1 comment · Fixed by #3768
Closed

debug_traceTransaction fails with some specific tx hash #3751

acuarica opened this issue May 12, 2025 · 1 comment · Fixed by #3768
Assignees
Labels
bug Something isn't working Team Promoted Issues to be triaged and discussed by committers, maintainers, to be worked on the following sprint
Milestone

Comments

@acuarica
Copy link
Contributor

For some transaction hashes, e.g., 0x47797217418d267efc5afbe2a670d1fdfd0a1ad5cc098c014a8ee5386b4243da, the RPC method debug_traceTransaction fails with the following error

Cannot destructure property 'call_type' of 'actionsResponse.actions[0]' as it is undefined.

Steps to Reproduce

$ curl --request POST \
  --url https://testnet.hashio.io/api \
  --header 'content-type: application/json' \
  --data '{ "method": "debug_traceTransaction", "id": 2, "jsonrpc": "2.0", "params": ["0x47797217418d267efc5afbe2a670d1fdfd0a1ad5cc098c014a8ee5386b4243da",{"tracer": "callTracer"}] }'

{"error":{"code":-32603,"message":"[Request ID: f798f652-4ebc-49c5-8ba1-0923ac2ae223] Error invoking RPC: Cannot destructure property 'call_type' of 'actionsResponse.actions[0]' as it is undefined."},"jsonrpc":"2.0","id":2}%

Investigate why this happens and fix the issue.

@quiet-node
Copy link
Contributor

It appears that these transaction hashes do not contain any call trace data — specifically, the /contracts/results/{txHash}/actions endpoint returns an empty array.
For example:

curl -X 'GET' \
  'https://testnet.mirrornode.hedera.com/api/v1/contracts/results/0x47797217418d267efc5afbe2a670d1fdfd0a1ad5cc098c014a8ee5386b4243da/actions?limit=2&order=desc' \
  -H 'accept: application/json'

In such cases, the code currently attempts to deconstruct call_type from the first element of the array ([0]), which is undefined. This leads to the observed error when the code tries to access properties of null or undefined.

To improve robustness, we should enhance the null handling logic for this operation to gracefully handle cases where the actions array is empty.

@acuarica acuarica added bug Something isn't working Team Promoted Issues to be triaged and discussed by committers, maintainers, to be worked on the following sprint labels May 12, 2025
@quiet-node quiet-node self-assigned this May 14, 2025
@quiet-node quiet-node moved this from Backlog to Tasks In Progress in Smart Contract Sprint Board May 14, 2025
@quiet-node quiet-node modified the milestones: 0.68.0, 0.69.0 May 14, 2025
@quiet-node quiet-node moved this from Tasks In Progress to In Review in Smart Contract Sprint Board May 15, 2025
@github-project-automation github-project-automation bot moved this from In Review to Done in Smart Contract Sprint Board May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Team Promoted Issues to be triaged and discussed by committers, maintainers, to be worked on the following sprint
Projects
None yet
2 participants