Commit Graph

2 Commits

Author SHA1 Message Date
Jamie Lokier 6b65467af7
Sync: Use stable nodekey/enode to accelerate sync testing
Make `run-nimbus-sync` look for and use `~/.nimbus/$TESTNET/nimbus/nodekey`
during Ethereum sync tests.  This is a private key which identifies the node.

If you have created that file, its contents should be a hex nodekey, same
format as Geth.  In fact you can use Geth to generate one.  If found,
`run-nimbus-sync` will use it as the nodekey, instead of Nimbus's default,
which is a random nodekey each time it is run.

Using the same nodekey for each run allows us to add the corresponding
`enode:...` URL (public key) as a trusted peer to the dedicated Geth instances,
using Geth's `admin.addTrustedPeer`.

This ensures Geth will almost always accept our connections, which is very
helpful for sync testing, instead of waiting a long time for a good peer.

Indeed, without this we might never get a willing good peer, due to reputation
effects while working on new sync methods.

Signed-off-by: Jamie Lokier <jamie@shareable.org>
2021-04-29 21:25:26 +01:00
Jamie Lokier e0f5a5e7f0 Sync: Script to assist with sync testing
Script to run Nimbus-eth1 syncing to any of the networks that Geth supports
by name, connecting to a single dedicated peer for that network.

All protocols are disabled other than the minimum we need for block sync.

This is very helpful for debugging and improving pipelined sync, and for
improving the database and other processing, even though p2p sync is the
endgame.

- Discovery protocols are turned off
- NAT hole punching protocols are turned off
- Whisper protocol is turned off (`--protocols:eth`)
- The only connection is to a single, active Geth for that network.
- Each network's data is stored in a different location to avoid conflicts.
- Each network is accessed by binding to a different port locally,
  so we can run several at the same time.
- Log level is set to `TRACE` because we can read them when we're not
  swamped with discovery messages.  Sync isn't fast enough yet.
2021-04-20 14:56:53 +01:00