0
votes

I'm developing the front-end to an application that I'm trying to test. However, MetaMask keeps giving me this error? I tried changing the gas limit like previously suggested and nothing. Any ideas?

Error: MetaMask - RPC Error: Internal JSON-RPC error.

code: -32603 data: {code: -32000, message: "gas required exceeds allowance (30000000) or always failing transaction"} message: "Internal JSON-RPC error."

2
It seems that the transaction reverts (exceeding gas limit by this much is unlikely). Please edit your question and post the Solidity code of the function (and its dependencies such as class variables and other functions) that this transaction calls.Petr Hejda
@PetrHejda thank you for replying. So honestly, I've forked pancakeswap and have been working with that. This is all front-end I've been working on so maybe it has to do with something I changed regarding their code, but I'm not exactly sure what it could be.Mari
@PetrHejda any ideas on the type of functions I should be looking at specifically?Mari
I'm assuming the error is going to be in some of the Solidity code that you changed (Pancakeswap is an established project and the probability of their maintainers pushing a faulty code to the repo is low). So in your debugging, you should focus on the code that you changed.Petr Hejda

2 Answers

0
votes

Without seeing the code, it's hard to say for sure but you could try:

  1. Check any code you changed in the front end, specifically in your code you may have something like this:
const contractInstance = new state.web3.eth.Contract(
    MyContract.abi,
    "0x.....",            // contract address
    {
        from: state.accounts[0],
        gasPrice: 1000,
        gas: 100000
    }
);

Make sure the gas prices are similar to those, you may have to adjust for your case.

  1. Re-compile and redeploy --> for truffle, run truffle develop first, then compile then migrate --reset for local deployment.

  2. In Metamask, reset your test account. Metamask > Select Account > Settings > Advanced > Reset account. Only do this for testing accounts

0
votes

Previously it used to happen in older versions due to a gas specification issue which was fixed. rpcErrors.internal` expects a string as the first argument, with arbitrary data being the optional second argument. Passing in a non- string first argument results in the error being shadowed by an error from eth-json-rpc-errors.

Please check what you are passing to Metamask.