ethereum/yellowpaper

Incorrect production of "final state"

chfast opened this issue · 0 comments

The (77) defines transaction's final state σ′ where both selfdestructed and empty-but-touched accounts are deleted. This is not how this is implemented in practice.

What YP suggests is the following workflow:

for tx in transactions:
    execute(state, tx)
    delete_selfdestructed(state)
    delete_empty_but_touched(state)

apply_coinbase_reward()
apply_withdrawals()

Practical implementations are done as the following:

for tx in transactions:
    execute(state, tx)
    delete_selfdestructed(state)

apply_coinbase_reward()
apply_withdrawals()
delete_empty_but_touched(state)

The difference is subtle: in case we apply 0 block reward or 0 withdrawal to an empty account this account will be deleted.