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: Fix processing withdrawals of 0 #670

Merged
merged 1 commit into from
Jul 8, 2023
Merged

state: Fix processing withdrawals of 0 #670

merged 1 commit into from
Jul 8, 2023

Conversation

chfast
Copy link
Member

@chfast chfast commented Jul 7, 2023

The withdrawals should be processed before state clearing so the empty accounts touched with 0 value withdrawals are also cleared from the state.

Fixes issue reported by ethereum/execution-spec-tests#142.

@chfast chfast requested review from axic, gumb0 and rodiazet July 7, 2023 06:37
@@ -123,6 +123,9 @@ void finalize(State& state, evmc_revision rev, const address& coinbase,
if (block_reward.has_value())
state.touch(coinbase).balance += *block_reward;

for (const auto& withdrawal : withdrawals)
state.touch(withdrawal.recipient).balance += withdrawal.get_amount();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember why we implemented this in different order originally. The use of .touch() indicates we want the account to be cleared.

@codecov
Copy link

codecov bot commented Jul 7, 2023

Codecov Report

Merging #670 (436f5f1) into master (9399750) will not change coverage.
The diff coverage is 100.00%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #670   +/-   ##
=======================================
  Coverage   97.40%   97.40%           
=======================================
  Files          81       81           
  Lines        8008     8008           
=======================================
  Hits         7800     7800           
  Misses        208      208           
Flag Coverage Δ
blockchaintests 62.95% <ø> (ø)
statetests 74.05% <50.00%> (ø)
unittests 94.98% <100.00%> (ø)

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

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

@danceratopz
Copy link
Member

I could confirm locally that this (evmone-t8n 0.11.0-dev+commit.436f5f18) fixes the withdrawals errors when running against fill as:

fill --evm-bin=~/code/github/ethereum/evmone/build/bin/evmone-t8n 

from ethereum/execution-spec-tests@ace89a1.

The withdrawals should be processed before state clearing
so the empty accounts touched with 0 value withdrawals
are also cleared from the state.
@chfast chfast merged commit 606ba82 into master Jul 8, 2023
1 check passed
@chfast chfast deleted the withdrowal_0 branch July 8, 2023 21:06
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.

3 participants