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

null value returned for amount by MirrorNode for contract result queries #710

Closed
dimitrovmaksim opened this issue Nov 23, 2022 · 1 comment · Fixed by #715
Closed

null value returned for amount by MirrorNode for contract result queries #710

dimitrovmaksim opened this issue Nov 23, 2022 · 1 comment · Fixed by #715
Assignees
Labels
bug Something isn't working limechain P1
Milestone

Comments

@dimitrovmaksim
Copy link
Collaborator

dimitrovmaksim commented Nov 23, 2022

Description

The relay breaks with

   err: {
      "type": "TypeError",
      "message": "Cannot read properties of null (reading 'toString')",
      "stack":
          TypeError: Cannot read properties of null (reading 'toString')
              at Function.numberTo0x (/Users/maksimdimitrov/Projects/hedera/hedera-json-rpc-relay/packages/relay/dist/lib/eth.js:948:41)
              at /Users/maksimdimitrov/Projects/hedera/hedera-json-rpc-relay/packages/relay/dist/lib/eth.js:1139:40
              at runMicrotasks (<anonymous>)
              at processTicksAndRejections (node:internal/process/task_queues:96:5)
    }

for some contract result queries
https://testnet.mirrornode.hedera.com/api/v1/contracts/0x0000000000000000000000000000000000004320/results/1599360484.445086003

I suspect the culprit here is the amount property being null

I'm not sure if this is by design or is an issue in the mirror-node and if it should be resolved here or in the mirror-node

Steps to reproduce

https://testnet.mirrornode.hedera.com/api/v1/contracts/0x0000000000000000000000000000000000004320/results/1599360484.445086003

Additional context

No response

Hedera network

testnet

Version

0.11.0

Operating system

No response

@dimitrovmaksim dimitrovmaksim added the bug Something isn't working label Nov 23, 2022
@Nana-EC
Copy link
Collaborator

Nana-EC commented Nov 24, 2022

@dimitrovmaksim according to contrctFunctionResult.amount the mirror node will have a null contractResult.amount for ContractCreate and ContractCall since these currently don't send HBARs in the form of direct transfers.

The relay should handle this and set transaction.value as 0 in these cases.
I think we can do this with a value: EthImpl.numberTo0x(contractResult.amount), -> value: EthImpl.nullableNumberTo0x(contractResult.amount), change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working limechain P1
Projects
Archived in project
2 participants