Closed maxhiker closed 1 year ago
Tests did not found this issue, because there is no deep check of receipt.logs field, see test source.
May be it could be done with help of some library, able to validate json schema (ajv/yup,... ?).
Fixed by #3767; verified on Zilliqa v9.2.5.
Issue
"0x" prefix is missed for "data" field in function libEth/Eth.cpp -> ConvertScillaEventsToEvm(const Json::Value &evmEvents).
So eth_getTransactionReceipt displays logs.data field without 0x prefix.
Also this function is used in BlocksCache.cpp
As result, transaction receipt can't be correctly processed by libraries, I checked with latest hardhat-ethers@6.7.1:
Error: invalid value for value.logs (invalid value for value.data
Error: invalid value for value.logs (invalid value for value.data (invalid data (argument="value", value="000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001A27B0A09225F6576656E746E616D6522203A20225472616E7366657253756363657373222C0A09226164647265737322203A2022307861346265386564336466633937383737376165656639333639363161313063363363633532643939222C0A0922706172616D7322203A200A095B0A09097B0A090909227479706522203A202242795374723230222C0A0909092276616C756522203A2022307866306362323461633636626137333735626639623963346661393165323038643965616162643265222C0A09090922766E616D6522203A202273656E646572220A09097D2C0A09097B0A090909227479706522203A202242795374723230222C0A0909092276616C756522203A2022307863663637313735366138323338636265623139626362346437376663393039316532666365316133222C0A09090922766E616D6522203A2022726563697069656E74220A09097D2C0A09097B0A090909227479706522203A202255696E74313238222C0A0909092276616C756522203A2022313530222C0A09090922766E616D6522203A2022616D6F756E74220A09097D0A095D0A7D000000000000000000000000000000000000000000000000000000000000", code=INVALID_ARGUMENT, version=6.7.1)) (value={ "address": "0xa4be8ed3dfc978777aeef936961a10c63cc52d99", "blockHash": "0xe59f4691048d7880233a2036c69aa21e854c7fc625e75c456b90cd749fc79eb8", "blockNumber": "0x4d6", "data": "000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001A27B0A09225F6576656E746E616D6522203A20225472616E7366657253756363657373222C0A09226164647265737322203A2022307861346265386564336466633937383737376165656639333639363161313063363363633532643939222C0A0922706172616D7322203A200A095B0A09097B0A090909227479706522203A202242795374723230222C0A0909092276616C756522203A2022307866306362323461633636626137333735626639623963346661393165323038643965616162643265222C0A09090922766E616D6522203A202273656E646572220A09097D2C0A09097B0A090909227479706522203A202242795374723230222C0A0909092276616C756522203A2022307863663637313735366138323338636265623139626362346437376663393039316532666365316133222C0A09090922766E616D6522203A2022726563697069656E74220A09097D2C0A09097B0A090909227479706522203A202255696E74313238222C0A0909092276616C756522203A2022313530222C0A09090922766E616D6522203A2022616D6F756E74220A09097D0A095D0A7D000000000000000000000000000000000000000000000000000000000000", "logIndex": "0x0", "removed": false, "topics": [ "0xA5901FDB53EF45260C18811F35461E0EDA2B6133D807DABBFB65314DD4FC2FAC" ], "transactionHash": "0xfb221b3d7329af53a090468bcd666037062bcf2f95e26495655c5431eeaf3bef", "transactionIndex": 0 }, code=BAD_DATA, version=6.7.1)) (value={ "blockHash": "0xe59f4691048d7880233a2036c69aa21e854c7fc625e75c456b90cd749fc79eb8", "blockNumber": "0x4d6", "contractAddress": null, "cumulativeGasUsed": "0x587dc", "effectiveGasPrice": "0xf4240", "from": "0xf0cb24ac66ba7375bf9b9c4fa91e208d9eaabd2e", "gasUsed": "0x587dc", "logs": [ { "address": "0xa4be8ed3dfc978777aeef936961a10c63cc52d99", "blockHash": "0xe59f4691048d7880233a2036c69aa21e854c7fc625e75c456b90cd749fc79eb8", "blockNumber": "0x4d6", "data": "000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001A27B0A09225F6576656E746E616D6522203A20225472616E7366657253756363657373222C0A09226164647265737322203A2022307861346265386564336466633937383737376165656639333639363161313063363363633532643939222C0A0922706172616D7322203A200A095B0A09097B0A090909227479706522203A202242795374723230222C0A0909092276616C756522203A2022307866306362323461633636626137333735626639623963346661393165323038643965616162643265222C0A09090922766E616D6522203A202273656E646572220A09097D2C0A09097B0A090909227479706522203A202242795374723230222C0A0909092276616C756522203A2022307863663637313735366138323338636265623139626362346437376663393039316532666365316133222C0A09090922766E616D6522203A2022726563697069656E74220A09097D2C0A09097B0A090909227479706522203A202255696E74313238222C0A0909092276616C756522203A2022313530222C0A09090922766E616D6522203A2022616D6F756E74220A09097D0A095D0A7D000000000000000000000000000000000000000000000000000000000000", "logIndex": "0x0", "removed": false, "topics": [ "0xA5901FDB53EF45260C18811F35461E0EDA2B6133D807DABBFB65314DD4FC2FAC" ], "transactionHash": "0xfb221b3d7329af53a090468bcd666037062bcf2f95e26495655c5431eeaf3bef", "transactionIndex": 0 }, { "address": "0x217f8a136325f1fa02e0db3c9093e2a81e463fa2", "blockHash": "0xe59f4691048d7880233a2036c69aa21e854c7fc625e75c456b90cd749fc79eb8", "blockNumber": "0x4d6", "data": "0x", "logIndex": "0x1", "removed": false, "topics": [ "0x0c6221d88a8ea39a8a13fba624ad0d417e0d618ac9363931d5ed211a9c02a318" ], "transactionHash": "0xfb221b3d7329af53a090468bcd666037062bcf2f95e26495655c5431eeaf3bef", "transactionIndex": 0 } ], "logsBloom": "0x00200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000200000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000002000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000", "r": "0x152250143ACC4828EC0D429BC70C4B2FAF1985C5CD8A6E6B454651D2D9FA5ADE", "root": "0x0000000000000000000000000000000000000000000000000000000000001010", "s": "0x05A50B7AF0370C28276ACE4227D6F6E41BE13FF9D493748063311F8730C4A65E", "status": "0x1", "to": "0x217f8a136325f1fa02e0db3c9093e2a81e463fa2", "transactionHash": "0xfb221b3d7329af53a090468bcd666037062bcf2f95e26495655c5431eeaf3bef", "transactionIndex": "0x0", "v": "0x101df" }, code=BAD_DATA, version=6.7.1) at makeError (node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/src.ts/utils/errors.ts:685:21) at assert (node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/src.ts/utils/errors.ts:702:25) at /home/mx/Desktop/_Work/avely/avely-evm/node_modules/.pnpm/@nomicfoundation+hardhat-ethers@3.0.4_ethers@6.7.1_hardhat@2.17.1/node_modules/@nomicfoundation/hardhat-ethers/src/internal/ethers-utils.ts:162:15 at formatTransactionReceipt (node_modules/.pnpm/@nomicfoundation+hardhat-ethers@3.0.4_ethers@6.7.1_hardhat@2.17.1/node_modules/@nomicfoundation/hardhat-ethers/src/internal/ethers-utils.ts:337:10) at HardhatEthersProvider._wrapTransactionReceipt (node_modules/.pnpm/@nomicfoundation+hardhat-ethers@3.0.4_ethers@6.7.1_hardhat@2.17.1/node_modules/@nomicfoundation/hardhat-ethers/src/internal/hardhat-ethers-provider.ts:687:59) at HardhatEthersProvider.getTransactionReceipt (node_modules/.pnpm/@nomicfoundation+hardhat-ethers@3.0.4_ethers@6.7.1_hardhat@2.17.1/node_modules/@nomicfoundation/hardhat-ethers/src/internal/hardhat-ethers-provider.ts:335:17) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async ContractTransactionResponse.wait (node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/src.ts/providers/provider.ts:1476:25) at async ContractTransactionResponse.wait (node_modules/.pnpm/ethers@6.7.1/node_modules/ethers/src.ts/contract/wrappers.ts:136:25) at async Context.Error is raising in ethers-utils->formatData() function.
Steps to Reproduce
eth_getTransactionReceipt
Expected
{ "id": 62, "jsonrpc": "2.0", "result": { .... "logs": [ { "data": "0x.....", .... }, ....
Actual
0x missed
Impact:
Additional Details
It should start with "0x", according to https://ethereum.github.io/execution-apis/api-documentation/#eth_getTransactionReceipt
Schemas
https://github.com/ethereum/execution-apis/blob/main/src/schemas/receipt.yaml#L29
https://github.com/ethereum/execution-apis/blob/main/src/schemas/base-types.yaml#L14C1-L17C25