Fix for world state root mismatch after parallel preprocessing with zero block reward #8353
+195
−57
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.
This PR fixes a bug in the implementation of the parallel block processor, leading to frequent world state root mismatches during block persistence, similar to #7844.
When the block reward is zero and the mining beneficiary account doesn't exist yet, if the parallel preprocessing finishes in time to be applied, the resulting world state differs from the one produced by the sequential transaction processing, because, during application of the transaction processing result, parallel transaction processor creates the mining beneficiary address, whereas plain sequential processing, at least with
clearEmptyAccounts
on, does not, leading to mismatch between world states computed during block creation and parallelized block processing.This PR also contains an integration test covering this scenario. The test fails without the fix and passes with it.
A complete fix would probably account for the value of
clearEmptyAccounts
in parallel transaction processor, but this flag seems to be in place for legacy purposes, so I am not sure it is worth further code change.It is quite possible that this is not the only discrepancy between parallel and sequential processing leading to world state root mismatches.
This PR has been contributed on behalf of Absa Group Ltd.