state: Only mark touch of empty accounts #785
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If an account is being touched but is not empty it doesn't make sense to mark it as touched. Touching only affects deleting empty accounts but an account cannot become empty later during transaction execution (except for selfdestruct, but this is tracked separately).
When executing all state tests from https://github.com/ethereum/tests, this optimization reduces number of registered touch events by 99.2% (from 1673250 to 13806) and number of reverted touch events by 99.7% (from 1345463 to 401).
Moreover, considering current Mainnet status and
EIP-7523: Empty accounts deprecation empty accounts cannot be encountered after the Paris revision. Therefore, this change total disables unnecessary touch handling in current PoS networks.