Excerpt from chapter 9 of the yellow paper, "Execution Model", describing the behaviour of the EMV when clearing storage:

This refund is effectively paid up-front since the initial usage of a storage location costs substantially more than normal usage.

This seems to counteract this StackExchange answer:

The gas refund is provided only 1 time, at the very end of the transaction's execution.

I also know that the refunded gas is capped at half of the execution costs, so this is confusing. Does the first statement mean that the refund is actually calculated up-front (formally, in the σ checkpoint state transition) but only transferred to the caller after the execution is finished?

  • IMHO the wording is confusing. I read it as you already have paid the first time you set to non zero the slot, the refund is from that payment. – Ismael Jan 7 '19 at 19:44

Your Answer

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

Browse other questions tagged or ask your own question.