near / nearcore

Reference client for NEAR Protocol
https://near.org
GNU General Public License v3.0
2.34k stars 632 forks source link

congestion control: Do not treat missing blocks as congestion #11852

Open wacban opened 4 months ago

wacban commented 4 months ago

The congestion control considers both missing chunks and missing blocks as congestion. The point of this check is to prevent receipts accumulating and causing the state witness to grow too large. For this purpose the missing blocks are not relevant because when a block is missing no new outgoing receipts can be send.

This task is about making congestion control distinguish between missing chunks and missing blocks and only consider the former as congestion.

jancionear commented 4 months ago

I think ideally this should be solved with cross-shard bandwidth limiting. The way I imagine it, each shard would be allowed to send X bytes of data to other shard, with X being determined dynamically at each height. Then when a chunk is missing, we can sum up how much each shard was allowed to send to this shard in the past and assign the remaining bandwidth until it runs out.

wacban commented 4 months ago

Good point, thanks! I think we can still consider this proposal as a quicker alternative. Ultimately it is about the cross shard bandwidth so the limiting should resolve this issue as well. We just need to make sure to get rid of the missing chunks / blocks congestion when the limiting is in place.