hashgraph / hedera-mirror-node

Hedera Mirror Node archives data from consensus nodes and serves it via an API
Apache License 2.0
147 stars 111 forks source link

Transactions with invalid hash #8922

Closed iron4548 closed 2 months ago

iron4548 commented 3 months ago

Description

DexScreener have been running into an issue using JSON RPC using ethers. They've passed this on to us to report here.

The following code resulted in a 'invalid hash' error via ethers at block 67137631. This isn't the first time they encountered it. They encountered the same issue using hashio.io and validation cloud.

Investigation is required why some transactions without a hash is returned from a mirror node. Ideally the transactions that doesn't contain a valid hash should not be returned via JSON RPC.

import { ethers } from 'ethers';
const p = new ethers.providers.StaticJsonRpcProvider('https://mainnet.hashio.io/api');
void p.getBlock(67137631).then(console.log);
  reason: 'invalid hash',
  code: 'INVALID_ARGUMENT',
  argument: 'value',
  value: '0x',
  checkKey: 'transactions',
  checkValue: [
    '0x944a1cd7cb2e1f91ddb5926880febbc1e0db038d9442dcd8fc9891e6d744b000',
    '0xe2a98bcb8809b809cae7c34094024ba4eb7f3a54fa664a0d143d47ecbfed891f',
    '0x0fbcea39d701c0fcf51546708a20c8b9ba106e660a0280506d3371b954e1887c',
    '0x78d8821effcc796fbceee5a87514406a909991c0739c0308261f1662640aaa68',
    '0x00106326dc10fce5cd5bcc11528c761bfab42f29e35dcd2befe8bc93aed88909',
    '0xef9fff5bc938fb8b72843b21637a835e38194a97e3403b78b2d1faca947f1c50',
    '0x2f07534ab72b83c43f7d4f5f2ab347804258d02debe0fd1a783e1256539f099c',
    '0xf0382fa8931b69958245474105f347ae3791c0dae78795bee629d6b349022e33',
    '0x205e9b745f05068d43454a0d37b4c1d541db8416710bfa2f3bbf2d175a293cd3',
    '0xaa1576437c84cdf09f82b074da775516b37c860e7214cb706b8c18876647fb04',
    '0x7a58c5ea6f16f03266e8de627a284d9a46b15c0e91c20a459d960f258e548c35',
    '0xb7a574c5f7ca5f70231836ed7c071f34f323ec7babcef051cbb3b22473b7238b',
    '0x7451f098b86965f143295712f4b490d6ba2d4ac84c43addc6b98828e9aa7644b',
    '0xbd62cb8450bc6f13a9ffe390c85262cd5934785b1761de0678cfc6a21fb061e2',
    '0x331e303deb5b2beae29283da04f90069f6e06543561c9dbdd07e9f3f67d288b3',
    '0xeb870fc9dacce4ec6edcc4cb703391fbf52ab581a9f609a9a9fb61896e6a6bcf',
    '0x2fb1fae4bc1da5375df51df5979a0f3b23cc7a4aa19a4b77cbcf0be04083ca3a',
    '0x003748053dc0d3a833097d927c32edc88d716fb0c6eca329a7bbf54f80a6c0e9',
    '0xdc54983700a943fc89ad7766757ee113968e931ef1b30a209cb7d2860f2408f1',
    '0xfa41aae8d6d8d9841743690cfac5f80e722937e114f90314b3ae72836738d8d8',
    '0x0ca078c16a928b6c2e794ba2929d2ad8419c565362e869800a6579fcd3f159b4',
    '0x6bc6257568e5a7e0fd38e5cf03d820c274d44dff72dbb8e51a8e4dae913c5cd2',
    '0x445208f1177e25631118d66641981a328649c57d0187cbb8ea3b1f7555986c8f',
    '0x93d006d599f88e70485c4ffa0c925c77fbc8e390c6758559145b46905ff1aea8',
    '0x6c3123d02441865284705ba3ba5fd909a75c5b01ddd54b59c5ab855270dc31e8',
    '0xb2d7ef47224adb25d90aea347c545cb25643bda84a43a6990fb979ea556ab699',
    '0x',
    '0xbc110100f49d4ccc9831b7c38bf3c46004d7ae319b98af4e0c4dc1366932aa85',
    '0x797eec971e4ee6e8c74c1880374efbcdf3ede79b944af51fd18e89e3f85200af',
    '0x0abd4991829a6df6f2eb60fa26ca9647eb18447aadff64a89ee634782e248990',
    '0x302a49fadac61939ed94b748077c9cc609b91e04205f687ebbb0bb3f1bfe6bec',
    '0x623178d0bec4a76204dea92f2158268e5b4b8495df629172bd6cd95747c81ddf',
    '0x07ea799a2c7fa9bbdee7f20950b6d4bbcbed99e2a3eb530660b4d92610aeccc3',
    '0x4f8cafa81214a875411d5f7a99e49cf9f464f88c768953a017cbb26ea9a5a5df',
    '0x1646e7d5e084ae69e4188d1cbb1def8b9243dad4b1e69bb6cbefa85a7a52ab39',
    '0xe69af64061f1545061e4007cdcb0982b32e593560d4df42e4daefb489e3cb08a',
    '0x7b64d4708e4a65e7bb70c2e4ae9dbdf2f3dcd34428ac48910d583d21dd265040',
    '0x297e70d36d3b984eeb225ee58ce1eeb6059a41108125a7871b7c545897054448',
    '0x11080604c6be12a4f951fff67eb15e5d42c9085ae93a41215e21e7a77979f929',
    '0xce8d12b2e1bf75c777f01dcd6905564c300832c0e009fff086c067c3d7e6b35d',
    '0xe7a97541a520f75bcb916aa82b1a05bbda024eb52fe53ba5364a8cc943d1236d',
    '0x7b76d5f66de770ba14e94fed6b39e17d7f007592c53a793fe4f65d3af00036e1',
    '0x4fb15aca01bdabe2d63023592154dafcbe46589d197a18eb01fdc4c24895d1be',
    '0xfc715d8425e1700a083f43cfb24cf381543e297ee8e600fb33608eade5602e3d'
  ]

Steps to reproduce

Run this code:

import { ethers } from 'ethers';
const p = new ethers.providers.StaticJsonRpcProvider('https://mainnet.hashio.io/api');
void p.getBlock(67137631).then(console.log);

Additional context

No response

Hedera network

mainnet

Version

live

Operating system

None

steven-sheehy commented 3 months ago

Looks like some failed Ethereum transactions don't have an transactionRecord.ethereumHash populated and we're not properly copying HAPI transaction hash in those cases. Need to also check if consensus nodes should always be populating the ethereum hash.

https://mainnet.mirrornode.hedera.com/api/v1/contracts/results?timestamp=1722306953.589947003 https://mainnet.mirrornode.hedera.com/api/v1/transactions?timestamp=1722306953.589947003