celestiaorg / celestia-core

A fork of CometBFT
Apache License 2.0
492 stars 270 forks source link

Use dynamic queue for block prop #1520

Open evan-forbes opened 1 month ago

evan-forbes commented 1 month ago

one simple change we do for all forms of block prop (including mempools), is to utilize a dynamic queue.

For the existing consensus reactor, we queue block parts to be send for each peer every MaxGossipDelay. It's very possible to receive a block part from a peer that we have queued but have yet to pass through to the tcp buffer. When that's the case, it would be more optimal to not send that block part. If we had the ability to remove block parts from they queue, then nodes could do this as they receive block parts from their peers.

For mempools, the highest priority txs can be gossiped first, not unlike #1069. However, from a discussion w/ @cmwaters, we could move beyond #1069, and we can define priority differently. Instead of only basing this on gas price, we can always feed peers txs that are included in high priority VACs or compact blocks.

an example implementation was done in the big blonks testnet here https://github.com/celestiaorg/celestia-core/blob/evan/pipeline-cat-hack/mempool/cat/sorted_queue.go

evan-forbes commented 1 month ago

we should split this issue up into two: the ability to remove things from the queue and the ability to sort. We only need the ability to remove for push based, and the ability to sort for pull based