rippled
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
ripple::ValidatorList Class Reference
Collaboration diagram for ripple::ValidatorList:
Collaboration graph
[legend]

Classes

struct  MessageWithHash
 
struct  PublisherList
 
struct  PublisherListCollection
 
struct  PublisherListStats
 Describes the result of processing a Validator List (UNL), including some of the information from the list which can be used by the caller to know which list publisher is involved. More...
 

Public Types

using QuorumKeys = std::pair< std::size_t const, hash_set< PublicKey > >
 

Public Member Functions

 ValidatorList (ManifestCache &validatorManifests, ManifestCache &publisherManifests, TimeKeeper &timeKeeper, std::string const &databasePath, beast::Journal j, std::optional< std::size_t > minimumQuorum=std::nullopt)
 
 ~ValidatorList ()=default
 
bool load (PublicKey const &localSigningKey, std::vector< std::string > const &configKeys, std::vector< std::string > const &publisherKeys)
 Load configured trusted keys. More...
 
PublisherListStats applyListsAndBroadcast (std::string const &manifest, std::uint32_t version, std::vector< ValidatorBlobInfo > const &blobs, std::string siteUri, uint256 const &hash, Overlay &overlay, HashRouter &hashRouter, NetworkOPs &networkOPs)
 Apply multiple published lists of public keys, then broadcast it to all peers that have not seen it or sent it. More...
 
PublisherListStats applyLists (std::string const &manifest, std::uint32_t version, std::vector< ValidatorBlobInfo > const &blobs, std::string siteUri, std::optional< uint256 > const &hash={})
 Apply multiple published lists of public keys. More...
 
std::vector< std::stringloadLists ()
 
TrustChanges updateTrusted (hash_set< NodeID > const &seenValidators, NetClock::time_point closeTime, NetworkOPs &ops, Overlay &overlay, HashRouter &hashRouter)
 Update trusted nodes. More...
 
std::size_t quorum () const
 Get quorum value for current trusted key set. More...
 
bool trusted (PublicKey const &identity) const
 Returns true if public key is trusted. More...
 
bool listed (PublicKey const &identity) const
 Returns true if public key is included on any lists. More...
 
std::optional< PublicKeygetTrustedKey (PublicKey const &identity) const
 Returns master public key if public key is trusted. More...
 
std::optional< PublicKeygetListedKey (PublicKey const &identity) const
 Returns listed master public if public key is included on any lists. More...
 
bool trustedPublisher (PublicKey const &identity) const
 Returns true if public key is a trusted publisher. More...
 
PublicKey localPublicKey () const
 Returns local validator public key. More...
 
void for_each_listed (std::function< void(PublicKey const &, bool)> func) const
 Invokes the callback once for every listed validation public key. More...
 
void for_each_available (std::function< void(std::string const &manifest, std::uint32_t version, std::map< std::size_t, ValidatorBlobInfo > const &blobInfos, PublicKey const &pubKey, std::size_t maxSequence, uint256 const &hash)> func) const
 Invokes the callback once for every available publisher list's raw data members. More...
 
std::optional< Json::ValuegetAvailable (boost::beast::string_view const &pubKey, std::optional< std::uint32_t > forceVersion={})
 Returns the current valid list for the given publisher key, if available, as a Json object. More...
 
std::size_t count () const
 Return the number of configured validator list sites. More...
 
std::optional< TimeKeeper::time_pointexpires () const
 Return the time when the validator list will expire. More...
 
Json::Value getJson () const
 Return a JSON representation of the state of the validator list. More...
 
QuorumKeys getQuorumKeys () const
 Get the quorum and all of the trusted keys. More...
 
hash_set< PublicKeygetTrustedMasterKeys () const
 get the trusted master public keys More...
 
hash_set< PublicKeygetNegativeUNL () const
 get the master public keys of Negative UNL validators More...
 
void setNegativeUNL (hash_set< PublicKey > const &negUnl)
 set the Negative UNL with validators' master public keys More...
 
std::vector< std::shared_ptr< STValidation > > negativeUNLFilter (std::vector< std::shared_ptr< STValidation >> &&validations) const
 Remove validations that are from validators on the negative UNL. More...
 

Static Public Member Functions

static std::vector< ValidatorBlobInfoparseBlobs (std::uint32_t version, Json::Value const &body)
 Pull the blob/signature/manifest information out of the appropriate Json body fields depending on the version. More...
 
static std::vector< ValidatorBlobInfoparseBlobs (protocol::TMValidatorList const &body)
 
static std::vector< ValidatorBlobInfoparseBlobs (protocol::TMValidatorListCollection const &body)
 
static void sendValidatorList (Peer &peer, std::uint64_t peerSequence, PublicKey const &publisherKey, std::size_t maxSequence, std::uint32_t rawVersion, std::string const &rawManifest, std::map< std::size_t, ValidatorBlobInfo > const &blobInfos, HashRouter &hashRouter, beast::Journal j)
 
static std::pair< std::size_t, std::size_tbuildValidatorListMessages (std::size_t messageVersion, std::uint64_t peerSequence, std::size_t maxSequence, std::uint32_t rawVersion, std::string const &rawManifest, std::map< std::size_t, ValidatorBlobInfo > const &blobInfos, std::vector< MessageWithHash > &messages, std::size_t maxSize=maximiumMessageSize)
 

Private Types

using lock_guard = std::lock_guard< decltype(mutex_)>
 
using shared_lock = std::shared_lock< decltype(mutex_)>
 

Private Member Functions

std::size_t count (shared_lock const &) const
 Return the number of configured validator list sites. More...
 
bool trusted (shared_lock const &, PublicKey const &identity) const
 Returns true if public key is trusted. More...
 
std::optional< PublicKeygetTrustedKey (shared_lock const &, PublicKey const &identity) const
 Returns master public key if public key is trusted. More...
 
std::optional< TimeKeeper::time_pointexpires (shared_lock const &) const
 Return the time when the validator list will expire. More...
 
PublisherListStats applyList (std::string const &globalManifest, std::optional< std::string > const &localManifest, std::string const &blob, std::string const &signature, std::uint32_t version, std::string siteUri, std::optional< uint256 > const &hash, lock_guard const &)
 Apply published list of public keys. More...
 
void updatePublisherList (PublicKey const &pubKey, PublisherList const &current, std::vector< PublicKey > const &oldList, lock_guard const &)
 
boost::filesystem::path getCacheFileName (lock_guard const &, PublicKey const &pubKey) const
 Get the filename used for caching UNLs. More...
 
void cacheValidatorFile (lock_guard const &lock, PublicKey const &pubKey) const
 Write a JSON UNL to a cache file. More...
 
ListDisposition verify (lock_guard const &, Json::Value &list, PublicKey &pubKey, std::string const &manifest, std::string const &blob, std::string const &signature)
 Check response for trusted valid published list. More...
 
bool removePublisherList (lock_guard const &, PublicKey const &publisherKey, PublisherStatus reason)
 Stop trusting publisher's list of keys. More...
 
std::size_t calculateQuorum (std::size_t unlSize, std::size_t effectiveUnlSize, std::size_t seenSize)
 Return quorum for trusted validator set. More...
 

Static Private Member Functions

static void buildBlobInfos (std::map< std::size_t, ValidatorBlobInfo > &blobInfos, PublisherListCollection const &lists)
 
static std::map< std::size_t, ValidatorBlobInfobuildBlobInfos (PublisherListCollection const &lists)
 
static void broadcastBlobs (PublicKey const &publisherKey, PublisherListCollection const &lists, std::size_t maxSequence, uint256 const &hash, Overlay &overlay, HashRouter &hashRouter, beast::Journal j)
 
static void sendValidatorList (Peer &peer, std::uint64_t peerSequence, PublicKey const &publisherKey, std::size_t maxSequence, std::uint32_t rawVersion, std::string const &rawManifest, std::map< std::size_t, ValidatorBlobInfo > const &blobInfos, std::vector< MessageWithHash > &messages, HashRouter &hashRouter, beast::Journal j)
 
static Json::Value buildFileData (std::string const &pubKey, PublisherListCollection const &pubCollection, beast::Journal j)
 Build a Json representation of the collection, suitable for writing to a cache file, or serving to a /vl/ query. More...
 
static Json::Value buildFileData (std::string const &pubKey, PublisherListCollection const &pubCollection, std::optional< std::uint32_t > forceVersion, beast::Journal j)
 Build a Json representation of the collection, suitable for writing to a cache file, or serving to a /vl/ query. More...
 

Private Attributes

ManifestCachevalidatorManifests_
 
ManifestCachepublisherManifests_
 
TimeKeepertimeKeeper_
 
const boost::filesystem::path dataPath_
 
const beast::Journal j_
 
boost::shared_mutex mutex_
 
std::atomic< std::size_tquorum_
 
std::optional< std::size_tminimumQuorum_
 
hash_map< PublicKey, PublisherListCollectionpublisherLists_
 
hash_map< PublicKey, std::size_tkeyListings_
 
hash_set< PublicKeytrustedMasterKeys_
 
hash_set< PublicKeytrustedSigningKeys_
 
PublicKey localPubKey_
 
hash_set< PublicKeynegativeUNL_
 

Static Private Attributes

static constexpr std::uint32_t supportedListVersions [] {1, 2}
 
static constexpr std::size_t maxSupportedBlobs = 5
 
static const std::string filePrefix_ = "cache."
 

Friends

template<class Hasher >
void hash_append (Hasher &h, PublisherListCollection pl)
 

Detailed Description

Trusted Validators List

Rippled accepts ledger proposals and validations from trusted validator nodes. A ledger is considered fully-validated once the number of received trusted validations for a ledger meets or exceeds a quorum value.

This class manages the set of validation public keys the local rippled node trusts. The list of trusted keys is populated using the keys listed in the configuration file as well as lists signed by trusted publishers. The trusted publisher public keys are specified in the config.

New lists are expected to include the following data:

Individual validator lists are stored separately by publisher. The number of lists on which a validator's public key appears is also tracked.

The list of trusted validation public keys is reset at the start of each consensus round to take into account the latest known lists as well as the set of validators from whom validations are being received. Listed validation public keys are shuffled and then sorted by the number of lists they appear on. (The shuffling makes the order/rank of validators with the same number of listings non-deterministic.) A quorum value is calculated for the new trusted validator list. If there is only one list, all listed keys are trusted. Otherwise, the trusted list size is set to 125% of the quorum.

Definition at line 172 of file ValidatorList.h.

Member Typedef Documentation

◆ lock_guard

Definition at line 230 of file ValidatorList.h.

◆ shared_lock

Definition at line 231 of file ValidatorList.h.

◆ QuorumKeys

Definition at line 652 of file ValidatorList.h.

Constructor & Destructor Documentation

◆ ValidatorList()

ripple::ValidatorList::ValidatorList ( ManifestCache validatorManifests,
ManifestCache publisherManifests,
TimeKeeper timeKeeper,
std::string const &  databasePath,
beast::Journal  j,
std::optional< std::size_t minimumQuorum = std::nullopt 
)

Definition at line 118 of file ValidatorList.cpp.

◆ ~ValidatorList()

ripple::ValidatorList::~ValidatorList ( )
default

Member Function Documentation

◆ load()

bool ripple::ValidatorList::load ( PublicKey const &  localSigningKey,
std::vector< std::string > const &  configKeys,
std::vector< std::string > const &  publisherKeys 
)

Load configured trusted keys.

Parameters
localSigningKeyThis node's validation public key
configKeysList of trusted keys from config. Each entry consists of a base58 encoded validation public key, optionally followed by a comment.
publisherKeysList of trusted publisher public keys. Each entry contains a base58 encoded account public key.
Thread Safety

May be called concurrently

Returns
false if an entry is invalid or unparsable

Definition at line 136 of file ValidatorList.cpp.

◆ parseBlobs() [1/3]

std::vector< ValidatorBlobInfo > ripple::ValidatorList::parseBlobs ( std::uint32_t  version,
Json::Value const &  body 
)
static

Pull the blob/signature/manifest information out of the appropriate Json body fields depending on the version.

Returns
An empty vector indicates malformed Json.

Definition at line 362 of file ValidatorList.cpp.

◆ parseBlobs() [2/3]

std::vector< ValidatorBlobInfo > ripple::ValidatorList::parseBlobs ( protocol::TMValidatorList const &  body)
static

Definition at line 420 of file ValidatorList.cpp.

◆ parseBlobs() [3/3]

std::vector< ValidatorBlobInfo > ripple::ValidatorList::parseBlobs ( protocol::TMValidatorListCollection const &  body)
static

Definition at line 427 of file ValidatorList.cpp.

◆ sendValidatorList() [1/2]

void ripple::ValidatorList::sendValidatorList ( Peer peer,
std::uint64_t  peerSequence,
PublicKey const &  publisherKey,
std::size_t  maxSequence,
std::uint32_t  rawVersion,
std::string const &  rawManifest,
std::map< std::size_t, ValidatorBlobInfo > const &  blobInfos,
HashRouter hashRouter,
beast::Journal  j 
)
static

Definition at line 749 of file ValidatorList.cpp.

◆ buildValidatorListMessages()

std::pair< std::size_t, std::size_t > ripple::ValidatorList::buildValidatorListMessages ( std::size_t  messageVersion,
std::uint64_t  peerSequence,
std::size_t  maxSequence,
std::uint32_t  rawVersion,
std::string const &  rawManifest,
std::map< std::size_t, ValidatorBlobInfo > const &  blobInfos,
std::vector< MessageWithHash > &  messages,
std::size_t  maxSize = maximiumMessageSize 
)
static

Definition at line 612 of file ValidatorList.cpp.

◆ applyListsAndBroadcast()

ValidatorList::PublisherListStats ripple::ValidatorList::applyListsAndBroadcast ( std::string const &  manifest,
std::uint32_t  version,
std::vector< ValidatorBlobInfo > const &  blobs,
std::string  siteUri,
uint256 const &  hash,
Overlay overlay,
HashRouter hashRouter,
NetworkOPs networkOPs 
)

Apply multiple published lists of public keys, then broadcast it to all peers that have not seen it or sent it.

Parameters
manifestbase64-encoded publisher key manifest
versionVersion of published list format
blobsVector of BlobInfos representing one or more encoded validator lists and signatures (and optional manifests)
siteUriUri of the site from which the list was validated
hashHash of the data parameters
overlayOverlay object which will handle sending the message
hashRouterHashRouter object which will determine which peers not to send to
networkOPsNetworkOPs object which will be informed if there is a valid VL
Returns
ListDisposition::accepted, plus some of the publisher information, if list was successfully applied
Thread Safety

May be called concurrently

Definition at line 869 of file ValidatorList.cpp.

◆ applyLists()

ValidatorList::PublisherListStats ripple::ValidatorList::applyLists ( std::string const &  manifest,
std::uint32_t  version,
std::vector< ValidatorBlobInfo > const &  blobs,
std::string  siteUri,
std::optional< uint256 > const &  hash = {} 
)

Apply multiple published lists of public keys.

Parameters
manifestbase64-encoded publisher key manifest
versionVersion of published list format
blobsVector of BlobInfos representing one or more encoded validator lists and signatures (and optional manifests)
siteUriUri of the site from which the list was validated
hashOptional hash of the data parameters
Returns
ListDisposition::accepted, plus some of the publisher information, if list was successfully applied
Thread Safety

May be called concurrently

Definition at line 922 of file ValidatorList.cpp.

◆ loadLists()

std::vector< std::string > ripple::ValidatorList::loadLists ( )

Definition at line 1206 of file ValidatorList.cpp.

◆ updateTrusted()

TrustChanges ripple::ValidatorList::updateTrusted ( hash_set< NodeID > const &  seenValidators,
NetClock::time_point  closeTime,
NetworkOPs ops,
Overlay overlay,
HashRouter hashRouter 
)

Update trusted nodes.

Reset the trusted nodes based on latest manifests, received validations, and lists.

Parameters
seenValidatorsSet of NodeIDs of validators that have signed recently received validations
Returns
TrustedKeyChanges instance with newly trusted or untrusted node identities.
Thread Safety

May be called concurrently

Definition at line 1769 of file ValidatorList.cpp.

◆ quorum()

std::size_t ripple::ValidatorList::quorum ( ) const

Get quorum value for current trusted key set.

The quorum is the minimum number of validations needed for a ledger to be fully validated. It can change when the set of trusted validation keys is updated (at the start of each consensus round) and primarily depends on the number of trusted keys.

Thread Safety

May be called concurrently

Returns
quorum value

Definition at line 492 of file ValidatorList.h.

◆ trusted() [1/2]

bool ripple::ValidatorList::trusted ( PublicKey const &  identity) const

Returns true if public key is trusted.

Parameters
identityValidation public key
Thread Safety

May be called concurrently

Definition at line 1367 of file ValidatorList.cpp.

◆ listed()

bool ripple::ValidatorList::listed ( PublicKey const &  identity) const

Returns true if public key is included on any lists.

Parameters
identityValidation public key
Thread Safety

May be called concurrently

Definition at line 1349 of file ValidatorList.cpp.

◆ getTrustedKey() [1/2]

std::optional< PublicKey > ripple::ValidatorList::getTrustedKey ( PublicKey const &  identity) const

Returns master public key if public key is trusted.

Parameters
identityValidation public key
Returns
std::nullopt if key is not trusted
Thread Safety

May be called concurrently

Definition at line 1396 of file ValidatorList.cpp.

◆ getListedKey()

std::optional< PublicKey > ripple::ValidatorList::getListedKey ( PublicKey const &  identity) const

Returns listed master public if public key is included on any lists.

Parameters
identityValidation public key
Returns
std::nullopt if key is not listed
Thread Safety

May be called concurrently

Definition at line 1374 of file ValidatorList.cpp.

◆ trustedPublisher()

bool ripple::ValidatorList::trustedPublisher ( PublicKey const &  identity) const

Returns true if public key is a trusted publisher.

Parameters
identityPublisher public key
Thread Safety

May be called concurrently

Definition at line 1404 of file ValidatorList.cpp.

◆ localPublicKey()

PublicKey ripple::ValidatorList::localPublicKey ( ) const

Returns local validator public key.

Thread Safety

May be called concurrently

Definition at line 1412 of file ValidatorList.cpp.

◆ for_each_listed()

void ripple::ValidatorList::for_each_listed ( std::function< void(PublicKey const &, bool)>  func) const

Invokes the callback once for every listed validation public key.

Note
Undefined behavior results when calling ValidatorList members from within the callback

The arguments passed into the lambda are:

  • The validation public key
  • A boolean indicating whether this is a trusted key
Thread Safety

May be called concurrently

Definition at line 1641 of file ValidatorList.cpp.

◆ for_each_available()

void ripple::ValidatorList::for_each_available ( std::function< void(std::string const &manifest, std::uint32_t version, std::map< std::size_t, ValidatorBlobInfo > const &blobInfos, PublicKey const &pubKey, std::size_t maxSequence, uint256 const &hash)>  func) const

Invokes the callback once for every available publisher list's raw data members.

Note
Undefined behavior results when calling ValidatorList members from within the callback

The arguments passed into the lambda are:

  • The raw manifest string
  • The raw "blob" string containing the values for the validator list
  • The signature string used to sign the blob
  • The version number
  • The PublicKey of the blob signer (matches the value from [validator_list_keys])
  • The sequence number of the "blob"
  • The precomputed hash of the original / raw elements
Thread Safety

May be called concurrently

Definition at line 1651 of file ValidatorList.cpp.

◆ getAvailable()

std::optional< Json::Value > ripple::ValidatorList::getAvailable ( boost::beast::string_view const &  pubKey,
std::optional< std::uint32_t forceVersion = {} 
)

Returns the current valid list for the given publisher key, if available, as a Json object.

Definition at line 1678 of file ValidatorList.cpp.

◆ count() [1/2]

std::size_t ripple::ValidatorList::count ( ) const

Return the number of configured validator list sites.

Definition at line 1459 of file ValidatorList.cpp.

◆ expires() [1/2]

std::optional< TimeKeeper::time_point > ripple::ValidatorList::expires ( ) const

Return the time when the validator list will expire.

Note
This may be a time in the past if a published list has not been updated since its validUntil. It will be std::nullopt if any configured published list has not been fetched.
Thread Safety
May be called concurrently

Definition at line 1500 of file ValidatorList.cpp.

◆ getJson()

Json::Value ripple::ValidatorList::getJson ( ) const

Return a JSON representation of the state of the validator list.

Thread Safety
May be called concurrently

Definition at line 1507 of file ValidatorList.cpp.

◆ getQuorumKeys()

QuorumKeys ripple::ValidatorList::getQuorumKeys ( ) const

Get the quorum and all of the trusted keys.

Returns
quorum and keys.

Definition at line 658 of file ValidatorList.h.

◆ getTrustedMasterKeys()

hash_set< PublicKey > ripple::ValidatorList::getTrustedMasterKeys ( ) const

get the trusted master public keys

Returns
the public keys

Definition at line 1933 of file ValidatorList.cpp.

◆ getNegativeUNL()

hash_set< PublicKey > ripple::ValidatorList::getNegativeUNL ( ) const

get the master public keys of Negative UNL validators

Returns
the master public keys

Definition at line 1940 of file ValidatorList.cpp.

◆ setNegativeUNL()

void ripple::ValidatorList::setNegativeUNL ( hash_set< PublicKey > const &  negUnl)

set the Negative UNL with validators' master public keys

Parameters
negUnlthe public keys

Definition at line 1947 of file ValidatorList.cpp.

◆ negativeUNLFilter()

std::vector< std::shared_ptr< STValidation > > ripple::ValidatorList::negativeUNLFilter ( std::vector< std::shared_ptr< STValidation >> &&  validations) const

Remove validations that are from validators on the negative UNL.

Parameters
validationsthe validations to filter
Returns
a filtered copy of the validations

Definition at line 1954 of file ValidatorList.cpp.

◆ count() [2/2]

std::size_t ripple::ValidatorList::count ( ValidatorList::shared_lock const &  ) const
private

Return the number of configured validator list sites.

Definition at line 1453 of file ValidatorList.cpp.

◆ trusted() [2/2]

bool ripple::ValidatorList::trusted ( ValidatorList::shared_lock const &  ,
PublicKey const &  identity 
) const
private

Returns true if public key is trusted.

Parameters
identityValidation public key
Thread Safety

May be called concurrently

Definition at line 1358 of file ValidatorList.cpp.

◆ getTrustedKey() [2/2]

std::optional< PublicKey > ripple::ValidatorList::getTrustedKey ( ValidatorList::shared_lock const &  ,
PublicKey const &  identity 
) const
private

Returns master public key if public key is trusted.

Parameters
identityValidation public key
Returns
std::nullopt if key is not trusted
Thread Safety

May be called concurrently

Definition at line 1385 of file ValidatorList.cpp.

◆ expires() [2/2]

std::optional< TimeKeeper::time_point > ripple::ValidatorList::expires ( ValidatorList::shared_lock const &  ) const
private

Return the time when the validator list will expire.

Note
This may be a time in the past if a published list has not been updated since its expiration. It will be std::nullopt if any configured published list has not been fetched.
Thread Safety
May be called concurrently

Definition at line 1466 of file ValidatorList.cpp.

◆ applyList()

ValidatorList::PublisherListStats ripple::ValidatorList::applyList ( std::string const &  globalManifest,
std::optional< std::string > const &  localManifest,
std::string const &  blob,
std::string const &  signature,
std::uint32_t  version,
std::string  siteUri,
std::optional< uint256 > const &  hash,
ValidatorList::lock_guard const &  lock 
)
private

Apply published list of public keys.

Parameters
manifestbase64-encoded publisher key manifest
blobbase64-encoded json containing published validator list
signatureSignature of the decoded blob
versionVersion of published list format
siteUriUri of the site from which the list was validated
hashOptional hash of the data parameters. Defaults to uninitialized
Returns
ListDisposition::accepted, plus some of the publisher information, if list was successfully applied
Thread Safety

May be called concurrently

Definition at line 1060 of file ValidatorList.cpp.

◆ updatePublisherList()

void ripple::ValidatorList::updatePublisherList ( PublicKey const &  pubKey,
PublisherList const &  current,
std::vector< PublicKey > const &  oldList,
ValidatorList::lock_guard const &   
)
private

Definition at line 996 of file ValidatorList.cpp.

◆ buildBlobInfos() [1/2]

void ripple::ValidatorList::buildBlobInfos ( std::map< std::size_t, ValidatorBlobInfo > &  blobInfos,
ValidatorList::PublisherListCollection const &  lists 
)
staticprivate

Definition at line 776 of file ValidatorList.cpp.

◆ buildBlobInfos() [2/2]

std::map< std::size_t, ValidatorBlobInfo > ripple::ValidatorList::buildBlobInfos ( ValidatorList::PublisherListCollection const &  lists)
staticprivate

Definition at line 792 of file ValidatorList.cpp.

◆ broadcastBlobs()

void ripple::ValidatorList::broadcastBlobs ( PublicKey const &  publisherKey,
ValidatorList::PublisherListCollection const &  lists,
std::size_t  maxSequence,
uint256 const &  hash,
Overlay overlay,
HashRouter hashRouter,
beast::Journal  j 
)
staticprivate

Definition at line 802 of file ValidatorList.cpp.

◆ sendValidatorList() [2/2]

void ripple::ValidatorList::sendValidatorList ( Peer peer,
std::uint64_t  peerSequence,
PublicKey const &  publisherKey,
std::size_t  maxSequence,
std::uint32_t  rawVersion,
std::string const &  rawManifest,
std::map< std::size_t, ValidatorBlobInfo > const &  blobInfos,
std::vector< MessageWithHash > &  messages,
HashRouter hashRouter,
beast::Journal  j 
)
staticprivate

Definition at line 677 of file ValidatorList.cpp.

◆ getCacheFileName()

boost::filesystem::path ripple::ValidatorList::getCacheFileName ( ValidatorList::lock_guard const &  ,
PublicKey const &  pubKey 
) const
private

Get the filename used for caching UNLs.

Definition at line 250 of file ValidatorList.cpp.

◆ buildFileData() [1/2]

Json::Value ripple::ValidatorList::buildFileData ( std::string const &  pubKey,
ValidatorList::PublisherListCollection const &  pubCollection,
beast::Journal  j 
)
staticprivate

Build a Json representation of the collection, suitable for writing to a cache file, or serving to a /vl/ query.

Definition at line 259 of file ValidatorList.cpp.

◆ buildFileData() [2/2]

Json::Value ripple::ValidatorList::buildFileData ( std::string const &  pubKey,
ValidatorList::PublisherListCollection const &  pubCollection,
std::optional< std::uint32_t forceVersion,
beast::Journal  j 
)
staticprivate

Build a Json representation of the collection, suitable for writing to a cache file, or serving to a /vl/ query.

Definition at line 269 of file ValidatorList.cpp.

◆ cacheValidatorFile()

void ripple::ValidatorList::cacheValidatorFile ( ValidatorList::lock_guard const &  lock,
PublicKey const &  pubKey 
) const
private

Write a JSON UNL to a cache file.

Definition at line 331 of file ValidatorList.cpp.

◆ verify()

ListDisposition ripple::ValidatorList::verify ( ValidatorList::lock_guard const &  lock,
Json::Value list,
PublicKey pubKey,
std::string const &  manifest,
std::string const &  blob,
std::string const &  signature 
)
private

Check response for trusted valid published list.

Returns
ListDisposition::accepted if list can be applied
Thread Safety

Calling public member function is expected to lock mutex

Definition at line 1259 of file ValidatorList.cpp.

◆ removePublisherList()

bool ripple::ValidatorList::removePublisherList ( ValidatorList::lock_guard const &  ,
PublicKey const &  publisherKey,
PublisherStatus  reason 
)
private

Stop trusting publisher's list of keys.

Parameters
publisherKeyPublisher public key
Returns
false if key was not trusted
Thread Safety

Calling public member function is expected to lock mutex

Definition at line 1419 of file ValidatorList.cpp.

◆ calculateQuorum()

std::size_t ripple::ValidatorList::calculateQuorum ( std::size_t  unlSize,
std::size_t  effectiveUnlSize,
std::size_t  seenSize 
)
private

Return quorum for trusted validator set.

Parameters
unlSizeNumber of trusted validator keys
effectiveUnlSizeNumber of trusted validator keys that are not in the NegativeUNL
seenSizeNumber of trusted validators that have signed recently received validations

Definition at line 1708 of file ValidatorList.cpp.

Friends And Related Function Documentation

◆ hash_append

template<class Hasher >
void hash_append ( Hasher &  h,
PublisherListCollection  pl 
)
friend

Definition at line 833 of file ValidatorList.h.

Member Data Documentation

◆ validatorManifests_

ManifestCache& ripple::ValidatorList::validatorManifests_
private

Definition at line 224 of file ValidatorList.h.

◆ publisherManifests_

ManifestCache& ripple::ValidatorList::publisherManifests_
private

Definition at line 225 of file ValidatorList.h.

◆ timeKeeper_

TimeKeeper& ripple::ValidatorList::timeKeeper_
private

Definition at line 226 of file ValidatorList.h.

◆ dataPath_

const boost::filesystem::path ripple::ValidatorList::dataPath_
private

Definition at line 227 of file ValidatorList.h.

◆ j_

const beast::Journal ripple::ValidatorList::j_
private

Definition at line 228 of file ValidatorList.h.

◆ mutex_

boost::shared_mutex ripple::ValidatorList::mutex_
mutableprivate

Definition at line 229 of file ValidatorList.h.

◆ quorum_

std::atomic<std::size_t> ripple::ValidatorList::quorum_
private

Definition at line 233 of file ValidatorList.h.

◆ minimumQuorum_

std::optional<std::size_t> ripple::ValidatorList::minimumQuorum_
private

Definition at line 234 of file ValidatorList.h.

◆ publisherLists_

hash_map<PublicKey, PublisherListCollection> ripple::ValidatorList::publisherLists_
private

Definition at line 237 of file ValidatorList.h.

◆ keyListings_

hash_map<PublicKey, std::size_t> ripple::ValidatorList::keyListings_
private

Definition at line 240 of file ValidatorList.h.

◆ trustedMasterKeys_

hash_set<PublicKey> ripple::ValidatorList::trustedMasterKeys_
private

Definition at line 243 of file ValidatorList.h.

◆ trustedSigningKeys_

hash_set<PublicKey> ripple::ValidatorList::trustedSigningKeys_
private

Definition at line 248 of file ValidatorList.h.

◆ localPubKey_

PublicKey ripple::ValidatorList::localPubKey_
private

Definition at line 250 of file ValidatorList.h.

◆ negativeUNL_

hash_set<PublicKey> ripple::ValidatorList::negativeUNL_
private

Definition at line 253 of file ValidatorList.h.

◆ supportedListVersions

constexpr std::uint32_t ripple::ValidatorList::supportedListVersions[] {1, 2}
staticconstexprprivate

Definition at line 256 of file ValidatorList.h.

◆ maxSupportedBlobs

constexpr std::size_t ripple::ValidatorList::maxSupportedBlobs = 5
staticconstexprprivate

Definition at line 259 of file ValidatorList.h.

◆ filePrefix_

const std::string ripple::ValidatorList::filePrefix_ = "cache."
staticprivate

Definition at line 261 of file ValidatorList.h.