hardhat icon indicating copy to clipboard operation
hardhat copied to clipboard

Forking config seems not working

Open VetchM opened this issue 1 year ago • 3 comments

Version of Hardhat

2.20.1

What happened?

I am using this config to start a local hardhat node:

module.exports = {
    defaultNetwork: "hardhat",
    networks: {
        hardhat: {
            chainId: 1,
            loggingEnabled: true,
            forking: {
                url: "https://eth-mainnet.g.alchemy.com/v2/<api_key>",
            }
        },
    },
};

This file is working because the chainId of my local node is changed, but i keep getting this error when I ran my test:

eth_maxPriorityFeePerGas - Method not supported

Using npx hardhat node --forking https://eth-mainnet.g.alchemy.com/v2/<api_key> has the same behavior. If I request the "eth_maxPriorityFeePerGas" RPC using the alchemy url, I can get the correct result. Any idea what went wrong?

The node version is v20.11.1, the OS is Windows 10.

Minimal reproduction steps

Put this config at the root directory:

module.exports = {
    defaultNetwork: "hardhat",
    networks: {
        hardhat: {
            chainId: 1,
            loggingEnabled: true,
            forking: {
                url: "https://eth-mainnet.g.alchemy.com/v2/<api_key>",
            }
        },
    },
};

Run npx hardhat node to start a node then run this:

curl --location 'http://127.0.0.01:8545' \
--header 'Content-Type: application/json' \
--data '{
    "jsonrpc": "2.0",
    "method": "eth_maxPriorityFeePerGas",
    "params": [],
    "id": 83
}'

The response is:

{
    "jsonrpc": "2.0",
    "id": 83,
    "error": {
        "code": -32601,
        "message": "Method eth_maxPriorityFeePerGas not found",
        "data": {
            "message": "Method eth_maxPriorityFeePerGas not found"
        }
    }
}

Search terms

Hardnet Forking eth_maxPriorityFeePerGas

VetchM avatar Feb 28 '24 04:02 VetchM

Do I need to provide any extar info to help you spot the problem?

VetchM avatar Mar 05 '24 10:03 VetchM

i have the same problem

hawkj avatar Mar 29 '24 08:03 hawkj

https://github.com/NomicFoundation/hardhat/issues/5187#issuecomment-2108796843

phpmac avatar May 13 '24 21:05 phpmac

The issue here is that the Hardhat node does not support eth_maxPriorityFeePerGas.

We are tracking this issue here: https://github.com/NomicFoundation/hardhat/issues/4365

We have put together an implementation as part of EDR (our reimplemented local development node): https://github.com/NomicFoundation/edr/issues/369

The new version of EDR will ship as part of [email protected] next week: https://github.com/NomicFoundation/hardhat/pull/5213

kanej avatar May 30 '24 13:05 kanej

I am closing this issue in preference to #4365

kanej avatar May 30 '24 13:05 kanej