Skip to content
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

Transaction Receipt fails to handle undefined transaction index #692

Closed
Nana-EC opened this issue Nov 12, 2022 · 3 comments · Fixed by #693
Closed

Transaction Receipt fails to handle undefined transaction index #692

Nana-EC opened this issue Nov 12, 2022 · 3 comments · Fixed by #693
Assignees
Labels
bug Something isn't working P1
Milestone

Comments

@Nana-EC
Copy link
Collaborator

Nana-EC commented Nov 12, 2022

Description

Transaction receipt calls occasionally fail with the following with the transaction_index value is missing

TypeError: Cannot read properties of undefined (reading 'toString') at Function.numberTo0x 

Steps to reproduce

  1. Call eth_getTransactionReceipt for a transaction where Mirror Node does not populate the transaction_index filed

e.g. https://testnet.mirrornode.hedera.com/api/v1/contracts/results/0x0339477ac4e9516be0bca4e1634b250c8fe431b4fce1ced136eccb516ed456fa

Additional context

No response

Hedera network

testnet

Version

v0.11.0

Operating system

No response

@Nana-EC Nana-EC added the bug Something isn't working label Nov 12, 2022
@Nana-EC Nana-EC self-assigned this Nov 12, 2022
@Nana-EC Nana-EC added the P1 label Nov 12, 2022
@Nana-EC Nana-EC moved this to In Progress in Smart Contract Sprint Board Nov 12, 2022
@dimitrovmaksim
Copy link
Collaborator

dimitrovmaksim commented Nov 12, 2022

My wild guess is that, because for the purpose of returning both eth and hedera transactions by hash, we now fetch the transaction info from the contract_result table and use the ContractResults model which in the constructor just maps whatever keys it receives https://github.com/hashgraph/hedera-mirror-node/blob/main/hedera-mirror-rest/model/contractResult.js#L27. Looking at the transaction, it is a failed one, with the INVALID_ACCOUNT_ID error, and because it's a failed transaction it probably does not have an index, because it was not "added" to a block. And if JSON.stringify is used to return the response from the mirror node, it will remove all fields with undefined values.

@Nana-EC Nana-EC added this to the 0.12.0 milestone Nov 14, 2022
@Nana-EC
Copy link
Collaborator Author

Nana-EC commented Nov 16, 2022

@dimitrovmaksim sounds right. I fixed the null handling issue here on the relay but the data is still wrong
Opened hashgraph/hedera-mirror-node#4893

@Nana-EC
Copy link
Collaborator Author

Nana-EC commented Nov 16, 2022

Closing as undefined issue was fixed. Null issue must be fixed my mirror node

@Nana-EC Nana-EC closed this as completed Nov 16, 2022
Repository owner moved this from In Progress to Done in Smart Contract Sprint Board Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P1
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants