onflow / flow-evm-gateway

FlowEVM Gateway implements an Ethereum-equivalent JSON-RPC API for EVM clients to use
https://developers.flow.com/evm/about
Apache License 2.0
11 stars 9 forks source link

Mainnet: same datatype with different representations #531

Closed infsaulo closed 2 weeks ago

infsaulo commented 3 weeks ago

Problem

There is some inconsistency on the representation of integers/decimals from returned json's of flow gateway(mainnet).

Particularly, the returned responses for eth_getBlockReceipts contains inconsistency on the representation of integers/decimal fields.

Some of those fields are represented as hex string while other ones are represented as raw integer/decimal.

Steps to Reproduce

First example for gasUsed returned:

  1. Requesting
    curl https://mainnet.evm.nodes.onflow.org -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_getBlockReceipts","params":["0x31A"],"id":1}' | jq '.result | .[].gasUsed'
  2. Returns
    2271293

Second example it shows the difference from the representation of same data - blockNumber field: while the one under logs is returned as "0x31a", the outermost one is returned as 794

  1. Requesting

    curl https://mainnet.evm.nodes.onflow.org -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_getBlockReceipts","params":["0x31A"],"id":1}' | jq '.result'
  2. Returns

    [
    {
    "type": 255,
    "root": "",
    "status": 1,
    "cumulativeGasUsed": 2271293,
    "logsBloom": "0x00000000000000000000000000000000000000000000000000800000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000400000000004000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000020000000000000000000000000000000010000000000000000000000000040000000",
    "logs": [
      {
        "address": "0xe7c2b80a9de81340ae375b3a53940e9aeead79df",
        "topics": [
          "0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0",
          "0x0000000000000000000000000000000000000000000000000000000000000000",
          "0x00000000000000000000000000000000000000000000000249250a5c27ecab3b"
        ],
        "data": "0x",
        "blockNumber": "0x31a",
        "transactionHash": "0x14860a79e1f5da3a6de69be401edb396ac4f38b589d7e65efc2f08817d5ba5c3",
        "transactionIndex": "0x0",
        "blockHash": "0x01a11ae30eb9f79eda8c25bc3bbbdf78a92c82e2e2e243244b46aa6df5a6e9f8",
        "logIndex": "0x0",
        "removed": false
      }
    ],
    "transactionHash": "0x14860a79e1f5da3a6de69be401edb396ac4f38b589d7e65efc2f08817d5ba5c3",
    "contractAddress": "0xe7c2b80a9de81340ae375b3a53940e9aeead79df",
    "gasUsed": 2271293,
    "effectiveGasPrice": 0,
    "blobGasPrice": 0,
    "blockHash": "0x01a11ae30eb9f79eda8c25bc3bbbdf78a92c82e2e2e243244b46aa6df5a6e9f8",
    "blockNumber": 794,
    "transactionIndex": 0,
    "revertReason": "",
    "PrecompiledCalls": ""
    }
    ]

Acceptance Criteria

Same datatype shouldn't have multiple representations. Other EVM's, for example, represent any integers/decimals as hex string.

m-Peter commented 3 weeks ago

@infsaulo Thanks for the report :bow: We'll get this fixed asap :pray:

infsaulo commented 2 weeks ago

@m-Peter should should we expect to get the expected/fixed responses once the PR and this issue got closed? Just asking because I just replicated the curl cmd above but still seeing same response.

m-Peter commented 2 weeks ago

Hey @infsaulo, running:

curl -s https://mainnet.evm.nodes.onflow.org -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":1}' | jq

Returns:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "flow-evm-gateway@v0.35.0-storage-dissable"
}

And I see that the latest deployed tag (https://github.com/onflow/flow-evm-gateway/releases/tag/v0.35.0-storage-dissable), does not include that fix for eth_getBlockReceipts endpoint. I believe there was no deployment to either mainnet / testnet.