Skip to content
quan8 edited this page Jan 6, 2022 · 3 revisions

Epochs

Lachesis's event structure is a DAG of events. To optimize storage and retrieval, the DAG is separated into sub-DAGs, each of them is called epoch. Each epoch is comprised a number of (finalized) blocks.

Each epoch is sealed when one of the below conditions is satisfied:

  • Epoch has spent >= MaxEpochGas of gas power
  • Epoch lasts for a duration >= MaxEpochDuration
  • At least one cheater is confirmed in this block
  • Epoch sealing is requested by the NodeDriver contract

When an epoch gets sealed, its inner epoch index get pruned, and new events of the sealed epochs are ignored. Each epoch is forming a separate DAG, and thus parents from other epochs are not allowed.

For a sanity check, each first event from a validator includes the hash of previous epoch.

The lowest possible epoch number is 1.

A note for experienced readers:

It's possible to ignore events for past (or future) epochs, because future epochs depend only on the finalized state of a previous epoch. Due to the aBFT consensus, the state is final unless more than 1/3W are Byzantine, so it may be safely assumed that new events for an already sealed epoch won't bring any new information (i.e. alter events order). It wouldn't be possible to prune old index (or whole events) with a monolith DAG, because event's parent could be from any past event, so we would always need to keep all the indexes in DB, or implement the complex redundant techniques or constraints.

Scheme

Learn more about Atropos event blocks in Lachesis aBFT consensus.

Validators group

Validators are specified by the NodeDriver contract. Each validator has the right to create events. The total stake of a validator is used as a weight in the consensus algorithm. A validator ID is a uint32 number, specified by the NodeDriver contract.

At the beginning of each epoch, validators group for the epoch are decided and their weights are fixed for the entire epoch. When an epoch gets sealed, a new validators group will be calculated based on the validators list given at the end of the sealed epoch.

If a validator is found as a cheater, the validator will receive an economic penalty, immediately after the first block observing the fork. The epoch is sealed if at least one cheater is observed, so cheater is pruned from the validators group right away.