[R4R]fix state inconsistent when doing diffsync#628
Merged
unclezoro merged 3 commits intobnb-chain:masterfrom Dec 5, 2021
Merged
[R4R]fix state inconsistent when doing diffsync#628unclezoro merged 3 commits intobnb-chain:masterfrom
unclezoro merged 3 commits intobnb-chain:masterfrom
Conversation
5d21134 to
a861895
Compare
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
This file contains hidden or 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
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=trueChanges
All the client that use
diffsyncis suggested to upgradeChecks
It is been verified on Unittest and Testnet.
Related issues
No