HomeSource World

les, p2p/simulations/adapters: fix issues found while simulating les (#21761)

Description

les, p2p/simulations/adapters: fix issues found while simulating les (#21761)

This adds a few tiny fixes for les and the p2p simulation framework:

LES Parts

  • Keep the LES-SERVER connection even it's non-synced We had this idea to reject the connections in LES protocol if the les-server itself is not synced. However, in LES protocol we will also receive the connection from another les-server. In this case even the local node is not synced yet, we should keep the tcp connection for other protocols(e.g. eth protocol).
  • Don't count "invalid message" for non-existing GetBlockHeadersMsg request In the eth syncing mechanism (full sync, fast sync, light sync), it will try to fetch some non-existent blocks or headers(to ensure we indeed download all the missing chain). In this case, it's possible that the les-server will receive the request for non-existent headers. So don't count it as the "invalid message" for scheduling dropping.
  • Copy the announce object in the closure Before the les-server pushes the latest headers to all connected clients, it will create a closure and queue it in the underlying request scheduler. In some scenarios it's problematic. E.g, in private networks, the block can be mined very fast. So before the first closure is executed, we may already update the latest_announce object. So actually the "announce" object we want to send is replaced. The downsize is the client will receive two announces with the same td and then drop the server.

P2P Simulation Framework

  • Don't double register the protocol services in p2p-simulation "Start". The protocols upon the devp2p are registered in the "New node stage". So don't reigster them again when starting a node in the p2p simulation framework
  • Add one more new config field "ExternalSigner", in order to use clef service in the framework.

Details

Provenance
gary rong <garyrong0905@gmail.com>Authored on Fri, Oct 30, 5:04 PM
GitHub <noreply@github.com>Committed on Fri, Oct 30, 5:04 PM
Parents
rGETHb63e3c37a62b: core: improve snapshot journal recovery (#21594)
Branches
Unknown
Tags
Unknown

Event Timeline

GitHub <noreply@github.com> committed rGETHb63bffe8202d: les, p2p/simulations/adapters: fix issues found while simulating les (#21761) (authored by gary rong <garyrong0905@gmail.com>).Fri, Oct 30, 5:04 PM