2

The Tezos protocol does a lot of bookkeeping at the end of a cycle to manage its validator set. According to our own research and that of others we came up with a list of assumptions that suggest the following events happen in the order described below:

  1. balance updates are applied (like at every other block)
  2. a balance snapshot is taken (on mainnet with 4096 blocks per cycle this is snapshot index 15)
  3. seed nonces published in cycle N are collected
  4. a new random number generator seed is generated from these nonces (and previous state I assume)
  5. validators are slashed for not publishing seed nonces
  6. a snapshot index is selected for cycle N-1
  7. baking and endorsing rights for cycle N+6 are generated based on the seed and a previous roll snapshot in N-1 at the selected index
  8. validator grace period is checked and unresponsive validators are deactivated
  9. frozen rewards, deposits and fees from cycle N-5 are unfrozen
  10. (when applicable) a finished voting period is closed, potentially updating quorum
  11. (when applicable) a new voting period is opened
  12. (when applicable) a snapshot of eligible voters and their rolls is taken
  13. (when applicable) a new protocol is activated and migrations are applied

From the perspective of an outside observer all these steps happen atomically. Only the final result that can be observed on the RPC level.

As there are subtle inter-dependencies between these steps knowing the exact order of events is essential to avoid confusion for downstream tools like payout libraries, indexers and possible more.

Q1: Is the order of events above correct? Q2: Are there any other steps I might have missed?

4
  • Strictly speaking, step 3, seed nonce collection is done during the cycle, there's no explicit collection step.
    – Eugen
    Jun 15 '20 at 6:06
  • I think steps 5 and 6 should be swapped.
    – Eugen
    Jun 15 '20 at 6:13
  • Also, step 7 is implicit. Baking and endorsing rights are not stored in the context, instead they are recomputed whenever asked for.
    – Eugen
    Jun 15 '20 at 6:17
  • I think steps 8 and 9 should also be swapped.
    – Eugen
    Jun 15 '20 at 6:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.