20 #ifndef RIPPLE_APP_MISC_VALIDATORLIST_H_INCLUDED
21 #define RIPPLE_APP_MISC_VALIDATORLIST_H_INCLUDED
23 #include <ripple/app/misc/Manifest.h>
24 #include <ripple/basics/Log.h>
25 #include <ripple/basics/UnorderedContainers.h>
26 #include <ripple/core/TimeKeeper.h>
27 #include <ripple/crypto/csprng.h>
28 #include <ripple/json/json_value.h>
29 #include <ripple/protocol/PublicKey.h>
30 #include <boost/iterator/counting_iterator.hpp>
31 #include <boost/range/adaptors.hpp>
32 #include <boost/thread/shared_mutex.hpp>
180 boost::optional<std::size_t> minimumQuorum = boost::none);
299 boost::optional<uint256>
const& hash = {});
382 boost::optional<PublicKey>
395 boost::optional<PublicKey>
471 uint256 const& hash)> func)
const;
476 boost::optional<Json::Value>
492 boost::optional<TimeKeeper::time_point>
572 boost::optional<PublicKey>
584 boost::optional<TimeKeeper::time_point>
589 boost::filesystem::path
598 PublisherList
const& publisher);
boost::optional< PublicKey > getListedKey(PublicKey const &identity) const
Returns listed master public if public key is included on any lists.
ManifestCache & validatorManifests_
void for_each_listed(std::function< void(PublicKey const &, bool)> func) const
Invokes the callback once for every listed validation public key.
PublicKey localPublicKey() const
Returns local validator public key.
ListDisposition disposition
Changes in trusted nodes after updating validator list.
@ stale
Trusted publisher key, but seq is too old.
hash_map< PublicKey, PublisherList > publisherLists_
PublisherListStats(ListDisposition d, PublicKey key, bool avail, std::size_t seq)
boost::optional< Json::Value > getAvailable(boost::beast::string_view const &pubKey)
Returns the current valid list for the given publisher key, if available, as a Json object.
bool trustedPublisher(PublicKey const &identity) const
Returns true if public key is a trusted publisher.
void setNegativeUNL(hash_set< PublicKey > const &negUnl)
set the Negative UNL with validators' master public keys
QuorumKeys getQuorumKeys() const
Get the quorum and all of the trusted keys.
Describes the result of processing a Validator List (UNL), including some of the information from the...
hash_set< PublicKey > negativeUNL_
static const std::string filePrefix_
TrustChanges updateTrusted(hash_set< NodeID > const &seenValidators)
Update trusted nodes.
hash_set< PublicKey > getTrustedMasterKeys() const
get the trusted master public keys
TimeKeeper::time_point expiration
std::string to_string(ListDisposition disposition)
Routing table for objects identified by hash.
ValidatorList(ManifestCache &validatorManifests, ManifestCache &publisherManifests, TimeKeeper &timeKeeper, std::string const &databasePath, beast::Journal j, boost::optional< std::size_t > minimumQuorum=boost::none)
boost::optional< PublicKey > getTrustedKey(PublicKey const &identity) const
Returns master public key if public key is trusted.
boost::optional< PublicKey > publisherKey
bool removePublisherList(unique_lock const &, PublicKey const &publisherKey)
Stop trusting publisher's list of keys.
const boost::filesystem::path dataPath_
void CacheValidatorFile(unique_lock const &lock, PublicKey const &pubKey, PublisherList const &publisher)
Write a JSON UNL to a cache file.
PublisherListStats applyList(std::string const &manifest, std::string const &blob, std::string const &signature, std::uint32_t version, std::string siteUri, boost::optional< uint256 > const &hash={})
Apply published list of public keys.
std::vector< PublicKey > list
std::shared_lock< boost::shared_mutex > shared_lock
hash_set< NodeID > removed
boost::optional< std::size_t > minimumQuorum_
ManifestCache & publisherManifests_
bool listed(PublicKey const &identity) const
Returns true if public key is included on any lists.
@ untrusted
List signed by untrusted publisher key.
A generic endpoint for log messages.
static constexpr std::uint32_t requiredListVersion
PublisherListStats applyListAndBroadcast(std::string const &manifest, std::string const &blob, std::string const &signature, std::uint32_t version, std::string siteUri, uint256 const &hash, Overlay &overlay, HashRouter &hashRouter)
Apply published list of public keys, then broadcast it to all peers that have not seen it or sent it.
Manages various times used by the server.
@ unsupported_version
List version is not supported.
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.
PublisherListStats(ListDisposition d)
std::size_t calculateQuorum(std::size_t unlSize, std::size_t effectiveUnlSize, std::size_t seenSize)
Return quorum for trusted validator set.
Remembers manifests with the highest sequence number.
std::vector< std::string > loadLists()
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
hash_set< PublicKey > trustedSigningKeys_
bool load(PublicKey const &localSigningKey, std::vector< std::string > const &configKeys, std::vector< std::string > const &publisherKeys)
Load configured trusted keys.
void for_each_available(std::function< void(std::string const &manifest, std::string const &blob, std::string const &signature, std::uint32_t version, PublicKey const &pubKey, std::size_t sequence, uint256 const &hash)> func) const
Invokes the callback once for every available publisher list's raw data members.
std::unique_lock< boost::shared_mutex > unique_lock
Manages the set of connected peers.
@ same_sequence
Same sequence as current list.
boost::optional< std::size_t > sequence
@ invalid
Invalid format or signature.
boost::shared_mutex mutex_
Json::Value getJson() const
Return a JSON representation of the state of the validator list.
boost::optional< TimeKeeper::time_point > expires() const
Return the time when the validator list will expire.
bool trusted(PublicKey const &identity) const
Returns true if public key is trusted.
boost::filesystem::path GetCacheFileName(unique_lock const &, PublicKey const &pubKey)
Get the filename used for caching UNLs.
hash_set< PublicKey > trustedMasterKeys_
hash_set< PublicKey > getNegativeUNL() const
get the master public keys of Negative UNL validators
std::size_t count() const
Return the number of configured validator list sites.
typename NetClock ::time_point time_point
ListDisposition verify(unique_lock 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.
hash_map< PublicKey, std::size_t > keyListings_
std::atomic< std::size_t > quorum_
std::size_t quorum() const
Get quorum value for current trusted key set.