Skip to content

consensus: investigate and define the relationship between timeouts #2547

Open

Description

@cason

Consensus uses three timeouts, one per round step, to govern the operation of rounds of consensus when the "good" path or execution scenario is not observed: timeout_propose, timeout_prevote, and timeout_precommit.

Consensus timeouts are adaptive, meaning that their duration increase over rounds, with linear increments. So, the duration of a timeout for a round step (propose, prevote, or precommit) in a round r of consensus is given by:

timeout_<step>(r) = timeout_<step> + r * timeout_<step>_delta

The timeout_<step> parameters thus define the duration of timeouts adopted in round r = 0, while the timeout_<step>_delta parameters define the linear increment for the duration of timeouts over rounds, only relevant for rounds r > 0.

Liveness conditions

The consensus algorithm paper defines some conditions on the consensus timeouts so that the Termination property is observed. The termination of a consensus algorithm is a liveness property stated as: "All correct processes eventually decide on a value". Using CometBFT's nomenclature, the property translates into: "All correct nodes eventually commit a block".

The conditions on consensus timeouts, stated as part of Lemma 5 (page 10), requires that in a round r we have:

* timeout_propose(r) > 2∆ + timeout_precommit(r−1)
* timeout_prevote(r) > 2∆
* timeout_precommit(r) > 2∆

∆ is the upper bound on message delay, i.e., the maximum time it takes for a message sent by a correct node to be received by all correct nodes. This bound is only valid once the system reaches GST, the Global Stabilization Time. ∆ and GST are not necessarily known by the nodes, but they are assumed to be finite. These are assumptions of the partially synchronous system model adopted by the consensus algorithm. The progress of the algorithm is guaranteed when the system becomes ∆-timely, i.e., after GST.

Sufficient vs Required conditions

The above conditions on consensus timeouts are sufficient for ensuring liveness. In fact, the paper proves that if the configured timeouts follow the above mentioned conditions, the Termination of the consensus algorithm is guaranteed.

The above conditions on consensus timeouts, however, are not necessarily required for ensuring liveness. This means that a less restrictive set conditions on consensus timeouts could possibly guarantee the Termination of the consensus algorithm as well.

We should investigate if there is a less restrictive set conditions on consensus timeouts that still guarantees liveness after GST.

Conditions to Parameters

What is the required relationship between timeout_<step> and timeout_<step>_delta parameters for different round steps, so that the consensus timeouts adopted by a node adhere to the minimum set of conditions required for ensuring progress?

Definition of Done

  • Investigate the required conditions on consensus timeouts for ensuring liveness
  • Define rules for configuring consensus timeout parameters so that the required conditions are observed

Activity

  1. added
    spec
    on Mar 8, 2024
  2. hvanz commented on Mar 11, 2024

    @hvanz
    Collaborator

    Probably a topic of another issue/investigation is the relationship between max block size and the timeouts, in particular timeout_propose. The bigger the proposal, the more time is required to process it and propagate it in the network.

  3. cason commented on Mar 20, 2024

    @cason
    Author

    This is true, although liveness is not affected, only performance. Namely, if the block is big and the timeout is small, since the timeouts increase over rounds, eventually they become large enough to encompass the transmission of the big block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

configconsensusspec

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions