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

Block 910 has a hash different then the one reported from evm-testnet.flowscan #509

Closed infsaulo closed 3 weeks ago

infsaulo commented 3 weeks ago

Problem

Block at height 910 returned by RPC method eth_getBlockByNumber differs from the one reported from https://evm-testnet.flowscan.io/block/0x1c6c3abf6ddff90fbb69b13f62cf590433efbb1452dcb5732efdd2939b341847

While the hash of the one reported by the RPC JSON method is 0x8916f466b60de37b5f50e58fabf92389f2c11ccdddb72f6e79e3597e7a5ec060 the one reported from the explorer is 0x1c6c3abf6ddff90fbb69b13f62cf590433efbb1452dcb5732efdd2939b341847

Steps to Reproduce

  1. Query curl https://testnet.evm.nodes.onflow.org -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x38E", true],"id":1}'

It's returned: {"jsonrpc":"2.0","id":1,"result":{"number":"0x38e","hash":"0x8916f466b60de37b5f50e58fabf92389f2c11ccdddb72f6e79e3597e7a5ec060","parentHash":"0x89bc30de9b8cc19cad79c314517bc01e0bbb6b7cfe553bef2a2cd83c33d07a71","nonce":"0x0100000000000000","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","transactionsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","stateRoot":"0x0000000000000000000000000000000000000000000000000000000000000000","receiptsRoot":"0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421","miner":"0x0000000000000000000000030000000000000000","difficulty":"0x0","totalDifficulty":"0x0","extraData":"0x","size":"0x9c","gasLimit":"0xe4e1c0","gasUsed":"0x0","timestamp":"0x66bcfbcb","transactions":[],"uncles":[],"mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","baseFeePerGas":"0x0"}}

  1. Compare hashes with the one returned from https://evm-testnet.flowscan.io/block/0x1c6c3abf6ddff90fbb69b13f62cf590433efbb1452dcb5732efdd2939b341847

Acceptance Criteria

The results should be identical if they are in the main branch.

alecalve commented 3 weeks ago

Additionally, block 911 returns a parent which is not block 910:

$ curl --silent https://testnet.evm.nodes.onflow.org -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x38E", true],"id":1}' | jq ".result.hash"
"0x8916f466b60de37b5f50e58fabf92389f2c11ccdddb72f6e79e3597e7a5ec060"

and

$ curl --silent https://testnet.evm.nodes.onflow.org -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x38F", true],"id":1}' | jq ".result.parentHash"
"0x1c6c3abf6ddff90fbb69b13f62cf590433efbb1452dcb5732efdd2939b341847"
sideninja commented 3 weeks ago

@infsaulo flowscan likely didn't reindex the data after an HCU which changed the block format. This would result in wrong hashes.

sideninja commented 3 weeks ago

@alecalve this is due to breaking change during an HCU. I will look into how we can migrate the hashes.

alecalve commented 3 weeks ago

@sideninja Would these changes occur once the mainnet launches? If so how frequently and will you re-index the data again automatically or would we have to notify you if we see it?

sideninja commented 3 weeks ago

@alecalve none of this issues should be on mainnet, neither on testnet, so we are taking a look if something got broken during testnet update.

sideninja commented 3 weeks ago

@alecalve we found an issue and we fixed it, it will take some time to reindex the data and reflect the fix on testnet. Thank you for this report.