Agreement Stages - Algorand Specifications

Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Algorand Specifications

The Algorand Agreement Protocol can be split into a series of stages.

In the normative section, these stages are univocally associated with infinite subsets of protocol states. These subsets are disjoint and together represent the whole space of possible states for the node state machine to be in.

The stages are, in chronological order within a given round:

If Commitment is not possible because of external reasons (i.e., a network partition), two fallback stages:

By abstracting away some implementation-specific complexity, we propose a model for the Agreement Protocol state machine that captures how and when transitions between different states happen.

We may model the state machine’s main algorithm in the following way:

Algorithm 2: Main State Machine

1: function EventHandler(ev)
2: if ev is a TimeoutEvent then
3: time ← ev.time
4: if time = 0 then
   Last round should have left us with s := propose
5: BlockProposal()
6: if finished a block ∨ CurrentTime() = AssemblyDeadline() then
7: step ← soft
8: end if
9: else if time = DynamicFilterTimeout(p) then
10: SoftVote()
11: step ← cert
12: else if time = DeadlineTimeout(p) then
13: step ← next0
14: Recovery()
15: else if time = DeadlineTimeout(p) + 2s−3λ for 4 ≤ s ≤ 252 then
16: step ← nexts
17: Recovery()
18: else if time = kλf + rnd for k, rnd ∈ Z, k > 0, 0 ≤ rnd ≤ λf then
19: FastRecovery()
20: end if
21: else
   MessageEvent could trigger a commitment and round advancement
22: msg ← ev.msg
23: if msg.data is of type Proposal pp then
24: HandleProposal(pp)
25: else if msg.data is of type Vote v then
26: HandleVote(v)
27: else if msg.data is of type Bundle b then
28: HandleBundle(b)
29: end if
30: end if
31: end function

The first three steps (propose, soft, cert) are the fundamental parts, and will be the only steps run in regular “healthy” functioning conditions.

The following steps are recovery procedures if there’s no observable consensus before their trigger times.

Note that in the case of propose, if a block is not assembled and finalized in time for the BlockAssembly() timeout, this might trigger advancement to the next step.

For more information on this process, refer to the Algorand Ledger non-normative section.

The nexts−3 with s∈[3,252] are recovery steps, while the last three (late, redo, down) are special fast recovery steps.

A period is an execution of a subset of steps, executed in order until one of them achieves a bundle for a specific value.

A round always starts with a propose step and finishes with a cert step (when a block becomes commitable, it is certified and committed to the Ledger).

However, multiple periods might be executed inside a round until:

Events are the only way for the node state machine to transition internally and produce output.

If an event is not identified as misconstrued or malicious, it will produce a state change. Also, it will almost certainly cause a receiving node to produce and then broadcast or relay an output, consumed by its peers in the network.

There are two main kinds of events:

Internally, we consider the structure of an event to be composed of:

TimeoutEvents are triggered when a specific time has elapsed after the start of a new period.

The important note regarding the next vote ranges can be found in the reference implementation.

For a detailed description, refer to its subsection.

MessageEvents are events triggered after observing a specific message carrying data.

In Algorithm 2, we focused on three kinds of messages:

Each carries the corresponding construct (coinciding with their attached data type field).