-
Notifications
You must be signed in to change notification settings - Fork 20.2k
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
Incorrect miner values returned by getBlock RPC methods on clique consensus chains #23455
Comments
This just returns miner without modifying coinbase. |
We use the header from ethClient, and try to get its hash. The hash we got is different from the hash in node, because the coinbase is changed. |
Looks like the PR #23312 is not a good idea. Perhaps we should revert the change and offer users another RPC https://github.com/ethereum/go-ethereum/pull/22987/files to retrieve the signer(clique specific). |
I guess the evidence on this issue can help here: #23463 |
In order to put everything in the same place to help gathering information, here are the details of my analysis related to problems with hashes in v1.10.8. System informationGeth version: Expected behaviourWhen calling Actual behaviourInvalid block hash is returned when Geth version on the server is v1.10.8 and the call is made using the I've tried calling the method using the client library with versions v1.10.4, v1.10.5, v1.10.6, v1.10.7 and v1.10.8, the behavior is the same, it seems to be something related to the server response instead of something in the client. The behaviour is the same independently of the network, we tested it in When making the curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x504174", false],"id":1}' -H "Content-Type: application/json" --dump-header - <<geth address>> output:
it also works properly via when querying via query {
block(number:5259636) {
number
hash
}
} response: {
"data": {
"block": {
"number": 5259636,
"hash": "0x3705a71830dab88c25ca3b5765ffba738bea10339d629b4fb225679b5d8be9de"
}
}
} Steps to reproduce the behaviourRef block: https://goerli.etherscan.io/block/5259636 package main
import (
"context"
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/ethclient"
)
const (
geth_1_10_7_url = ""
geth_1_10_8_url = ""
block = 5259636
)
func main() {
ctx := context.Background()
client_1_10_7, err := ethclient.Dial(geth_1_10_7_url)
panicErr(err)
client_1_10_8, err := ethclient.Dial(geth_1_10_8_url)
panicErr(err)
b_1_10_7, err := client_1_10_7.HeaderByNumber(ctx, big.NewInt(block))
panicErr(err)
b_1_10_8, err := client_1_10_8.HeaderByNumber(ctx, big.NewInt(block))
panicErr(err)
fmt.Printf("Number - b_1_10_7: %v b_1_10_8: %v\n", b_1_10_7.Number, b_1_10_8.Number)
fmt.Printf("Hash - b_1_10_7: %v b_1_10_8: %v\n", b_1_10_7.Hash(), b_1_10_8.Hash())
fmt.Printf("Hash Hex - b_1_10_7: %v b_1_10_8: %v\n", b_1_10_7.Hash().Hex(), b_1_10_8.Hash().Hex())
if b_1_10_7.Number.Cmp(b_1_10_8.Number) != 0 {
panic("hold on, wait a minute, different block number")
}
if b_1_10_7.Hash() != b_1_10_8.Hash() {
panic("hold on, wait a minute, different block hash")
}
if b_1_10_7.Hash().Hex() != b_1_10_8.Hash().Hex() {
panic("hold on, wait a minute, diffferent block hash hex")
}
}
func panicErr(err error) {
if err != nil {
panic(err)
}
} output:
|
System information
Geth version: 1.10.8
OS & Version: n/a
Commit hash : n/a
Expected behaviour
The miner value returned by JSON-RPC methods
eth_getBlockByNumber
andeth_getBlockByHash
on chains using clique consensus (i.e., Rinkeby) contains a candidate sealer nomination or the zero address.Actual behaviour
The miner contains the address of the sealer. This breaks the calculation of the block hash by clients calling the above methods.
This behavior changed with 1.10.8, specifically this PR: #23312
Steps to reproduce the behaviour
Invoke
eth_getBlockByNumber
using block number 9170727. The miner should be0x0000000000000000000000000000000000000000
but is instead0x6635F83421Bf059cd8111f180f0727128685BaE4
Backtrace
n/a
The text was updated successfully, but these errors were encountered: