Skip to content
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

Header.Hash returns wrong values on testnets (not on mainnet) #23511

Closed
sebastianst opened this issue Aug 31, 2021 · 2 comments
Closed

Header.Hash returns wrong values on testnets (not on mainnet) #23511

sebastianst opened this issue Aug 31, 2021 · 2 comments
Labels

Comments

@sebastianst
Copy link
Contributor

System information

Geth versions: Tested with 1.10.5, 1.10.6 and 1.10.8
OS & Version: Linux

Expected behaviour

Header.Hash() returns the hash value of the block.

Actual behaviour

Header.Hash() returns a different hash value, not obviously connected to the actual hash value.

Steps to reproduce the behaviour

Run the minimal example at https://github.com/sebastianst/geth-header-test

It will output something like

$ go run main.go
2021/08/31 11:58:20 🐛 HeaderByNumber Hash mismatch, expected 0xb85f4e8338828821a821217fbc8c501b21b8752d71b77fe0dae35783d74423d3, got 0x72be6a592a523e8bfc6f0c3ce6f0a4b2734e48a787ffce1d8928416ba1fde03f
2021/08/31 11:58:20 Num: 5410648, Hash: 0x72be6a592a523e8bfc6f0c3ce6f0a4b2734e48a787ffce1d8928416ba1fde03f, Header:
&{ParentHash:0x73fd53ef990d4f1e88cfafecc0b132d17bb8a27600b80e3bcddc30142c11759f UncleHash:0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347 Coinbase:0x22eA9f6b28DB76A7162054c05ed812dEb2f519Cd Root:0x18b2631a67836bf527f3511e4aadd42b9af0851b01857c6520b1d5531fa07f4c TxHash:0x47d6aad498c1999db862c1f2edf2f23963b988dbad4ffc6e785aac017276e835 ReceiptHash:0xd6d54e095b74af213df0a70e7c5becdd5adfd05a832162cd7ac0ef162b7aaf0a Bloom:[0 0 1 0 0 0 0 0 2 32 0 0 4 0 0 0 0 0 0 0 0 0 0 128 1 128 0 0 0 4 0 0 0 0 0 0 0 2 0 0 0 0 0 16 0 0 0 0 64 0 64 0 0 0 0 0 0 8 0 0 0 4 0 0 0 0 0 0 128 0 0 0 1 0 0 44 0 2 0 0 16 5 0 0 0 36 0 0 0 0 0 0 2 0 0 0 0 1 0 1 2 0 0 8 0 128 0 16 0 0 8 0 0 0 0 64 0 32 136 0 0 0 0 16 0 16 0 64 0 0 0 64 32 3 32 0 0 8 0 0 0 0 0 0 0 0 0 5 0 8 0 0 0 0 0 8 0 192 0 32 0 0 0 0 32 0 0 16 0 2 0 0 0 0 0 0 16 0 0 0 8 0 0 64 0 0 0 0 8 1 0 0 0 0 0 2 0 128 0 4 0 0 0 0 0 0 0 0 65 4 8 0 0 0 0 0 0 0 0 0 0 0 96 0 0 0 64 0 1 0 0 16 0 1 0 0 0 8 0 0 0 64 0 8 0 0 0 0 8 0 0 0 0 0 32 0] Difficulty:+2 Number:+5410648 GasLimit:29999944 GasUsed:5221524 Time:1630330898 Extra:[0 0 0 0 0 0 67 111 110 115 101 110 83 121 115 32 72 121 112 101 114 108 101 100 103 101 114 32 66 101 115 117 140 189 122 128 207 27 95 5 126 170 83 166 44 168 253 171 86 171 44 227 18 46 147 221 50 189 42 121 91 240 244 67 49 238 219 103 90 42 14 193 116 160 70 44 169 131 235 211 136 141 199 50 13 144 21 180 179 220 18 227 228 102 234 65 1] MixDigest:0x0000000000000000000000000000000000000000000000000000000000000000 Nonce:[0 0 0 0 0 0 0 0] BaseFee:+8}
2021/08/31 11:58:20 🐛 HeaderByHash Hash mismatch, expected 0xb85f4e8338828821a821217fbc8c501b21b8752d71b77fe0dae35783d74423d3, got 0x72be6a592a523e8bfc6f0c3ce6f0a4b2734e48a787ffce1d8928416ba1fde03f
2021/08/31 11:58:20 Num: 5410648, Hash: 0x72be6a592a523e8bfc6f0c3ce6f0a4b2734e48a787ffce1d8928416ba1fde03f, Header:
&{ParentHash:0x73fd53ef990d4f1e88cfafecc0b132d17bb8a27600b80e3bcddc30142c11759f UncleHash:0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347 Coinbase:0x22eA9f6b28DB76A7162054c05ed812dEb2f519Cd Root:0x18b2631a67836bf527f3511e4aadd42b9af0851b01857c6520b1d5531fa07f4c TxHash:0x47d6aad498c1999db862c1f2edf2f23963b988dbad4ffc6e785aac017276e835 ReceiptHash:0xd6d54e095b74af213df0a70e7c5becdd5adfd05a832162cd7ac0ef162b7aaf0a Bloom:[0 0 1 0 0 0 0 0 2 32 0 0 4 0 0 0 0 0 0 0 0 0 0 128 1 128 0 0 0 4 0 0 0 0 0 0 0 2 0 0 0 0 0 16 0 0 0 0 64 0 64 0 0 0 0 0 0 8 0 0 0 4 0 0 0 0 0 0 128 0 0 0 1 0 0 44 0 2 0 0 16 5 0 0 0 36 0 0 0 0 0 0 2 0 0 0 0 1 0 1 2 0 0 8 0 128 0 16 0 0 8 0 0 0 0 64 0 32 136 0 0 0 0 16 0 16 0 64 0 0 0 64 32 3 32 0 0 8 0 0 0 0 0 0 0 0 0 5 0 8 0 0 0 0 0 8 0 192 0 32 0 0 0 0 32 0 0 16 0 2 0 0 0 0 0 0 16 0 0 0 8 0 0 64 0 0 0 0 8 1 0 0 0 0 0 2 0 128 0 4 0 0 0 0 0 0 0 0 65 4 8 0 0 0 0 0 0 0 0 0 0 0 96 0 0 0 64 0 1 0 0 16 0 1 0 0 0 8 0 0 0 64 0 8 0 0 0 0 8 0 0 0 0 0 32 0] Difficulty:+2 Number:+5410648 GasLimit:29999944 GasUsed:5221524 Time:1630330898 Extra:[0 0 0 0 0 0 67 111 110 115 101 110 83 121 115 32 72 121 112 101 114 108 101 100 103 101 114 32 66 101 115 117 140 189 122 128 207 27 95 5 126 170 83 166 44 168 253 171 86 171 44 227 18 46 147 221 50 189 42 121 91 240 244 67 49 238 219 103 90 42 14 193 116 160 70 44 169 131 235 211 136 141 199 50 13 144 21 180 179 220 18 227 228 102 234 65 1] MixDigest:0x0000000000000000000000000000000000000000000000000000000000000000 Nonce:[0 0 0 0 0 0 0 0] BaseFee:+8}
2021/08/31 11:58:20 ✅ HeaderbyNumber/Hash return headers with same hash value.
2021/08/31 11:58:20 🐛 (Expected) error getting header again with own hash: not found
2021/08/31 11:58:20 🐛 ParentHash mismatch, expected 0xb85f4e8338828821a821217fbc8c501b21b8752d71b77fe0dae35783d74423d3, got 0x72be6a592a523e8bfc6f0c3ce6f0a4b2734e48a787ffce1d8928416ba1fde03f

Tested to fail on Goerli and Rinkeby.

Possibly connected to #23509 but this issue is about the Go API.

@MariusVanDerWijden
Copy link
Member

This should be fixed in current master by #23466

@sebastianst
Copy link
Contributor Author

I can confirm that running the example on v1.10.8 against a node running on master (currently 067084f) fixes the problem.

Also seems like a duplicate of #23463

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants