-
Notifications
You must be signed in to change notification settings - Fork 20.2k
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
eth/downloader: interrupted state download causes sync to restart from block 0 #2469
Comments
This is a security feature, not a bug. From #1889 : Blockchain protocols in general (i.e. Bitcoin, Ethereum, and the others) are susceptible to Sybil attacks, where an attacker tries to completely isolate a node from the rest of the network, making it believe a false truth as to what the state of the real network is. This permits the attacker to spend certain funds in both the real network and this "fake bubble". However, the attacker can only maintain this state as long as it's feeding new valid blocks it itself is forging; and to successfully shadow the real network, it needs to do this with a chain height and difficulty close to the real network. In short, to pull off a successful Sybil attack, the attacker needs to match the network's hash rate, so it's a very expensive attack. Compared to the classical Sybil attack, fast sync provides such an attacker with an extra ability, that of feeding a node a view of the network that's not only different from the real network, but also that might go around the EVM mechanics. The Ethereum protocol only validates state root hashes by processing all the transactions against the previous state root. But by skipping the transaction processing, we cannot prove that the state root contained within the fast sync pivot point is valid or not, so as long as an attacker can maintain a fake blockchain that's on par with the real network, it could create an invalid view of the network's state. To avoid opening up nodes to this extra attacker ability, fast sync (beside being solely opt-in) will only ever run during an initial sync (i.e. when the node's own blockchain is empty). After a node managed to successfully sync with the network, fast sync is forever disabled. This way anybody can quickly catch up with the network, but after the node caught up, the extra attack vector is plugged in. This feature permits users to safely use the fast sync flag (--fast), without having to worry about potential state root attacks happening to them in the future. As an additional safety feature, if a fast sync fails close to or after the random pivot point, fast sync is disabled as a safety precaution and the node reverts to full, block-processing based synchronization. |
We could add a few retries so that if state download fails due to no more peers, we give it a few (1-2-3) more trials before marking the entire thing as failed and assuming an attack. We could do this for 1.5 though, as it could be quite an involved change. |
Per the new 1.4.6 release, states are downloaded concurrently with everything else during fast sync so there's a huge window to get all the states before the critical section. Further the critical section has a retry allowance counter of 10 attempts. Hopefully these will solve all our issues in the foreseeable future. We might consider trie sync progress tracking to be even more resilient with the critical section, but that requires updates to the trie/state db code too. We can consider it for 1.5 or above. |
Geth version: 1.3.6
OS & Version: OS X 10.11
I tried out the Wallet App with a friend and the progress bar reached the
latest block. Then the sync suddenly restarted from block 0.
Log
The text was updated successfully, but these errors were encountered: