openethereum/ethcore
Andrew Jones 4b6ebcbb61 Fix ancient blocks sync (#9531)
* Log block set in block_sync for easier debugging

* logging macros

* Match no args in sync logging macros

* Add QueueFull error

* Only allow importing headers if the first matches requested

* WIP

* Test for chain head gaps and log

* Calc distance even with 2 heads

* Revert previous commits, preparing simple fix

This reverts commit 5f38aa885b22ebb0e3a1d60120cea69f9f322628.

* Reject headers with no gaps when ChainHead

* Reset block sync download when queue full

* Simplify check for subchain heads

* Add comment to explain subchain heads filter

* Fix is_subchain_heads check and comment

* Prevent premature round completion after restart

This is a problem on mainnet where multiple stale peer requests will
force many rounds to complete quickly, forcing the retraction.

* Reset stale old blocks request after queue full

* Revert "Reject headers with no gaps when ChainHead"

This reverts commit 0eb865539e5dee37ab34f168f5fb643300de5ace.

* Add BlockSet to BlockDownloader logging

Currently it is difficult to debug this because there are two instances,
one for OldBlocks and one for NewBlocks. This adds the BlockSet to all
log messages for easy log filtering.

* Reset OldBlocks download from last enqueued

Previously when the ancient block queue was full it would restart the
download from the last imported block, so the ones still in the queue would be
redownloaded. Keeping the existing downloader instance and just
resetting it will start again from the last enqueued block.:wq

* Ignore expired Body and Receipt requests

* Log when ancient block download being restarted

* Only request old blocks from peers with >= difficulty

https://github.com/paritytech/parity-ethereum/pull/9226 might be too
permissive and causing the behaviour of the retraction soon after the
fork block. With this change the peer difficulty has to be greater than
or euqal to our syncing difficulty, so should still fix
https://github.com/paritytech/parity-ethereum/issues/9225

* Some logging and clear stalled blocks head

* Revert "Some logging and clear stalled blocks head"

This reverts commit 757641d9b817ae8b63fec684759b0815af9c4d0e.

* Reset stalled header if useless more than once

* Store useless headers in HashSet

* Add sync target to logging macro

* Don't disable useless peer and fix log macro

* Clear useless headers on reset and comments

* Use custom error for collecting blocks

Previously we resued BlockImportError, however only the Invalid case and
this made little sense with the QueueFull error.

* Remove blank line

* Test for reset sync after consecutive useless headers

* Don't reset after consecutive headers when chain head

* Delete commented out imports

* Return DownloadAction from collect_blocks instead of error

* Don't reset after round complete, was causing test hangs

* Add comment explaining reset after useless

* Replace HashSet with counter for useless headers

* Refactor sync reset on bad block/queue full

* Add missing target for log message

* Fix compiler errors and test after merge

* ethcore: revert ethereum tests submodule update
2018-10-09 15:31:40 +02:00
..
benches ethcore: minor optimization of modexp by using LR exponentiation (#9697) 2018-10-04 12:29:53 +01:00
evm Implement CREATE2 gas changes and fix some potential overflowing (#9694) 2018-10-04 20:50:18 +08:00
light removed redundant clone before each block import (#9683) 2018-10-04 01:44:58 +08:00
node_filter new ethabi (#9511) 2018-09-13 11:04:39 +02:00
private-tx new ethabi (#9511) 2018-09-13 11:04:39 +02:00
res ethcore: delay ropsten hardfork (#9704) 2018-10-05 15:09:42 +08:00
service Fetch parity-common crates from crates.io (#9410) 2018-09-04 20:13:51 +02:00
src fix (light/provider) : Make read_only executions read-only (#9591) 2018-10-08 21:30:46 +02:00
stratum Fetch parity-common crates from crates.io (#9410) 2018-09-04 20:13:51 +02:00
sync Fix ancient blocks sync (#9531) 2018-10-09 15:31:40 +02:00
transaction Update state tests execution model (#9440) 2018-09-10 22:38:30 +02:00
types Fetch parity-common crates from crates.io (#9410) 2018-09-04 20:13:51 +02:00
vm Resumable EVM and heap-allocated callstack (#9360) 2018-10-02 22:33:19 +08:00
wasm Resumable EVM and heap-allocated callstack (#9360) 2018-10-02 22:33:19 +08:00
Cargo.toml Add constantinople conf to EvmTestClient. (#9570) 2018-09-25 12:24:40 +02:00