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?
- 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 ?