Epoch Transition
- Epoch transition happens when someone calls
beginEpochTransition()
and the current block isepochLength
blocks more since last transitioned block. - In
beginEpochTransition()
- An
EpochEnded
event is emitted andcurrentEpoch
increases by 1.
- An
![currentEpoch is increased by one.](/img/v1/epoch-increase.png)
- After the
EpochEnded
event is emitted, all epoch keys attested during this epoch will have their hash chains sealed- by sealed it means that the hash chain is hashed again with
1
, e.g.,hash(1, originalHashChain)
- if an epoch key received no attestation, it's hash chain would be
hash(1, 0)
- by sealed it means that the hash chain is hashed again with
![currentEpoch is increased by one.](/img/v1/seal-epk.png)
- After hash chain of the epoch keys are sealed, these epoch keys and their hash chain will be inserted into the epoch tree of this epoch
- there's only one epoch tree for every epoch.
![](/img/v1/epoch-tree.png)
- There will be a new global state tree for each epoch.
- And after epoch transition, user needs to perform user state transition to transition his user state into the latest epoch
info