This file documents a contract which is not yet deployed to Mainnet.
This library is used as a registry of created groups.
This library should be used along with DKG library that ensures linear groups creation (only one group creation happens at a time). A candidate group has to be popped or activated before adding a new candidate group.
Performs preliminary validation of a new group public key. The group public key must be unique and have 128 bytes in length. If the validation fails, the function reverts. This function must be called first for a public key of a group added with addGroup
function.
self
struct Groups.Data
groupPubKey
bytes
Candidate group public key
Adds a new candidate group. The group is stored with group public key and group members, but is not yet activated.
The group members list is stored with all misbehaved members filtered out. The code calling this function should ensure that the number of candidate (not activated) groups is never more than one.
self
struct Groups.Data
groupPubKey
bytes
Generated candidate group public key
membersHash
bytes32
Keccak256 hash of members that actively took part in DKG.
Goes through groups starting from the oldest one that is still active and checks if it hasn't expired. If so, updates the information about expired groups so that all expired groups are marked as such.
Terminates group with the provided index. Reverts if the group is already terminated.
self
struct Groups.Data
groupId
uint64
Index in the groupRegistry array.
Returns an index of a randomly selected active group. Terminated and expired groups are not considered as active. Before new group is selected, information about expired groups is updated. At least one active group needs to be present for this function to succeed.
self
struct Groups.Data
seed
uint256
Random number used as a group selection seed.
Setter for group lifetime.
self
struct Groups.Data
lifetime
uint256
Lifetime of a group in blocks.
Checks if group with the given index is terminated.
Gets the cutoff time until which the given group is considered to be active assuming it hasn't been terminated before.
Checks if group with the given index is active and non-terminated.
Gets the number of active groups. Expired and terminated groups are not counted as active.
Evaluates the shift of a selected group index based on the number of expired groups.
Evaluates the shift of a selected group index based on the number of non-expired but terminated groups.