0

My understanding is that the total gas refund can never exceed 20% of the transaction total gas cost, which I guess means that the EVM will first add-up all the transaction gas cost then deduct the total gas refund (to a max of 20%).

My question is, would that mean that if an account does not have the funds to pay for the transaction gas cost before refund, the transaction will fail even if it does have the funds to pay for the actual transaction gas cost which is the one after refund?

example:

  • Account has enough funds to pay for 9'000 Gas (at the current Gas Price which does not matter)
  • Transaction gas cost before refund 10'000 Gas
  • Transaction gas cost after refund 8'000 Gas

Transaction fails because 10'000 > 9'000 despite 9'000 > 8'000 ?

1 Answer 1

0

Yes, that's correct. The total gas cost of a transaction includes both the actual gas used by the EVM to execute the transaction and the gas cost of any refundable operations. If the total gas cost exceeds the balance of the account, the transaction will fail, even if the actual gas used by the EVM is less than the account balance.

In your example, if the account has a balance of only 9,000 gas and the transaction gas cost before refund is 10,000 gas, the transaction will fail, even though the gas cost after refund is only 8,000 gas. This is because the EVM calculates the total gas cost including the gas refund, and in this case, the total gas cost exceeds the balance of the account.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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