It seems that it is somehow possible to run out of gas but the transaction still completes? This violates my understanding of ethereum. If you run out of gas, it reverts all changes. What does this error from etherscan mean?

Although one or more errors occured [Out of gas] contract execution completed

  • The miner still gets compensated for the work. The transaction is valid although didn't make any state changes. – libertylocked Nov 15 '17 at 4:29
  • Also it's possible to recover from OOG for internal transactions. It may be helpful if you show the transaction. – libertylocked Nov 15 '17 at 4:39
  • Thanks for the helpful info. I'm still not sure what's going on with this tx. etherscan.io/tx/… – syzygy Nov 15 '17 at 21:21

As long as the transaction is valid (meaning no bad signatures, bad nonce, etc), even if it runs out of gas, the transaction is still completed. Whether or not the transaction has made any state changes is a different story.

What if we say OOG transactions are not valid, and can't be in a valid block, and miners don't get compensated for the work?

Imagine an attacker submitting a bunch of computationally expensive function call transactions, but he makes sure every one of those transactions error out in the end. Miners would run them, waste computing power, not getting anything in return. This is effectively a DOS attack the blockchain.

A few words about internal transactions.

Since contract can call other contracts or send funds, one transaction call may include multiple internal transactions. It is possible recover from OOG of an internal transaction within your transaction.

If you only forward a limited amount of gas to an internal transaction function call, your internal transaction can fail and OOG. But since you still have gas left in your main TX, it can eventually complete.

See does an entire transaction revert when throw occurs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.