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 10 forks source link

Querying balance at blockheight on EVM return message which contains current latest Cadence block height #569

Closed franklywatson closed 1 month ago

franklywatson commented 1 month ago

Repro

% curl -X POST \
     -H "Content-Type: application/json" \
     --data '{
       "jsonrpc": "2.0",
       "method": "eth_getBalance",
       "params": ["0x1d2d5108e4979fa31d9F73ab955eCF6B00E436D3", "0x814E8"],
       "id": 1
     }' \
     https://mainnet.evm.nodes.onflow.org

{"jsonrpc":"2.0","id":1,"error":{"code":-32000,"message":"failed to get balance of address: 0x1d2d5108e4979fa31d9F73ab955eCF6B00E436D3 at height: 529640, with: invalid height not in available range: 86510775"}}

The value displayed in the response message is 86510775 which is the Cadence latest block height and this is incorrect. it should be returning a value closer to 2,000,000 - https://evm.flowscan.io/

m-Peter commented 1 month ago

From the given error message:

failed to get balance of address: 0x1d2d5108e4979fa31d9F73ab955eCF6B00E436D3 at height: 529640, with: invalid height not in available range: 86510775

the at height: 529640 refers to the EVM block height that was requested.

The remaining part: invalid height not in available range: 86510775, refers to the Cadence block height that we executed the Cadence script to get the EVM balance of an account. This is only to facilitate debugging, and will be removed after we have the local state index.

So I am closing this for now, as there's no actionable.