owners**:** @David Rusu @Alexander Mozeika @Daniel Kashepava
counts all blocks produced (including abandoned blocks). This was possible to implement because orphans allowed us to reference blocks that are not in the main chain.
The target value for our measured block production rate is $\log\left(\frac{1}{1-f}\right)$.
$$ D^{ep+1}=D^{ep}-\beta\frac{D^{ep}}{\log\left(\frac{1}{1-f}\right)}\left(\log\left(\frac{1}{1-f}\right)-\frac{\sum_n^N\sum_t^T s_i(t)}{T}\right) $$
Here, we count the number of occupied slots, if 10 blocks were proposed in slot $t$, then we will still only count 1 for that slot.
The target slot occupancy rate is $f$.
$$ D^{ep+1}=D^{ep}-\beta\frac{D^{ep}}{f}\left(f-\frac{\sum_t^T 1 - \delta_{0,\sum_n^N s_i(t)}}{T}\right) $$
$$ D^{ep+1}=D^{ep}-\beta D^{ep}\left(1-\frac{\sum_t^T 1 - \delta_{0,\sum_n^N s_i(t)}}{fT}\right) $$
A problem with our current total stake estimator is that it will be biased by the shape of the distribution of stake, highly decentralized stake will give a better estimate of total stake vs. highly centralized stake.
But if we estimate the block production rate $f$, this should go away due to this derivation:
$$ \begin{align} f &= \phi_f(1) \\ &= \phi_f\left(\sum_n^N \alpha_n\right) \\ &= 1 - (1 - f)^{\sum_n^N \alpha_n} \\ &= 1- \prod_n^N(1-f)^{\alpha_n} \\
&= 1- \prod_n^N1 - (1 - (1-f)^{\alpha_n}) \\ f &= 1 - \prod_n^N1-\phi_f(\alpha_n) \end{align} $$
This equation effectively states that block occupancy is independent of highly centralized stake i.e. $\phi_f(1)$ vs highly decentralized state $1 - \prod_n^N1-\phi_f(\alpha_n)$.
This is promising in that it will remove one of the sources of error in our total stake inference process.