paritytech / polkadot-sdk

The Parity Polkadot Blockchain SDK
https://polkadot.network/
1.84k stars 668 forks source link

Followup HRMP issues after PR #1246 #2059

Open serban300 opened 11 months ago

serban300 commented 11 months ago
bkontur commented 3 weeks ago
* [ ]  Backpressure mechanism improvements (suspend/drop/resume)

  * The sender will be granted protocol-credits by the receiver to send `n` messages. This gets replenished at the leisure of the receiver; ensuring that it will never have to drop messages.

@ggwpez @serban300 guys, do you have more information about these "protocol credits"?

ggwpez commented 3 weeks ago

This would be mostly a re-write of the HRMP protocol that instead of sending messages optimistically, always first checks how many "sending" credits (something like weight) it has left.
So for example:

Some more advanced flow control logic could be added later, similar to torrenting, where channels that have many messages are prioritized. Otherwise a lot of these Credits would just idle and wait for a surge that never comes.

Does the general idea make sense? It is more pessimistic as to what we have now, at the expense of ensuring that the receiver is not overloaded.
It can be done backwards compatible with a version-upgrade protocol that elevates V1 channels to V2. But it is a rather big thing to do.