celestia-node icon indicating copy to clipboard operation
celestia-node copied to clipboard

service/header: Implement throttling on how many `ExtendedHeader`s can be requested/sent at once.

Open renaynay opened this issue 3 years ago • 5 comments

We need to figure out the max packet size we are willing to send across the network for any given message, not just ExtendedHeader - related packets. If we are to send batched headers eventually, then we need to measure the packet size so that it does not increase whatever max packet size limit we send.

We could do this either on the request side (so only able to request max 100, for example, headers at a time), or we can just break up the []*ExtendedHeader packet so that it sends maximum 50 headers in a packet at a time.

These are obviously arbitrary numbers and will require testing to see what kind of max packet size is most efficient for our network, but we need to define these metrics post Devnet.

renaynay avatar Nov 11 '21 14:11 renaynay

@renaynay, Currently, we request 128 headers, but the responding side doesn't have a check for max headers, so that's DOS vector. Luckily it is just a one if to fix

Wondertan avatar Nov 29 '21 16:11 Wondertan

We can just implement a maxMessageSize on the wire.

renaynay avatar Nov 30 '21 22:11 renaynay

Meh we can just implement the same 128 headers max per message on the serving side.

renaynay avatar Nov 30 '21 22:11 renaynay

@renaynay, Currently, we request 128 headers, but the responding side doesn't have a check for max headers, so that's DOS vector. Luckily it is just a one if to fix

*512 https://github.com/celestiaorg/celestia-node/blob/main/header/sync/sync.go#L319

renaynay avatar Jul 19 '22 12:07 renaynay

Yep, we changed it after that comment

Wondertan avatar Jul 20 '22 09:07 Wondertan