paritytech / polkadot-sdk

The Parity Polkadot Blockchain SDK
https://polkadot.com/
1.94k stars 710 forks source link

Make min peers to start warp sync configurable #496

Open tmpolaczyk opened 1 year ago

tmpolaczyk commented 1 year ago

Is there an existing issue?

Experiencing problems? Have you tried our Stack Exchange first?

Motivation

We would like to be able to warp sync a parachain using only 1 bootnode, but the node needs at least 3 peers, as defined here:

https://github.com/paritytech/substrate/blob/d38d176b844aab1338ce79eb71cd6df86c97d4a0/client/network/sync/src/lib.rs#L141-L142

What's the reason for that minimum? As far as I understand it is not possible to fake warp proofs, so 1 peer should be enough?

It would be nice to be able to disable it or configure it using a config param.

Request

Make MIN_PEERS_TO_START_WARP_SYNC configurable.

Solution

No response

Are you willing to help with this request?

Yes!

girazoki commented 1 year ago

@bkchr Can you provide some feedback here?

bkchr commented 1 year ago

It is probably to protect against an eclipse attack? @arkpar should know.

But yeah, on parachains we should not need this as we fetch the finalized block from the relay chain.

arkpar commented 1 year ago

It was added for a bit extra safety. Should be configurable indeed.