-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calculated hash for fetched block is wrong [go-ethereum] #719
Comments
I encountered the same problem with transaction hashes: package main
import (
"context"
"fmt"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
)
func main() {
DoTest("https://sepolia.infura.io/v3/xx", "0x6e75a5cf4d4260a036d4722dd3eb5cf184dcaeb4e12c8e977589a4ee70a69c41", 0)
// https://evm-testnet.flowscan.io/block/0x868ef12b3bc5079c39960ac510835f186bdf0a00f33a0afe60d47c59d2777691?tab=txs
// will fail due to wrong hash calc
// correct hash is 0xc92affd12a71f201e7f1bf34a56500114c480918856e574fa6577ee172a9a226
DoTest("https://testnet.evm.nodes.onflow.org", "0x868ef12b3bc5079c39960ac510835f186bdf0a00f33a0afe60d47c59d2777691", 0)
}
func DoTest(endpoint string, blockHash string, txIndex uint) {
ctx := context.Background()
fmt.Printf("-------- %s --------\n", endpoint)
client, err := ethclient.Dial(endpoint)
if err != nil {
panic(err)
}
tx, err := client.TransactionInBlock(ctx, common.HexToHash(blockHash), txIndex)
if err != nil {
panic(err)
}
fmt.Println(tx.Hash())
receipt, err := client.TransactionReceipt(ctx, tx.Hash())
if err != nil {
panic(err)
}
fmt.Println(receipt.Status)
} Output:
|
how flow-evm block is structured is different than how go-ethereum block is AFAIK, I don't think it can ever match. ( for old blocks ) but ofc hash calculation can be changed for newer ones. |
Regarding the block hash calculation, Flow EVM has its own Regarding the tx hash calculation, the example listed above, involves a transaction that is formed from a direct call (originated from a COA). See the I tried with a regular EVM transaction (https://evm-testnet.flowscan.io/tx/0x919b5c3edf188bcfa149a102120d81389195b1fc498bd4ba64ff0ebc4a8f68d3), and the Update: We could try to update our fork of go-ethereum, located here: https://github.com/onflow/go-ethereum . We could also try to update the original |
Problem
There seems to be an issue with fetching blocks from the Flow network.
eth_getBlockByNumber
returns the correct hash butgo-ethereum
tries to calculate block hashes locally and ends up with a different one.Steps to Reproduce
This code reproduces the issue:
Output:
The correct block hash for the above height (
25531317
) is0x1ca014b7d9dd67e93d777bc5c94a1f1be8be9017375aae94e1abc6240986d0cf
ExplorerAcceptance Criteria
Flow behaviour should match Sepolia.
go-ethereum
should be able to calculate the correct block hash andeth_getBlockByHash
call above should succeed.The text was updated successfully, but these errors were encountered: