[R4R] fix: remove diffhash patch introduced from separate node #1020
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.
Description
BSC has merged ethereum/go-ethereum#23628 to avoid hitting outdated snapshots, so we can remove #926 code that was introduced at the time to fix diffHash mismatch.
Rationale
In previous versions, the snapshot tree executed
parent.flatten()
without first locking the current difflayer whencap
, but first executed theparent.flatten()
to change it to bestale
state and relinks the currentdifflayer.parent
(removes the stale's difflayer from the recursive structure).And this has caused a problem. There is a small chance that the stale difflayer will be obtained first when the difflayer is accessed externally, and then the difflayer.parent will be locked and re-linked, resulting in the snapshot being judged when acquiring the Account or Storage data. Returns null for
Stale
.Therefore, in the implementation of #926, a new retry mechanism is added to retry when a null value is obtained, but this approach is not particularly good and may cause over-stack problems.
After the Ethereum version(ethereum/go-ethereum#23628) was merged, it was changed to lock the current difflayer first and then change the parent to avoid the above problems, so we can remove the patch fix introduced at that time.
Example
N/A
Changes
Notable changes: