hardhat
hardhat copied to clipboard
`estimateGas` error message in Hardhat node
A user got this output in their node:
I don't have reproduction steps, although it can probably be simulated locally by hardcoding some throw
somewhere. The point is that a message like that is very confusing and we should either not show anything at all or show something better.
My guess of how to reproduce this:
- Check the part of the code that throws when an unrecognized error happens
- Hardcode that to make it always throw
- Start an
hh node
and send aneth_estimateGas
This issue was marked as stale because it didn't have any activity in the last 30 days. If you think it's still relevant, please leave a comment indicating so. Otherwise, it will be closed in 7 days.
have this issue too
have this issue too with apple m1 and node v18.4.0, hardhat 2.10.2
I have the same issue. Hardhat 2.11.0 I'm trying to test smartcontract locally.
My steps to reproduce:
- Fork the mainnet:
A part of hardhat.config.ts
networks: {
hardhat: {
allowUnlimitedContractSize: true,
forking: {
url: "https://eth-mainnet.g.alchemy.com/v2/<ALCHEMY_KEY>",
}
},
localhost: {
allowUnlimitedContractSize: true,
chainId: 31337,
accounts: [`PRIVATE_KEY1`, `PRIVATE_KEY2`],
},
}
- Auth in metamask, connect to network localhost:8545 with chainId 31337
- Add hardhat account in metamask with PRIVATE_KEY1
- Deploy smartcontract
- Trying to send eth to smartcontract in metamask. Button, which starts the transaction, is inactive
Here, what I have in console:
I confirm. I'm facing the same issue. Absolutely reproducible.
It looks like the issue is in MetaMask browser extension.
It works just fine with MetaMask for Android.
All the transactions to hardhat node
goes well when performed from mobile wallet but not from a browser extension.
I tried Chrome and FireFox extensions.
Finally I got it! It took almost whole day to figure out what is the cause.
The default chainId
of Hardhat node is 31337
and this causes the issue.
I changed it to 1337
and everything works now.
/// hardhat.config.js:
/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
solidity: "0.8.17",
networks: {
hardhat: {
chainId: 1337, // default is 31337
}
}
};
I'm sure the root of the problem is out there. I hope somebody will figure it out and get it fixed eventually.
Finally I got it! It took almost whole day to figure out what is the cause.
The default
chainId
of Hardhat node is31337
and this causes the issue. I changed it to1337
and everything works now./// hardhat.config.js: /** @type import('hardhat/config').HardhatUserConfig */ module.exports = { solidity: "0.8.17", networks: { hardhat: { chainId: 1337, // default is 31337 } } };
I'm sure the root of the problem is out there. I hope somebody will figure it out and get it fixed eventually.
As described here: https://github.com/NomicFoundation/hardhat/issues/3089#issuecomment-1317460141 I'm getting this error as well. But changing the chainId didn't fix the issue.
May it be related to this? https://github.com/trufflesuite/ganache/issues/3332