-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[R4R]fix state inconsistent when doing diffsync #628
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unclezoro
force-pushed
the
fix_state_inconsistent
branch
from
December 4, 2021 17:23
5d21134
to
a861895
Compare
unclezoro
changed the title
[WIP]fix state inconsistent between snapshot and MPT when doing diffsync
[WIP]fix state inconsistent when doing diffsync
Dec 5, 2021
keefel
approved these changes
Dec 5, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
unclezoro
changed the title
[WIP]fix state inconsistent when doing diffsync
[R4R]fix state inconsistent when doing diffsync
Dec 5, 2021
yutianwu
approved these changes
Dec 5, 2021
yutianwu
approved these changes
Dec 5, 2021
Closed
This was referenced Dec 6, 2021
Closed
Hi @guagualvcha Can you provide more info about this? |
This was referenced Dec 8, 2021
This was referenced Aug 1, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
This PR is to fix a possible inconsistent state when doing diffsync. Since it is a syncing vulnerability which impact many clients, will release v1.1.7 especially for this patch.
Rationale
Diffsync will assemble the modification to MPT and snapshot according to the received difflayer and verify against the block header. In some cases(will disclose in future), the modification to MPT and snapshot is incorrect.
The problematic logic is apply too stick condition to modify the smart contract trie: https://github.com/binance-chain/bsc/blob/0b575443c43f47f2f50ed5549d2bcaf7ccc39ab4/core/state_processor.go#L256
Example
The current release, if you come across with bad block error with log message like:
expected tx hash xx, get xx, nonce xx, to xx, value xx, gas xx, gasPrice xx, data xx
. Here are some steps you can try to recover your node:--snapshot=false
--snapshot=true
Changes
All the client that use
diffsync
is suggested to upgradeChecks
It is been verified on Unittest and Testnet.
Related issues
No