This post gives some numeric considerations for issue Domains - Max bundle weight is equal to max block weight · Issue #2226 · subspace/subspace · GitHub
In our domain design, a consensus block may include multiple bundles from one domain. While the weight (compute time for execution) of each bundle is limited by the domain configuration, a farmer is not concerned with the total compute time of multiple bundles and includes as many of them as are available and fit under consensus block weight and size limits. An operator must subsequently execute all of the bundles regardless of the potentially unbounded computation time. Below I will give statistical analysis and recommendations on bundle limits.
We assume bundle are produced iid and can use the Poisson distribution to estimate how many bundles can end up in the same block, or, equivalently, how many bundles were produced in an interval between two blocks.
An average block time is 6 slots for consensus chain (1/SLOT_PROBABILITY
) with an std of \sqrt{6}. Each domain has a specified bundle_slot_probability=1/n
which is a probability of producing a bundle in a slot, a multiplier to operator’s stake share.
Then the mean number of bundles in a block is \lambda=6*1/n and std \sqrt{6*1/n}.
If a domain has a configuration item TargetDomainBlockWeight
set to a certain value (e.g. 1.5 seconds), but not enforced, then for real domain block weights to achieve such value on average, a bundle limit should be set to:
max_bundle_weight = TargetDomainBlockWeight /(bundle_slot_probability/SLOT_PROBABILITY)
In this case, however, about half of the blocks may exceed TargetDomainBlockWeight
, while half may have lower weight.
To be on the safer side so that fewer blocks exceed TargetDomainBlockWeight
we can set expected number of bundles per block to one std higher than mean: 6*1/n + \sqrt{6*1/n} and
max_bundle_weight = TargetDomainBlockWeight/(bundle_slot_probability/SLOT_PROBABILITY+ Ceil[Sqrt[ bundle_slot_probability/SLOT_PROBABILITY]])
For example on real numbers where SLOT_PROBABILITY=1/6
, bundle_slot_probability=1
and TargetDomainBlockWeight=1500ms
:
max_bundle_weight = 1500/6 = 250 ms
or
max_bundle_weight = 1500/(6+Ceil[Sqrt[6]]) = 1500/9 = 166 ms
In the second, more restrictive option allows us to execute 84.72% of blocks under TargetDomainBlockWeight
.
If we want to be even more restrictive and computre 95.74% of blocks in under TargetDomainBlockWeight
we can take two std above average number of bundles:
max_bundle_weight=1500/(6+Ceil[2*Sqrt[6]]) = 1500/11 = 136 ms
Please note that numbers and probabilities will be different for domains with bundle_slot_probability
not equal to 1