Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

JSON RPC method eth_feeHistory returns 1 less item in baseFeePerGas #1559

Closed
macong-cdc opened this issue Dec 16, 2022 · 2 comments · Fixed by #1611
Closed

JSON RPC method eth_feeHistory returns 1 less item in baseFeePerGas #1559

macong-cdc opened this issue Dec 16, 2022 · 2 comments · Fixed by #1611

Comments

@macong-cdc
Copy link

System info:

Steps to reproduce:

curl --location --request POST 'https://eth.bd.evmos.org:8545' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "eth_feeHistory",
    "params": [
        4,
        "latest",
        null
    ],
    "id": 0
}'

Expected behavior:
5 items should be in baseFeePerGas in the response as mentioned here.

This includes the next block after the newest of the returned range, because this value can be derived from the newest block.

Actual behavior:
4 items in baseFeePerGas

{"jsonrpc":"2.0","id":0,"result":{"baseFeePerGas":["0x4a817c800","0x4a817c800","0x4a817c800","0x4a817c800"],"gasUsedRatio":[0.016875,0.003654575,0,0.00144495],"oldestBlock":"0x83e77a"}}

Additional info: [Include gist of relevant config, logs, etc.]

@ramacarlucho
Copy link
Contributor

You are missing an optional param, which is required to obtain the reward response.
The query should look like this

curl --location --request POST 'https://eth.bd.evmos.org:8545' --header 'Content-Type: application/json' --data-raw '{
    "jsonrpc": "2.0",
    "method": "eth_feeHistory",
    "params": [
        4,
        "latest",
        [10,90]
    ],
    "id": 0
}'

So the response is

{"jsonrpc":"2.0","id":0,"result":{"baseFeePerGas":["0x4a817c800","0x4a817c800","0x4a817c800","0x4a817c800"],"gasUsedRatio":[0.00137325,0.0065864,0,0.00332595],"oldestBlock":"0x84075f","reward":[["0x59682f00","0x59682f00"],["0x0","0x0"],["0x0","0x0"],["0x0","0x0"]]}}

@macong-cdc
Copy link
Author

@ramacarlucho
I am not talking about reward in the response, I am talking about number of items in baseFeePerGas in the response.

As mentioned in the documentation, with block_count input of 4, 5 items are expected in baseFeePerGas.

>>> w3.eth.fee_history(4, 'latest', [10, 90])
AttributeDict({
    'oldestBlock': 3,
    'reward': [[220, 7145389], [1000000, 6000213], [550, 550], [125, 12345678]],
    'baseFeePerGas': [202583058, 177634473, 155594425, 136217133, 119442408],
    'gasUsedRatio': [0.007390479689642084, 0.0036988514889990873, 0.0018512333048507866, 0.00741217041320997]
})

However, for ethermint, with an input of 4, 4 items are returned in baseFeePerGas.

@mmsqe mmsqe mentioned this issue Jan 18, 2023
11 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Status: Canceled
Development

Successfully merging a pull request may close this issue.

3 participants