Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Update light client hardcoded headers #9098

Merged
merged 4 commits into from
Jul 13, 2018

Conversation

Tbaut
Copy link
Contributor

@Tbaut Tbaut commented Jul 11, 2018

  • Mainnet hardcoded headers until #5941249
  • Ropsten hardcoded headers until #3612673
  • Kovan hardcoded headers until #7690241

@Tbaut Tbaut added A0-pleasereview 🤓 Pull request needs code review. B0-patchthis M4-core ⛓ Core client code / Rust. labels Jul 11, 2018
@Tbaut Tbaut added this to the 2.0 milestone Jul 11, 2018
@Tbaut Tbaut requested a review from 5chdn July 11, 2018 15:42
@parity-cla-bot
Copy link

It looks like this contributor signed our Contributor License Agreement. 👍

Many thanks,

Parity Technologies CLA Bot

@Tbaut Tbaut added the A2-insubstantial 👶 Pull request requires no code review (e.g., a sub-repository hash update). label Jul 11, 2018
@5chdn 5chdn added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Jul 11, 2018
@5chdn
Copy link
Contributor

5chdn commented Jul 11, 2018

would be nice to have light headers for classic too, /cc @pyskell

@5chdn 5chdn modified the milestones: 2.0, 2.1 Jul 11, 2018
@pyskell
Copy link
Contributor

pyskell commented Jul 11, 2018

Excuse my ignorance, what are light headers?

@dvdplm
Copy link
Collaborator

dvdplm commented Jul 12, 2018

This is hard to review without a better description with some context.

@5chdn
Copy link
Contributor

5chdn commented Jul 12, 2018

@dvdplm @pyskell the chainspec can contain hardcoded light headers. this allows the light client to sync from a "trusted" block rather than syncing from genesis. ref #8075

https://wiki.parity.io/FAQ#how-to-generate-a-new-hardcoded-sync-block-for-parity-light-client

This was referenced Jul 12, 2018
@pyskell
Copy link
Contributor

pyskell commented Jul 12, 2018

Got it, will get a PR ready soon.

@pyskell
Copy link
Contributor

pyskell commented Jul 12, 2018

Almost done with this but light syncing seems to freeze:

  • Occasionally hit a block where it stops syncing despite increased peer count
  • After fully syncing it stops entirely
  • Happens both with the default --chain=classic and my newly generated --chain ./classic-lightsync.json that I'm using to test. (https://paste.ee/p/gFxWu)
  • Still on the right chain (ex. http://etherhub.io/block/6167953)
  • Ctrl^C and restarting gets new blocks but then also stops at the new block.
  • Happens with both v1.11.6-beta-4ba600fcc-20180709 and 1.10.6. Both were installed from the Debian AMD64 release debs you provide.
  • Ample SSD space, RAM, and CPU.

In both cases the output looks like this:

parity@parity-lightclient-syncing:~$ parity --light --chain classic-lightsync.json
2018-07-12 17:30:48 UTC Starting Parity/v1.11.6-beta-4ba600fcc-20180709/x86_64-linux-gnu/rustc1.27.0
2018-07-12 17:30:48 UTC Keys path /home/parity/.local/share/io.parity.ethereum/keys/Ethereum Classic
2018-07-12 17:30:48 UTC DB path /home/parity/.local/share/io.parity.ethereum/chains/classic/db/906a34e69aec8c0d
2018-07-12 17:30:48 UTC Path to dapps /home/parity/.local/share/io.parity.ethereum/dapps
2018-07-12 17:30:48 UTC Running in experimental Light Client mode.
2018-07-12 17:30:50 UTC Imported #6167920 0x74f2…243f (0.20 Mgas)
2018-07-12 17:30:54 UTC Syncing #6167953 0x065a…5e77     6 hdr/s      0+    0 Qed  #6167953    3/50 peers   23 KiB cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 17:30:54 UTC Public node URL: enode://83b33409349ffa25e150555f7b4f8deebc68f3d34d782129dc3c8ba07b880c209310a4191e1725f2f6bef59bce9452d821111eaa786deab08a7e6551fca41f4f@178.128.9.152:30303
2018-07-12 17:30:59 UTC Syncing #6167953 0x065a…5e77     0 hdr/s      0+    0 Qed  #6167953    4/50 peers   23 KiB cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 17:31:09 UTC Syncing #6167953 0x065a…5e77     0 hdr/s      0+    0 Qed  #6167953    4/50 peers   23 KiB cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 17:31:29 UTC Syncing #6167953 0x065a…5e77     0 hdr/s      0+    0 Qed  #6167953    5/50 peers   23 KiB cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 17:31:44 UTC Syncing #6167953 0x065a…5e77     0 hdr/s      0+    0 Qed  #6167953    5/50 peers   23 KiB cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 17:31:54 UTC Syncing #6167953 0x065a…5e77     0 hdr/s      0+    0 Qed  #6167953    5/50 peers   23 KiB cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 17:32:04 UTC Syncing #6167953 0x065a…5e77     0 hdr/s      0+    0 Qed  #6167953    6/50 peers   23 KiB cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 17:32:14 UTC Syncing #6167953 0x065a…5e77     0 hdr/s      0+    0 Qed  #6167953    6/50 peers   23 KiB cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 17:32:24 UTC Syncing #6167953 0x065a…5e77     0 hdr/s      0+    0 Qed  #6167953    5/50 peers   23 KiB cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 17:32:44 UTC Syncing #6167953 0x065a…5e77     0 hdr/s      0+    0 Qed  #6167953    5/50 peers   23 KiB cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 17:32:49 UTC Syncing #6167953 0x065a…5e77     0 hdr/s      0+    0 Qed  #6167953    6/50 peers   23 KiB cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs

Debug log: https://paste.ee/p/LoVM9

Going to try restarting from block 0 with the new classic-lightsync.json and see if that fixes it.

Off to an okay start, seems we only light client ~half way through the chain:

parity@parity-lightclient-syncing:~$ parity --light --chain classic-lightsync.json
2018-07-12 17:47:20 UTC Starting Parity/v1.11.6-beta-4ba600fcc-20180709/x86_64-linux-gnu/rustc1.27.0
2018-07-12 17:47:20 UTC Keys path /home/parity/.local/share/io.parity.ethereum/keys/Ethereum Classic
2018-07-12 17:47:20 UTC DB path /home/parity/.local/share/io.parity.ethereum/chains/classic/db/906a34e69aec8c0d
2018-07-12 17:47:20 UTC Path to dapps /home/parity/.local/share/io.parity.ethereum/dapps
2018-07-12 17:47:20 UTC Running in experimental Light Client mode.
2018-07-12 17:47:20 UTC Inserting hardcoded block #2392065 in chain
2018-07-12 17:47:26 UTC Public node URL: enode://83b33409349ffa25e150555f7b4f8deebc68f3d34d782129dc3c8ba07b880c209310a4191e1725f2f6bef59bce9452d821111eaa786deab08a7e6551fca41f4f@178.128.9.152:30303
2018-07-12 17:47:50 UTC    0/50 peers   664 bytes cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 17:48:15 UTC Syncing #2392065 0x119e…5342     0 hdr/s      0+    0 Qed  #2392065    1/50 peers   664 bytes cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 17:48:46 UTC Syncing #2392065 0x119e…5342     0 hdr/s      0+    0 Qed  #2392065    1/50 peers   664 bytes cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 17:49:01 UTC Syncing #2392065 0x119e…5342     0 hdr/s      0+    0 Qed  #2392065    1/50 peers   664 bytes cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 17:49:11 UTC Syncing #2392321 0x227b…edeb    25 hdr/s      0+    0 Qed  #2392321    1/50 peers   167 KiB cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 17:49:41 UTC Syncing #2392577 0x5e68…2fb2     0 hdr/s      0+    0 Qed  #2392577    1/50 peers   333 KiB cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 17:49:46 UTC Syncing #2394113 0x097b…0390   307 hdr/s      0+    0 Qed  #2394113    1/50 peers   1 MiB cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 17:49:51 UTC Syncing #2394369 0x8b6c…1347    51 hdr/s      0+    0 Qed  #2394369    1/50 peers   1 MiB cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 17:50:16 UTC Syncing #2394369 0x8b6c…1347     0 hdr/s      0+    0 Qed  #2394369    1/50 peers   1 MiB cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 17:50:21 UTC Syncing #2396417 0x604f…78db   409 hdr/s      0+    0 Qed  #2396417    1/50 peers   3 MiB cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 17:50:31 UTC Syncing #2398977 0x44ca…ca24   204 hdr/s      0+    0 Qed  #2398977    1/50 peers   4 MiB cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 17:50:36 UTC Syncing #2402561 0x0016…5983   716 hdr/s      0+    0 Qed  #2402561    1/50 peers   7 MiB cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 17:50:41 UTC Syncing #2403585 0x9e5d…d0ae   204 hdr/s      0+    0 Qed  #2403585    1/50 peers   7 MiB cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 17:50:51 UTC Syncing #2403585 0x9e5d…d0ae     0 hdr/s      0+    0 Qed  #2403585    1/50 peers   7 MiB cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs

P.S. Let me know if you want this all moved to a separate issue or if it's still appropriate here.

Reached some interesting output. Note the one-character difference in expected vs. actual difficulty.
This seems to be due to somehow ending up on the ETH chain, the hash for block 3,099,999 matches ETH's block, not ETC's: https://etherscan.io/block/3099999

2018-07-12 18:13:15 UTC Syncing #3059999 0x45ba…69fb  1899 hdr/s   3794+    0 Qed  #3059999    2/50 peers   10 MiB cache 3 MiB queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 18:13:20 UTC Syncing #3067717 0xd0b5…d4f3  1543 hdr/s   5036+    0 Qed  #3067717    3/50 peers   10 MiB cache 4 MiB queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 18:13:25 UTC Syncing #3077403 0x0544…9e4d  1937 hdr/s   5334+    0 Qed  #3077403    2/50 peers   10 MiB cache 4 MiB queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 18:13:30 UTC Syncing #3087032 0xfaf1…7aa7  1925 hdr/s   4409+    0 Qed  #3087032    2/50 peers   10 MiB cache 3 MiB queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 18:13:35 UTC Syncing #3094443 0x96aa…62a4  1482 hdr/s   9783+    0 Qed  #3094443    2/50 peers   10 MiB cache 8 MiB queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 18:13:38 UTC Stage 3 block verification failed for #3100000 (0xce33…986f)
Error: Error(Block(InvalidDifficulty(Mismatch { expected: 0x66d6be0d56b4, found: 0x66d6ce0d56b4 })), State { next_error: None, backtrace: None })
2018-07-12 18:13:40 UTC Syncing #3099999 0x6ae9…6519  1111 hdr/s   3704+    0 Qed  #3099999    2/50 peers   10 MiB cache 3 MiB queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 18:13:45 UTC Syncing #3099999 0x6ae9…6519     0 hdr/s      0+    0 Qed  #3099999    2/50 peers   10 MiB cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 18:13:50 UTC Syncing #3099999 0x6ae9…6519     0 hdr/s  13683+    0 Qed  #3099999    2/50 peers   10 MiB cache 11 MiB queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 18:13:55 UTC Syncing #3099999 0x6ae9…6519     0 hdr/s  14294+    0 Qed  #3099999    2/50 peers   10 MiB cache 11 MiB queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 18:14:00 UTC Syncing #3099999 0x6ae9…6519     0 hdr/s  15434+    0 Qed  #3099999    2/50 peers   10 MiB cache 12 MiB queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 18:14:05 UTC Syncing #3099999 0x6ae9…6519     0 hdr/s  19780+    0 Qed  #3099999    2/50 peers   10 MiB cache 15 MiB queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 18:14:10 UTC Syncing #3099999 0x6ae9…6519     0 hdr/s  17126+    0 Qed  #3099999    3/50 peers   10 MiB cache 13 MiB queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 18:14:15 UTC Syncing #3099999 0x6ae9…6519     0 hdr/s   7554+    0 Qed  #3099999    3/50 peers   10 MiB cache 6 MiB queue  RPC:  0 conn,  0 req/s,   0 µs
2018-07-12 18:14:20 UTC Syncing #3099999 0x6ae9…6519     0 hdr/s      0+    0 Qed  #3099999    3/50 peers   10 MiB cache 0 bytes queue  RPC:  0 conn,  0 req/s,   0 µs

Debug log: sync-issues-block3.1million.log

@5chdn
Copy link
Contributor

5chdn commented Jul 13, 2018

@pyskell yeah this is a known issue, unfortunately, #6319. And, uh, also #6402 :(

What you can do is remove your nodes json and start again. Or just shut it down one day and continue at a later point. ETC probably does not have enough Parity nodes?

@5chdn 5chdn requested a review from grbIzl July 13, 2018 10:21
@sorpaas
Copy link
Collaborator

sorpaas commented Jul 13, 2018

@pyskell For the one with problem, do you use the chain spec with hardcoded sync or without? I think if initially there're issues for light client to be on the right chain, what you can do is:

  1. Sync a full node.
  2. Start a light node, with --reserved-only, and --reserved-peers pointing to the full node. Restart the full node with --reserved-peers pointing to the light node.
  3. Sync the light node and do export_hardcoded_sync.

@lexfrl
Copy link
Contributor

lexfrl commented Jul 13, 2018

Just for information why this is part of chainspec?
I was thinking that chainspec config is to describe consensus aware specification. Are these headers such?

@5chdn
Copy link
Contributor

5chdn commented Jul 13, 2018

Just for information why this is part of chainspec?
I was thinking that chainspec config is to describe consensus aware specification. Are these headers such?

I'm happy if you have a better idea. I had a similar question here when this was introduced. #8075 (comment)

@5chdn 5chdn merged commit 584a76a into master Jul 13, 2018
@5chdn 5chdn deleted the Tbaut-patch-update-hardcoded-headers branch July 13, 2018 12:42
@pyskell
Copy link
Contributor

pyskell commented Jul 13, 2018

@sorpaas Thanks I will try that. I actually encounter this issue both with and without the hardcodedSync

The difference is:
hardcodedSync - Stops almost immediately after grabbing a few new blocks once we hit 3.1 million
without hardcodedSync - Stops periodically. I believe around blocks 2 and 5 million for me. Requires a restart and then continues.

@5chdn That is possible. I need to go through and test all of the nodes to see which are working and if any need replacing.

EDIT: Started syncing using @sorpaas' suggestion, will report back

5chdn pushed a commit that referenced this pull request Jul 13, 2018
* Insert Kovan hardcoded headers until #7690241

* Insert Kovan hardcoded headers until block 7690241

* Insert Ropsten hardcoded headers until #3612673

* Insert Mainnet hardcoded headers until block 5941249
5chdn pushed a commit that referenced this pull request Jul 13, 2018
* Insert Kovan hardcoded headers until #7690241

* Insert Kovan hardcoded headers until block 7690241

* Insert Ropsten hardcoded headers until #3612673

* Insert Mainnet hardcoded headers until block 5941249
@pyskell
Copy link
Contributor

pyskell commented Jul 13, 2018

Looks like it's working although I only get 2 peers. Is this because parity needs more bootnodes running recent versions of parity? Or is this just how light clients work?

Will make a PR.

Edit: Done #9121

@sorpaas
Copy link
Collaborator

sorpaas commented Jul 13, 2018

@pyskell Light client has metering (https://github.com/paritytech/parity/blob/master/ethcore/light/src/net/request_credits.rs#L17), which may be one cause why you don't have many peers.

In the mean time, we definitely need more nodes (with recent versions)!

@lexfrl
Copy link
Contributor

lexfrl commented Jul 14, 2018

I'm happy if you have a better idea. I had a similar question here when this was introduced.

Thanks, I just wanted to be ensure that's not consensus-related info at that point..

Ideally it shouldn't be in this file, but could came with a better solution later I think. Does it worth to open an issue to find a better solution for this (just so as not to forget)?

@5chdn
Copy link
Contributor

5chdn commented Jul 15, 2018

@fckt yes

5chdn added a commit that referenced this pull request Jul 17, 2018
* parity-version: stabelize 1.11

* parity-version: bump stable to 1.11.7

* Don't fetch snapshot chunks at random (#9088)

* Offload cull to IoWorker.

* Limit the number of transactions in pending set (#8777)

* Unordered iterator.

* Use unordered and limited set if full not required.

* Split timeout work into smaller timers.

* Avoid collecting all pending transactions when mining

* Remove println.

* Use priority ordering in eth-filter.

* Fix ethcore-miner tests and tx propagation.

* Review grumbles addressed.

* Add test for unordered not populating the cache.

* Fix ethcore tests.

* Fix light tests.

* Fix ethcore-sync tests.

* Fix RPC tests.

* Make sure to produce full blocks.

* Update hidapi, fixes #7542 (#9108)

* docker: add cmake dependency (#9111)

* Fix miner tests.

* Revert "Make sure to produce full blocks."

This reverts commit b12d592.

* Update light client hardcoded headers (#9098)

* Insert Kovan hardcoded headers until #7690241

* Insert Kovan hardcoded headers until block 7690241

* Insert Ropsten hardcoded headers until #3612673

* Insert Mainnet hardcoded headers until block 5941249

* Make sure to produce full blocks. (#9115)

* Insert ETC (classic) hardcoded headers until block #6170625 (#9121)

* fix verification in ethcore-sync collect_blocks (#9135)

* `evm bench` fix broken dependencies (#9134)

* `evm bench` use valid dependencies

Benchmarks of the `evm` used stale versions of a couple a crates that
this commit fixes!

* fix warnings
5chdn added a commit that referenced this pull request Jul 17, 2018
* parity-version: betalize 2.0

* Multiple improvements to discovery ping handling (#8771)

* discovery: Only add nodes to routing table after receiving pong.

Previously the discovery algorithm would add nodes to the routing table
before confirming that the endpoint is participating in the protocol. This
now tracks in-flight pings and adds to the routing table only after receiving
a response.

* discovery: Refactor packet creation into its own function.

This function is useful inside unit tests.

* discovery: Additional testing for new add_node behavior.

* discovery: Track expiration of pings to non-yet-in-bucket nodes.

Now that we may ping nodes before adding to a k-bucket, the timeout tracking
must be separate from BucketEntry.

* discovery: Verify echo hash on pong packets.

Stores packet hash with in-flight requests and matches with pong response.

* discovery: Track timeouts on FIND_NODE requests.

* discovery: Retry failed pings with exponential backoff.

UDP packets may get dropped, so instead of immediately booting nodes that fail
to respond to a ping, retry 4 times with exponential backoff.

* !fixup Use slice instead of Vec for request_backoff.

* Add separate database directory for light client (#8927) (#9064)

* Add seperate default DB path for light client (#8927)

* Improve readability

* Revert "Replace `std::env::home_dir` with `dirs::home_dir` (#9077)" (#9097)

* Revert "Replace `std::env::home_dir` with `dirs::home_dir` (#9077)"

This reverts commit 7e77932.

* Restore some of the changes

* Update parity-common

* Offload cull to IoWorker. (#9099)

* Fix work-notify. (#9104)

* Update hidapi, fixes #7542 (#9108)

* docker: add cmake dependency (#9111)

* Update light client hardcoded headers (#9098)

* Insert Kovan hardcoded headers until #7690241

* Insert Kovan hardcoded headers until block 7690241

* Insert Ropsten hardcoded headers until #3612673

* Insert Mainnet hardcoded headers until block 5941249

* Make sure to produce full blocks. (#9115)

* Insert ETC (classic) hardcoded headers until block #6170625 (#9121)

* fix verification in ethcore-sync collect_blocks (#9135)

* Completely remove all dapps struct from rpc (#9107)

* Completely remove all dapps struct from rpc

* Remove unused pub use

* `evm bench` fix broken dependencies (#9134)

* `evm bench` use valid dependencies

Benchmarks of the `evm` used stale versions of a couple a crates that
this commit fixes!

* fix warnings

* Update snapcraft.yaml (#9132)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A2-insubstantial 👶 Pull request requires no code review (e.g., a sub-repository hash update). A8-looksgood 🦄 Pull request is reviewed well. M4-core ⛓ Core client code / Rust.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants