Designation

The process of designating executors for the rounds in an epoch happens in the beginning of that epoch. The objective is to generate a pseudo-random seed used as source of randomness when selecting the executors.

Immediately after an epoch is initiated there is a commit phase. Here, executors can publish a commitment which is a keccak256 hash of an ERC-191 signature of a keccak256 hash of the current epoch and chain ID. The commitment is stored in the Coordinator contract inside the commitmentMap. After the commit phase follows the reveal phase. Here, executors who published a commitment must reveal the signature i.e. the secret of the commitment. Failing to reveal makes the executor subject to slashing.

When a new epoch is initiated, the seed is updated to the keccak256 hash of the current block.timestamp, block.number and the seed of the previous epoch. When the reveal function of the Coordinator contract is called, the seed is updated to the keccak256 hash of the signature (commit secret) and previous seed value. Because committing executors do not know the secret of other committors before the reveal (it is derrived from their private key) and becasue the commitment must be of a valid signature, there is no way to try and tailor the secret to influence the seed. Executors are incentivized to commit to ensure a fair and unpredictable selection process. However, an executor might choose not to reveal their secret. They might do this if they know everyone else have revealed and the current seed favor themself. This is why committing without revealing makes the executor subject to slashing.

The final seed is locked after the reveal phase. The designated executor for each round can be calculated by taking the keccak256 hash of the seed and the round number and modulo the hash with the numberOfActiveExecutors. The resulting number is the index in the activeExecutors array where the address of the designated executor resides.

Last updated