|
xrpld
|
Manager to create NegativeUNL votes. More...
#include <NegativeUNLVote.h>

Classes | |
| struct | Candidates |
| UNLModify Tx candidates. More... | |
Public Types | |
| enum class | NegativeUNLModify { ToDisable , ToReEnable } |
| A flag indicating whether a UNLModify Tx is to disable or to re-enable a validator. More... | |
Public Member Functions | |
| NegativeUNLVote (NodeID const &myId, beast::Journal j) | |
| Constructor. | |
| ~NegativeUNLVote ()=default | |
| void | doVoting (std::shared_ptr< Ledger const > const &prevLedger, HashSet< PublicKey > const &unlKeys, RCLValidations &validations, std::shared_ptr< SHAMap > const &initialSet) |
| Cast our local vote on the NegativeUNL candidates. | |
| void | newValidators (LedgerIndex seq, HashSet< NodeID > const &nowTrusted) |
| Notify NegativeUNLVote that new validators are added. | |
Static Public Attributes | |
| static constexpr size_t | kNegativeUnlLowWaterMark = kFlagLedgerInterval * 50 / 100 |
| A validator is considered unreliable if its validations is less than negativeUNLLowWaterMark in the last flag ledger period. | |
| static constexpr size_t | kNegativeUnlHighWaterMark = kFlagLedgerInterval * 80 / 100 |
| An unreliable validator must have more than negativeUNLHighWaterMark validations in the last flag ledger period to be re-enabled. | |
| static constexpr size_t | kNegativeUnlMinLocalValsToVote = kFlagLedgerInterval * 90 / 100 |
| The minimum number of validations of the local node for it to participate in the voting. | |
| static constexpr size_t | kNewValidatorDisableSkip = kFlagLedgerInterval * 2 |
| We don't want to disable new validators immediately after adding them. | |
| static constexpr float | kNegativeUnlMaxListed = 0.25 |
| We only want to put 25% of the UNL on the NegativeUNL. | |
Private Member Functions | |
| void | addTx (LedgerIndex seq, PublicKey const &vp, NegativeUNLModify modify, std::shared_ptr< SHAMap > const &initialSet) |
| Add a ttUNL_MODIFY Tx to the transaction set. | |
| std::optional< HashMap< NodeID, std::uint32_t > > | buildScoreTable (std::shared_ptr< Ledger const > const &prevLedger, HashSet< NodeID > const &unl, RCLValidations &validations) |
| Build a reliability measurement score table of validators' validation messages in the last flag ledger period. | |
| Candidates | findAllCandidates (HashSet< NodeID > const &unl, HashSet< NodeID > const &negUnl, HashMap< NodeID, std::uint32_t > const &scoreTable) |
| Process the score table and find all disabling and re-enabling candidates. | |
| void | purgeNewValidators (LedgerIndex seq) |
| Purge validators that are not new anymore. | |
Static Private Member Functions | |
| static NodeID | choose (UInt256 const &randomPadData, std::vector< NodeID > const &candidates) |
| Pick one candidate from a vector of candidates. | |
Private Attributes | |
| NodeID const | myId_ |
| beast::Journal | j_ |
| std::mutex | mutex_ |
| HashMap< NodeID, LedgerIndex > | newValidators_ |
Friends | |
| class | test::NegativeUNLVoteInternal_test |
| class | test::NegativeUNLVoteScoreTable_test |
Manager to create NegativeUNL votes.
Definition at line 33 of file NegativeUNLVote.h.
|
strong |
A flag indicating whether a UNLModify Tx is to disable or to re-enable a validator.
| Enumerator | |
|---|---|
| ToDisable | |
| ToReEnable | |
Definition at line 67 of file NegativeUNLVote.h.
| xrpl::NegativeUNLVote::NegativeUNLVote | ( | NodeID const & | myId, |
| beast::Journal | j ) |
Constructor.
| myId | the NodeID of the local node |
| j | log |
Definition at line 32 of file NegativeUNLVote.cpp.
|
default |
| void xrpl::NegativeUNLVote::doVoting | ( | std::shared_ptr< Ledger const > const & | prevLedger, |
| HashSet< PublicKey > const & | unlKeys, | ||
| RCLValidations & | validations, | ||
| std::shared_ptr< SHAMap > const & | initialSet ) |
Cast our local vote on the NegativeUNL candidates.
| prevLedger | the parent ledger |
| unlKeys | the trusted master keys of validators in the UNL |
| validations | the validation message container |
| initialSet | the transactions set for adding ttUNL_MODIFY Tx if any |
Definition at line 37 of file NegativeUNLVote.cpp.
| void xrpl::NegativeUNLVote::newValidators | ( | LedgerIndex | seq, |
| HashSet< NodeID > const & | nowTrusted ) |
Notify NegativeUNLVote that new validators are added.
So that they don't get voted to the NegativeUNL immediately.
| seq | the current LedgerIndex when adding the new validators |
| nowTrusted | the new validators |
Definition at line 310 of file NegativeUNLVote.cpp.
|
private |
Add a ttUNL_MODIFY Tx to the transaction set.
| seq | the LedgerIndex when adding the Tx |
| vp | the master public key of the validator |
| modify | disabling or re-enabling the validator |
| initialSet | the transaction set |
Definition at line 110 of file NegativeUNLVote.cpp.
|
staticprivate |
Pick one candidate from a vector of candidates.
| randomPadData | the data used for picking a candidate. |
| candidates | the vector of candidates |
Definition at line 141 of file NegativeUNLVote.cpp.
|
private |
Build a reliability measurement score table of validators' validation messages in the last flag ledger period.
| prevLedger | the parent ledger |
| unl | the trusted master keys |
| validations | the validation container |
Definition at line 158 of file NegativeUNLVote.cpp.
|
private |
Process the score table and find all disabling and re-enabling candidates.
| unl | the trusted master keys |
| negUnl | the NegativeUNL |
| scoreTable | the score table |
Definition at line 236 of file NegativeUNLVote.cpp.
|
private |
Purge validators that are not new anymore.
| seq | the current LedgerIndex |
Definition at line 324 of file NegativeUNLVote.cpp.
|
friend |
Definition at line 195 of file NegativeUNLVote.h.
|
friend |
Definition at line 196 of file NegativeUNLVote.h.
|
staticconstexpr |
A validator is considered unreliable if its validations is less than negativeUNLLowWaterMark in the last flag ledger period.
An unreliable validator is a candidate to be disabled by the NegativeUNL protocol.
Definition at line 42 of file NegativeUNLVote.h.
|
staticconstexpr |
An unreliable validator must have more than negativeUNLHighWaterMark validations in the last flag ledger period to be re-enabled.
Definition at line 47 of file NegativeUNLVote.h.
|
staticconstexpr |
The minimum number of validations of the local node for it to participate in the voting.
Definition at line 52 of file NegativeUNLVote.h.
|
staticconstexpr |
We don't want to disable new validators immediately after adding them.
So we skip voting for disabling them for 2 flag ledgers.
Definition at line 57 of file NegativeUNLVote.h.
|
staticconstexpr |
We only want to put 25% of the UNL on the NegativeUNL.
Definition at line 61 of file NegativeUNLVote.h.
|
private |
Definition at line 111 of file NegativeUNLVote.h.
|
private |
Definition at line 112 of file NegativeUNLVote.h.
|
mutableprivate |
Definition at line 113 of file NegativeUNLVote.h.
|
private |
Definition at line 114 of file NegativeUNLVote.h.