Search code examples
ethereumsoliditysmartcontractsnft

Error encountered during Ethereum solidity NFT contract execution [Out of gas]?


We have a Rinkeby test contract for minting NFTs. Occasionally, when it's in public-sale mode, if a person attempts to mint an NFT, the transaction fails and on the tx's etherscan it says:

Warning! Error encountered during contract execution [out of gas]

It says this even though there is definitely enough ETH in their wallet and they've set their gas max fee to 'high' on metamask. The confusing thing is that it only happens about 75% of the time. Sometimes it mints with no problems...

  • See the test contract here.
  • See the failed transaction here.

Is there anything you can see in our contract that would be causing issues with gas like this?


Solution

  • To me, it just looks like they need to set an even higher gas limit. 73,537 doesn't look particularly like there's a bug in the contract and looks like the user didn't set it high enough: enter image description here

    Note that the gas limit is different than the gas priority fee (which your user is referring to). The gas limit is the amount of ether that the user is devoting to execution, while the gas fee is the amount of ether that the user is devoting to encourage miners to mine the transaction. Instruct your user to manually increase the gas limit (NOT the fee).