xrpld
Loading...
Searching...
No Matches
xrpl::ConsensusParms Struct Reference

Consensus algorithm parameters. More...

#include <ConsensusParms.h>

Collaboration diagram for xrpl::ConsensusParms:

Classes

struct  AvalancheCutoff

Public Types

enum class  AvalancheState { Init , Mid , Late , Stuck }

Public Member Functions

 ConsensusParms ()=default

Public Attributes

std::chrono::seconds const validationValidWall = std::chrono::minutes{5}
 The duration a validation remains current after its ledger's close time.
std::chrono::seconds const validationValidLocal = std::chrono::minutes{3}
 Duration a validation remains current after first observed.
std::chrono::seconds const validationValidEarly = std::chrono::minutes{3}
 Duration pre-close in which validations are acceptable.
std::chrono::seconds const proposeFRESHNESS = std::chrono::seconds{20}
 How long we consider a proposal fresh.
std::chrono::seconds const proposeINTERVAL = std::chrono::seconds{12}
 How often we force generating a new proposal to keep ours fresh.
std::size_t const minConsensusPct = 80
 The percentage threshold above which we can declare consensus.
std::chrono::milliseconds const ledgerIdleInterval = std::chrono::seconds{15}
 The duration a ledger may remain idle before closing.
std::chrono::milliseconds const ledgerMinConsensus = std::chrono::milliseconds{1950}
 The number of seconds we wait minimum to ensure participation.
std::chrono::milliseconds const ledgerMaxConsensus = std::chrono::seconds{15}
 The maximum amount of time to spend pausing for laggards.
std::chrono::milliseconds const ledgerMinClose = std::chrono::seconds{2}
 Minimum number of seconds to wait to ensure others have computed the LCL.
std::chrono::milliseconds const ledgerGRANULARITY = std::chrono::seconds{1}
 How often we check state or change positions.
std::size_t const ledgerAbandonConsensusFactor = 10
 How long to wait before completely abandoning consensus.
std::chrono::milliseconds const ledgerAbandonConsensus = std::chrono::seconds{120}
 Maximum amount of time to give a consensus round.
std::chrono::milliseconds const avMinConsensusTime = std::chrono::seconds{5}
 The minimum amount of time to consider the previous round to have taken.
std::map< AvalancheState, AvalancheCutoff > const avalancheCutoffs
std::size_t const avCtConsensusPct = 75
 Percentage of nodes required to reach agreement on ledger close time.
std::size_t const avMinRounds = 2
 Number of rounds before certain actions can happen.
std::size_t const avStalledRounds = 4

Detailed Description

Consensus algorithm parameters.

Parameters which control the consensus algorithm. This are not meant to be changed arbitrarily.

Definition at line 18 of file ConsensusParms.h.

Member Enumeration Documentation

◆ AvalancheState

Enumerator
Init 
Mid 
Late 
Stuck 

Definition at line 109 of file ConsensusParms.h.

Constructor & Destructor Documentation

◆ ConsensusParms()

xrpl::ConsensusParms::ConsensusParms ( )
explicitdefault

Member Data Documentation

◆ validationValidWall

std::chrono::seconds const xrpl::ConsensusParms::validationValidWall = std::chrono::minutes{5}

The duration a validation remains current after its ledger's close time.

This is a safety to protect against very old validations and the time it takes to adjust the close time accuracy window.

Definition at line 31 of file ConsensusParms.h.

◆ validationValidLocal

std::chrono::seconds const xrpl::ConsensusParms::validationValidLocal = std::chrono::minutes{3}

Duration a validation remains current after first observed.

The duration a validation remains current after the time we first saw it. This provides faster recovery in very rare cases where the number of validations produced by the network is lower than normal

Definition at line 39 of file ConsensusParms.h.

◆ validationValidEarly

std::chrono::seconds const xrpl::ConsensusParms::validationValidEarly = std::chrono::minutes{3}

Duration pre-close in which validations are acceptable.

The number of seconds before a close time that we consider a validation acceptable. This protects against extreme clock errors

Definition at line 46 of file ConsensusParms.h.

◆ proposeFRESHNESS

std::chrono::seconds const xrpl::ConsensusParms::proposeFRESHNESS = std::chrono::seconds{20}

How long we consider a proposal fresh.

Definition at line 49 of file ConsensusParms.h.

◆ proposeINTERVAL

std::chrono::seconds const xrpl::ConsensusParms::proposeINTERVAL = std::chrono::seconds{12}

How often we force generating a new proposal to keep ours fresh.

Definition at line 52 of file ConsensusParms.h.

◆ minConsensusPct

std::size_t const xrpl::ConsensusParms::minConsensusPct = 80

The percentage threshold above which we can declare consensus.

Definition at line 59 of file ConsensusParms.h.

◆ ledgerIdleInterval

std::chrono::milliseconds const xrpl::ConsensusParms::ledgerIdleInterval = std::chrono::seconds{15}

The duration a ledger may remain idle before closing.

Definition at line 62 of file ConsensusParms.h.

◆ ledgerMinConsensus

std::chrono::milliseconds const xrpl::ConsensusParms::ledgerMinConsensus = std::chrono::milliseconds{1950}

The number of seconds we wait minimum to ensure participation.

Definition at line 65 of file ConsensusParms.h.

◆ ledgerMaxConsensus

std::chrono::milliseconds const xrpl::ConsensusParms::ledgerMaxConsensus = std::chrono::seconds{15}

The maximum amount of time to spend pausing for laggards.

This should be sufficiently less than validationFRESHNESS so that validators don't appear to be offline that are merely waiting for laggards.

Definition at line 73 of file ConsensusParms.h.

◆ ledgerMinClose

std::chrono::milliseconds const xrpl::ConsensusParms::ledgerMinClose = std::chrono::seconds{2}

Minimum number of seconds to wait to ensure others have computed the LCL.

Definition at line 76 of file ConsensusParms.h.

◆ ledgerGRANULARITY

std::chrono::milliseconds const xrpl::ConsensusParms::ledgerGRANULARITY = std::chrono::seconds{1}

How often we check state or change positions.

Definition at line 79 of file ConsensusParms.h.

◆ ledgerAbandonConsensusFactor

std::size_t const xrpl::ConsensusParms::ledgerAbandonConsensusFactor = 10

How long to wait before completely abandoning consensus.

Definition at line 82 of file ConsensusParms.h.

◆ ledgerAbandonConsensus

std::chrono::milliseconds const xrpl::ConsensusParms::ledgerAbandonConsensus = std::chrono::seconds{120}

Maximum amount of time to give a consensus round.

Does not include the time to build the LCL, so there is no reason for a round to go this long, regardless of how big the ledger is.

Definition at line 90 of file ConsensusParms.h.

◆ avMinConsensusTime

std::chrono::milliseconds const xrpl::ConsensusParms::avMinConsensusTime = std::chrono::seconds{5}

The minimum amount of time to consider the previous round to have taken.

The minimum amount of time to consider the previous round to have taken. This ensures that there is an opportunity for a round at each avalanche threshold even if the previous consensus was very fast. This should be at least twice the interval between proposals (0.7s) divided by the interval between mid and late consensus ([85-50]/100).

Definition at line 102 of file ConsensusParms.h.

◆ avalancheCutoffs

std::map<AvalancheState, AvalancheCutoff> const xrpl::ConsensusParms::avalancheCutoffs
Initial value:
{
{.consensusTime = 0, .consensusPct = 50, .next = AvalancheState::Mid}},
{.consensusTime = 50, .consensusPct = 65, .next = AvalancheState::Late}},
{.consensusTime = 85, .consensusPct = 70, .next = AvalancheState::Stuck}},
{.consensusTime = 200, .consensusPct = 95, .next = AvalancheState::Stuck}},
}

Map the consensus requirement avalanche state to the amount of time that must pass before moving to that state, the agreement percentage required at that state, and the next state. "stuck" loops back on itself because once we're stuck, we're stuck. This structure allows for "looping" of states if needed.

Definition at line 121 of file ConsensusParms.h.

◆ avCtConsensusPct

std::size_t const xrpl::ConsensusParms::avCtConsensusPct = 75

Percentage of nodes required to reach agreement on ledger close time.

Definition at line 139 of file ConsensusParms.h.

◆ avMinRounds

std::size_t const xrpl::ConsensusParms::avMinRounds = 2

Number of rounds before certain actions can happen.

Definition at line 144 of file ConsensusParms.h.

◆ avStalledRounds

std::size_t const xrpl::ConsensusParms::avStalledRounds = 4

Number of rounds before a stuck vote is considered unlikely to change because voting stalled

Definition at line 148 of file ConsensusParms.h.