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

erigon2: eth_getBlockByHash returns incorrect miner field on matic #12690

Closed
quickchase opened this issue Nov 8, 2024 · 2 comments · Fixed by #13335
Closed

erigon2: eth_getBlockByHash returns incorrect miner field on matic #12690

quickchase opened this issue Nov 8, 2024 · 2 comments · Fixed by #13335
Assignees
Labels
imp1 High importance polygon
Milestone

Comments

@quickchase
Copy link
Contributor

System information

Erigon version: erigon/2.60.9/linux-amd64/go1.22.8

Chain/Network: bor-mainnet (matic)

Expected behaviour

eth_getBlockByHash output is the same as eth_getBlockByNumber output when the block/hashes are the same block

Actual behaviour

eth_getBlockByHash returns with the miner field populated, instead of 0x0000000000000000000000000000000000000000

Steps to reproduce the behaviour

# Set your node URL
NODE=http://localhost:8545

# Get the block hash of 0x3d146d3
curl -s -H 'Content-Type: application/json' $NODE -d '{"jsonrpc":"2.0","id":1,"method":"eth_getBlockByNumber","params":["0x3d146d3",false]}' | jq '.result.hash'
"0x8d7953e6bc4c154e1b4561554effa23f17850829bdfb755d7ff6aa2b30232dc4"

# Check the miner field of 0x3d146d3
curl -s -H 'Content-Type: application/json' $NODE -d '{"jsonrpc":"2.0","id":1,"method":"eth_getBlockByNumber","params":["0x3d146d3",false]}' | jq '.result.miner'
"0x0000000000000000000000000000000000000000"

# Check the miner field of 0x3d146d3, but this time using the hash
curl -s -H 'Content-Type: application/json' $NODE -d '{"jsonrpc":"2.0","id":1,"method":"eth_getBlockByHash","params":["0x8d7953e6bc4c154e1b4561554effa23f17850829bdfb755d7ff6aa2b30232dc4",false]}' | jq '.result.miner'
"0x794e44d1334a56fea7f4df12633b88820d0c5888"

As you can see, the miner field is wrong for eth_getBlockByHash

@cshintov
Copy link
Contributor

Happening for us as well.. for all blocks..

Fetching the block hash for block number 0x3dc03b1...
Block Hash: 0x1e3b36405cac88d4980cf5e3893f8b773a9833fee87f7e33253a773d1a08f3ed
Checking the miner field for block number 0x3dc03b1...
Miner field for block 0x3dc03b1: 0x0000000000000000000000000000000000000000
Checking the miner field for the block using its hash 0x1e3b36405cac88d4980cf5e3893f8b773a9833fee87f7e33253a773d1a08f3ed...
Miner field for block hash 0x1e3b36405cac88d4980cf5e3893f8b773a9833fee87f7e33253a773d1a08f3ed: 0xfcccd43296d9c1601a904eca9b339d94a5e5e098

@cshintov
Copy link
Contributor

Seems like block by hash has special handling for miner field..

if chainConfig.Bor != nil {
borConfig := chainConfig.Bor.(*borcfg.BorConfig)
response["miner"], _ = ecrecover(block.Header(), borConfig)
}

@VBulikov VBulikov added this to the 2.60.11-fixes milestone Dec 6, 2024
@yperbasis yperbasis modified the milestones: 2.61.0-fixes, 2.61.1-fixes Dec 17, 2024
@mh0lt mh0lt assigned shohamc1 and unassigned mh0lt Jan 3, 2025
antonis19 pushed a commit that referenced this issue Jan 8, 2025
Fixes #12690

```bash
➜  ~ curl --request POST \
  -s --url http://127.0.0.1:8545/ \
  --header 'Content-Type: application/json' \
  --data '{
        "method": "eth_getBlockByNumber",
        "params": [
                "0x3F515FC",
                false
        ],
        "id": 1,
        "jsonrpc": "2.0"
}' | jq '.result.miner'
"0x83d69448f88bf9c701c1b93f43e1f753d39b2632"
➜  ~ curl --request POST \
  -s --url http://127.0.0.1:8545/ \
  --header 'Content-Type: application/json' \
  --data '{
        "method": "eth_getBlockByHash",
        "params": [
                "0xd925f567ee22d63a003f890af94c1e77e6d4d55a3bcef2b35b7b2317948d7f28",
                false
        ],
        "id": 1,
        "jsonrpc": "2.0"
}' | jq '.result.miner'
"0x83d69448f88bf9c701c1b93f43e1f753d39b2632"
```
@yperbasis yperbasis modified the milestones: 2.61.1-fixes, 3.0.0-beta1 Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
imp1 High importance polygon
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants