Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

state: Only mark touch of empty accounts #785

Merged
merged 1 commit into from
Jan 9, 2024

Conversation

chfast
Copy link
Member

@chfast chfast commented Jan 9, 2024

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.

@chfast chfast force-pushed the state/journal_touch_optimization branch from c24e1ed to 3a63f52 Compare January 9, 2024 08:00
@chfast chfast requested a review from yperbasis January 9, 2024 08:00
@chfast chfast self-assigned this Jan 9, 2024
@chfast chfast requested review from gumb0 and pdobacz January 9, 2024 08:06
Copy link

codecov bot commented Jan 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (9c91286) 97.91% compared to head (b66de4d) 97.91%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #785   +/-   ##
=======================================
  Coverage   97.91%   97.91%           
=======================================
  Files         110      110           
  Lines       10580    10580           
=======================================
  Hits        10359    10359           
  Misses        221      221           
Flag Coverage Δ
blockchaintests 60.23% <ø> (ø)
statetests 62.16% <100.00%> (ø)
statetests-silkpre 26.00% <100.00%> (ø)
unittests 95.88% <100.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
test/state/state.cpp 100.00% <100.00%> (ø)

test/state/state.cpp Outdated Show resolved Hide resolved
@chfast chfast force-pushed the state/impl_move_to_cpp branch 2 times, most recently from 26c81ee to e44aebb Compare January 9, 2024 14:06
Base automatically changed from state/impl_move_to_cpp to master January 9, 2024 15:09
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](https://eips.ethereum.org/EIPS/eip-7523)
empty accounts cannot be encountered after the Paris revision.
Therefore, this change total disables unnecessary touch handling
in current PoS networks.
@chfast chfast force-pushed the state/journal_touch_optimization branch from 3a63f52 to b66de4d Compare January 9, 2024 15:10
@chfast chfast merged commit 3d0242b into master Jan 9, 2024
25 checks passed
@chfast chfast deleted the state/journal_touch_optimization branch January 9, 2024 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants