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

eth_estimateGas - error , l can't connect my Dapp with my #3089

Closed
Programmer001-JS opened this issue Aug 28, 2022 · 16 comments
Closed

eth_estimateGas - error , l can't connect my Dapp with my #3089

Programmer001-JS opened this issue Aug 28, 2022 · 16 comments

Comments

@Programmer001-JS
Copy link

eth_estimateGas

If you think this is a bug in Hardhat, please report it here: https://hardhat.org/reportbug

*** l can't connect and approve transactions with my wallet metamask.
l run - npx hardhat test - in terminal , and l had 7 passing successfullytest, but in my npx hardhat node terminal i have this error.

@github-actions
Copy link
Contributor

This issue is also being tracked on Linear.

We use Linear to manage our development process, but we keep the conversations on Github.

LINEAR-ID: 01c6de0f-ced1-488d-b5c7-4b388ae8f5f9

@fvictorio
Copy link
Member

@Programmer001-JS can you provide a minimal reproducible example?

@velateem
Copy link

velateem commented Sep 1, 2022

I have a same issue, we were trying to use metamask connect to hardhat node, and we could do the first transaction between the test wallets. However, when we try to do the second transaction , it would say
"eth_estimateGas

If you think this is a bug in Hardhat, please report it here: https://hardhat.org/reportbug"

and we need to restart the hardhat node and reset account on metamask.

@m1s5
Copy link

m1s5 commented Sep 11, 2022

same issue:
• Bare node. No extra config
• Trying to connect with metamask
• send first transaction. (hh console sends only one gas estimate error)
• second transaction is not possible: buttons disabled. Console spits out errors on each keypress.

@vaxann
Copy link

vaxann commented Sep 11, 2022

Problem the same as @m1s5, see screen
Screenshot 2022-09-11 at 13 20 31

@julpar
Copy link

julpar commented Sep 12, 2022

Bump!

@lightrao
Copy link

lightrao commented Oct 3, 2022

same problem

@victorshevtsov
Copy link

Does anybody have a solution for that?
This issue has been reported already #1731 but not solved yet.

@victorshevtsov
Copy link

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.

@victorshevtsov
Copy link

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.

@Programmer001-JS
Copy link
Author

Now l have this msg:

eth_sendRawTransaction

Trying to send a raw transaction with an invalid chainId. The expected chainId is 31337

@nfts2me
Copy link

nfts2me commented Nov 16, 2022

Same error here using hardhat tests.
Using node I get this information

eth_accounts
eth_chainId
eth_estimateGas --> This in red

  If you think this is a bug in Hardhat, please report it here: https://hardhat.org/report-bug

.../contracts/node_modules/hardhat/internal/hardhat-network/stack-traces/solidity-errors.js:111
    return new SolidityCallSite(sourceReference.sourceName, sourceReference.contract, sourceReference.function !== undefined
                                                ^

TypeError: Cannot read properties of undefined (reading 'sourceName')
(Use `node --trace-uncaught ...` to show where the exception was thrown)

@0xNegi
Copy link

0xNegi commented Nov 22, 2022

Any workaround for this? iam facing the same issue

@RedHeadphone
Copy link

Any workaround for this? iam facing the same issue

@matilareo checkout this #3089 (comment)

@benzsuankularb
Copy link

benzsuankularb commented Dec 6, 2022

I've tried other chain id than 31337 and hit the same issue.

@fvictorio fvictorio removed their assignment Dec 27, 2022
@fvictorio
Copy link
Member

Closing in favor of #3474

For anyone landing here: a workaround is to set the initial base fee to 0:

module.exports = {
  solidity: "0.8.17",
  networks: {
    hardhat: {
      initialBaseFeePerGas: 0
    },
  },
};

@fvictorio fvictorio closed this as not planned Won't fix, can't repro, duplicate, stale Dec 28, 2022
@github-project-automation github-project-automation bot moved this to Done in Hardhat Dec 28, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests