Using sortition pools for signing group selection #1456
Open
Description
Currently selecting a signing group indexes into the array of groups, and eliminates terminated groups as candidates by iterating over the list of terminated groups with O(M) performance where M is the number of non-stale terminated groups.
If sortition pools are generalized, we could use a sortition tree optimized for signing groups (each non-expired non-terminated group has weight 1; necessary height of tree calculated from the highest possible number of groups active at once) to reduce the gas costs, especially in the scenario where we have a large number of terminated groups. With a sortition tree, expired and terminated groups would simply have their weight set to zero, and automatically skipped in O(log N) time.