Multi-Block Sequential Phragmén #465
Labels
I5-enhancement
An additional feature request.
I6-meta
A specific issue for grouping tasks or bugs of a specific category.
As paritytech/substrate#7908 is merged, we now have some extensible traits to express more complicated elections in a generic way.
An important and interesting one to build is a multi-block implementation of seq-phragmen. Once we have this, we can use this as the fallback so that the chain will not stall, but rather probably disallow any extrinsic due to weight limit for a few blocks.
A simple way to think about this is to break the outer loop of phragmen between blocks and execute
n
iterations per block, write intermediary values, pick up in the next block, and so on.To my future self or anyone who'd take this, I recommend first doing an analysis of the weight of storage read/write operations and determine the optimal IO/CPU ratio that we can support in the runtime. Unlikely, but perhaps this analysis leads to us realizing that multi-block phragmen is not feasible after all.
For example, if it might turn out that reading and writing all the intermediary values already takes up the entire block weight while leaving non or very little space left for actual computation. In which case it might still be possible to implement this, but it would be substantially harder, as you can't even execute one iteration per block.
The text was updated successfully, but these errors were encountered: