rippled
ValidatorList.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2015 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #ifndef RIPPLE_APP_MISC_VALIDATORLIST_H_INCLUDED
21 #define RIPPLE_APP_MISC_VALIDATORLIST_H_INCLUDED
22 
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/overlay/Message.h>
30 #include <ripple/protocol/PublicKey.h>
31 #include <boost/iterator/counting_iterator.hpp>
32 #include <boost/range/adaptors.hpp>
33 #include <boost/thread/shared_mutex.hpp>
34 #include <mutex>
35 #include <numeric>
36 #include <shared_mutex>
37 
38 namespace protocol {
39 class TMValidatorList;
40 class TMValidatorListCollection;
41 } // namespace protocol
42 
43 namespace ripple {
44 
45 class Overlay;
46 class HashRouter;
47 class Message;
48 class NetworkOPs;
49 class Peer;
50 class STValidation;
51 
52 /* Entries in this enum are ordered by "desirability".
53  The "better" dispositions have lower values than the
54  "worse" dispositions */
55 enum class ListDisposition {
57  accepted = 0,
58 
60  expired,
61 
63  pending,
64 
67 
70 
72  stale,
73 
75  untrusted,
76 
79 
81  invalid
82 };
83 
84 /* Entries in this enum are ordered by "desirability".
85  The "better" dispositions have lower values than the
86  "worse" dispositions */
87 enum class PublisherStatus {
88  // Publisher has provided a valid file
89  available = 0,
90 
91  // Current list is expired without replacement
92  expired,
93 
94  // No file seen yet
96 
97  // Publisher has revoked their manifest key
98  revoked,
99 
100 };
101 
103 to_string(ListDisposition disposition);
104 
108 {
109  explicit TrustChanges() = default;
110 
113 };
114 
117 {
118  // base-64 encoded JSON containing the validator list.
120  // hex-encoded signature of the blob using the publisher's signing key
122  // base-64 or hex-encoded manifest containing the publisher's master and
123  // signing public keys
125 };
126 
173 {
175  {
176  explicit PublisherList() = default;
177 
184  // base-64 encoded JSON containing the validator list.
186  // hex-encoded signature of the blob using the publisher's signing key
188  // base-64 or hex-encoded manifest containing the publisher's master and
189  // signing public keys
192  };
193 
195  {
197  /*
198  The `current` VL is the one which
199  1. Has the largest sequence number that
200  2. Has ever been effective (the effective date is absent or in the
201  past).
202  If this VL has expired, all VLs with previous sequence numbers
203  will also be considered expired, and thus there will be no valid VL
204  until one with a larger sequence number becomes effective. This is to
205  prevent allowing old VLs to reactivate.
206  */
208  /*
209  The `remaining` list holds any relevant VLs which have a larger sequence
210  number than current. By definition they will all have an effective date
211  in the future. Relevancy will be determined by sorting the VLs by
212  sequence number, then iterating over the list and removing any VLs for
213  which the following VL (ignoring gaps) has the same or earlier effective
214  date.
215  */
218  // The hash of the full set if sent in a single message
222  };
223 
227  boost::filesystem::path const dataPath_;
229  boost::shared_mutex mutable mutex_;
230  using lock_guard = std::lock_guard<decltype(mutex_)>;
231  using shared_lock = std::shared_lock<decltype(mutex_)>;
232 
235 
236  // Published lists stored by publisher master public key
238 
239  // Listed master public keys with the number of lists they appear on
241 
242  // The current list of trusted master keys
244 
245  // The current list of trusted signing keys. For those validators using
246  // a manifest, the signing key is the ephemeral key. For the ones using
247  // a seed, the signing key is the same as the master key.
249 
251 
252  // The master public keys of the current negative UNL
254 
255  // Currently supported versions of publisher list format
256  static constexpr std::uint32_t supportedListVersions[]{1, 2};
257  // In the initial release, to prevent potential abuse and attacks, any VL
258  // collection with more than 5 entries will be considered malformed.
259  static constexpr std::size_t maxSupportedBlobs = 5;
260  // Prefix of the file name used to store cache files.
261  static const std::string filePrefix_;
262 
263 public:
265  ManifestCache& validatorManifests,
266  ManifestCache& publisherManifests,
267  TimeKeeper& timeKeeper,
268  std::string const& databasePath,
269  beast::Journal j,
270  std::optional<std::size_t> minimumQuorum = std::nullopt);
271  ~ValidatorList() = default;
272 
279  {
280  explicit PublisherListStats() = default;
283  ListDisposition d,
284  PublicKey key,
285  PublisherStatus stat,
286  std::size_t seq);
287 
289  bestDisposition() const;
291  worstDisposition() const;
292  void
294 
295  // Tracks the dispositions of each processed list and how many times it
296  // occurred
301  };
302 
304  {
305  explicit MessageWithHash() = default;
306  explicit MessageWithHash(
307  std::shared_ptr<Message> const& message_,
308  uint256 hash_,
309  std::size_t num_);
313  };
314 
332  bool
333  load(
334  PublicKey const& localSigningKey,
335  std::vector<std::string> const& configKeys,
336  std::vector<std::string> const& publisherKeys);
337 
344  parseBlobs(std::uint32_t version, Json::Value const& body);
345 
347  parseBlobs(protocol::TMValidatorList const& body);
348 
350  parseBlobs(protocol::TMValidatorListCollection const& body);
351 
352  static void
354  Peer& peer,
355  std::uint64_t peerSequence,
356  PublicKey const& publisherKey,
357  std::size_t maxSequence,
358  std::uint32_t rawVersion,
359  std::string const& rawManifest,
361  HashRouter& hashRouter,
362  beast::Journal j);
363 
364  [[nodiscard]] static std::pair<std::size_t, std::size_t>
366  std::size_t messageVersion,
367  std::uint64_t peerSequence,
368  std::size_t maxSequence,
369  std::uint32_t rawVersion,
370  std::string const& rawManifest,
373  std::size_t maxSize = maximiumMessageSize);
374 
406  std::string const& manifest,
407  std::uint32_t version,
408  std::vector<ValidatorBlobInfo> const& blobs,
409  std::string siteUri,
410  uint256 const& hash,
411  Overlay& overlay,
412  HashRouter& hashRouter,
413  NetworkOPs& networkOPs);
414 
436  applyLists(
437  std::string const& manifest,
438  std::uint32_t version,
439  std::vector<ValidatorBlobInfo> const& blobs,
440  std::string siteUri,
441  std::optional<uint256> const& hash = {});
442 
443  /* Attempt to read previously stored list files. Expected to only be
444  called when loading from URL fails.
445 
446  @return A list of valid file:// URLs, if any.
447 
448  @par Thread Safety
449 
450  May be called concurrently
451  */
453  loadLists();
454 
472  hash_set<NodeID> const& seenValidators,
473  NetClock::time_point closeTime,
474  NetworkOPs& ops,
475  Overlay& overlay,
476  HashRouter& hashRouter);
477 
492  quorum() const
493  {
494  return quorum_;
495  }
496 
505  bool
506  trusted(PublicKey const& identity) const;
507 
516  bool
517  listed(PublicKey const& identity) const;
518 
530  getTrustedKey(PublicKey const& identity) const;
531 
543  getListedKey(PublicKey const& identity) const;
544 
553  bool
554  trustedPublisher(PublicKey const& identity) const;
555 
562  PublicKey
563  localPublicKey() const;
564 
580  void
581  for_each_listed(std::function<void(PublicKey const&, bool)> func) const;
582 
610  void
612  std::function<void(
613  std::string const& manifest,
614  std::uint32_t version,
616  PublicKey const& pubKey,
617  std::size_t maxSequence,
618  uint256 const& hash)> func) const;
619 
624  getAvailable(
625  boost::beast::string_view const& pubKey,
626  std::optional<std::uint32_t> forceVersion = {});
627 
630  count() const;
631 
642  expires() const;
643 
650  getJson() const;
651 
657  QuorumKeys
659  {
660  shared_lock read_lock{mutex_};
661  return {quorum_, trustedSigningKeys_};
662  }
663 
669  getTrustedMasterKeys() const;
670 
676  getNegativeUNL() const;
677 
682  void
683  setNegativeUNL(hash_set<PublicKey> const& negUnl);
684 
693  std::vector<std::shared_ptr<STValidation>>&& validations) const;
694 
695 private:
698  count(shared_lock const&) const;
699 
708  bool
709  trusted(shared_lock const&, PublicKey const& identity) const;
710 
722  getTrustedKey(shared_lock const&, PublicKey const& identity) const;
723 
734  expires(shared_lock const&) const;
735 
758  PublisherListStats
759  applyList(
760  std::string const& globalManifest,
761  std::optional<std::string> const& localManifest,
762  std::string const& blob,
763  std::string const& signature,
764  std::uint32_t version,
765  std::string siteUri,
766  std::optional<uint256> const& hash,
767  lock_guard const&);
768 
769  void
771  PublicKey const& pubKey,
772  PublisherList const& current,
773  std::vector<PublicKey> const& oldList,
774  lock_guard const&);
775 
776  static void
779  PublisherListCollection const& lists);
780 
782  buildBlobInfos(PublisherListCollection const& lists);
783 
784  static void
786  PublicKey const& publisherKey,
787  PublisherListCollection const& lists,
788  std::size_t maxSequence,
789  uint256 const& hash,
790  Overlay& overlay,
791  HashRouter& hashRouter,
792  beast::Journal j);
793 
794  static void
796  Peer& peer,
797  std::uint64_t peerSequence,
798  PublicKey const& publisherKey,
799  std::size_t maxSequence,
800  std::uint32_t rawVersion,
801  std::string const& rawManifest,
804  HashRouter& hashRouter,
805  beast::Journal j);
806 
809  boost::filesystem::path
810  getCacheFileName(lock_guard const&, PublicKey const& pubKey) const;
811 
815  static Json::Value
817  std::string const& pubKey,
818  PublisherListCollection const& pubCollection,
819  beast::Journal j);
820 
824  static Json::Value
826  std::string const& pubKey,
827  PublisherListCollection const& pubCollection,
828  std::optional<std::uint32_t> forceVersion,
829  beast::Journal j);
830 
831  template <class Hasher>
832  friend void
834  {
835  using beast::hash_append;
837  }
838 
841  void
842  cacheValidatorFile(lock_guard const& lock, PublicKey const& pubKey) const;
843 
853  verify(
854  lock_guard const&,
855  Json::Value& list,
856  PublicKey& pubKey,
857  std::string const& manifest,
858  std::string const& blob,
859  std::string const& signature);
860 
871  bool
873  lock_guard const&,
874  PublicKey const& publisherKey,
875  PublisherStatus reason);
876 
889  std::size_t unlSize,
890  std::size_t effectiveUnlSize,
891  std::size_t seenSize);
892 };
893 
894 // hashing helpers
895 template <class Hasher>
896 void
897 hash_append(Hasher& h, ValidatorBlobInfo const& blobInfo)
898 {
899  using beast::hash_append;
900  hash_append(h, blobInfo.blob, blobInfo.signature);
901  if (blobInfo.manifest)
902  {
903  hash_append(h, *blobInfo.manifest);
904  }
905 }
906 
907 template <class Hasher>
908 void
910 {
911  for (auto const& item : blobs)
912  hash_append(h, item);
913 }
914 
915 template <class Hasher>
916 void
918 {
919  for (auto const& [_, item] : blobs)
920  {
921  (void)_;
922  hash_append(h, item);
923  }
924 }
925 
926 } // namespace ripple
927 
928 namespace protocol {
929 
930 template <class Hasher>
931 void
932 hash_append(Hasher& h, TMValidatorList const& msg)
933 {
934  using beast::hash_append;
935  hash_append(h, msg.manifest(), msg.blob(), msg.signature(), msg.version());
936 }
937 
938 template <class Hasher>
939 void
940 hash_append(Hasher& h, TMValidatorListCollection const& msg)
941 {
942  using beast::hash_append;
943  hash_append(
944  h,
945  msg.manifest(),
947  msg.version());
948 }
949 
950 } // namespace protocol
951 
952 #endif
ripple::NetworkOPs
Provides server functionality for clients.
Definition: NetworkOPs.h:86
ripple::ValidatorList::MessageWithHash::MessageWithHash
MessageWithHash()=default
ripple::ValidatorList::PublisherList::sequence
std::size_t sequence
Definition: ValidatorList.h:180
ripple::ValidatorList::validatorManifests_
ManifestCache & validatorManifests_
Definition: ValidatorList.h:224
ripple::ListDisposition::pending
@ pending
List will be valid in the future.
ripple::ValidatorList::for_each_listed
void for_each_listed(std::function< void(PublicKey const &, bool)> func) const
Invokes the callback once for every listed validation public key.
Definition: ValidatorList.cpp:1641
ripple::ValidatorList::localPublicKey
PublicKey localPublicKey() const
Returns local validator public key.
Definition: ValidatorList.cpp:1412
ripple::ValidatorList::PublisherListStats::PublisherListStats
PublisherListStats()=default
ripple::ValidatorBlobInfo::signature
std::string signature
Definition: ValidatorList.h:121
std::string
STL class.
std::shared_ptr< Message >
ripple::ListDisposition
ListDisposition
Definition: ValidatorList.h:55
ripple::maximiumMessageSize
constexpr std::size_t maximiumMessageSize
Definition: overlay/Message.h:38
ripple::ValidatorList::PublisherList::rawSignature
std::string rawSignature
Definition: ValidatorList.h:187
ripple::ValidatorList::MessageWithHash::message
std::shared_ptr< Message > message
Definition: ValidatorList.h:310
ripple::TrustChanges
Changes in trusted nodes after updating validator list.
Definition: ValidatorList.h:107
ripple::ListDisposition::stale
@ stale
Trusted publisher key, but seq is too old.
std::unordered_set
STL class.
std::pair
ripple::ValidatorList::supportedListVersions
static constexpr std::uint32_t supportedListVersions[]
Definition: ValidatorList.h:256
ripple::ValidatorList::buildBlobInfos
static void buildBlobInfos(std::map< std::size_t, ValidatorBlobInfo > &blobInfos, PublisherListCollection const &lists)
Definition: ValidatorList.cpp:776
std::vector
STL class.
ripple::ValidatorList::applyListsAndBroadcast
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 o...
Definition: ValidatorList.cpp:869
ripple::ValidatorList::trustedPublisher
bool trustedPublisher(PublicKey const &identity) const
Returns true if public key is a trusted publisher.
Definition: ValidatorList.cpp:1404
ripple::ValidatorList::setNegativeUNL
void setNegativeUNL(hash_set< PublicKey > const &negUnl)
set the Negative UNL with validators' master public keys
Definition: ValidatorList.cpp:1947
ripple::ValidatorList::getQuorumKeys
QuorumKeys getQuorumKeys() const
Get the quorum and all of the trusted keys.
Definition: ValidatorList.h:658
ripple::ValidatorList::PublisherListStats
Describes the result of processing a Validator List (UNL), including some of the information from the...
Definition: ValidatorList.h:278
ripple::ValidatorList::negativeUNL_
hash_set< PublicKey > negativeUNL_
Definition: ValidatorList.h:253
ripple::ValidatorList::filePrefix_
static const std::string filePrefix_
Definition: ValidatorList.h:261
ripple::ValidatorList::j_
const beast::Journal j_
Definition: ValidatorList.h:228
ripple::ValidatorList::PublisherList::validUntil
TimeKeeper::time_point validUntil
Definition: ValidatorList.h:182
ripple::ValidatorList::getTrustedMasterKeys
hash_set< PublicKey > getTrustedMasterKeys() const
get the trusted master public keys
Definition: ValidatorList.cpp:1933
ripple::ValidatorList::buildValidatorListMessages
static std::pair< std::size_t, std::size_t > 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)
Definition: ValidatorList.cpp:612
std::lock_guard
STL class.
ripple::ValidatorList::maxSupportedBlobs
static constexpr std::size_t maxSupportedBlobs
Definition: ValidatorList.h:259
ripple::ValidatorList::lock_guard
std::lock_guard< decltype(mutex_)> lock_guard
Definition: ValidatorList.h:230
ripple::ValidatorBlobInfo::blob
std::string blob
Definition: ValidatorList.h:119
ripple::ValidatorList::PublisherListStats::bestDisposition
ListDisposition bestDisposition() const
Definition: ValidatorList.cpp:85
std::function
ripple::ValidatorList::parseBlobs
static std::vector< ValidatorBlobInfo > parseBlobs(std::uint32_t version, Json::Value const &body)
Pull the blob/signature/manifest information out of the appropriate Json body fields depending on the...
Definition: ValidatorList.cpp:362
ripple::ListDisposition::expired
@ expired
List is expired, but has the largest non-pending sequence seen so far.
ripple::ValidatorList::PublisherListCollection
Definition: ValidatorList.h:194
ripple::HashRouter
Routing table for objects identified by hash.
Definition: HashRouter.h:53
ripple::ValidatorList::PublisherListCollection::maxSequence
std::optional< std::size_t > maxSequence
Definition: ValidatorList.h:217
ripple::ValidatorList::getTrustedKey
std::optional< PublicKey > getTrustedKey(PublicKey const &identity) const
Returns master public key if public key is trusted.
Definition: ValidatorList.cpp:1396
ripple::ValidatorList::sendValidatorList
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)
Definition: ValidatorList.cpp:749
ripple::base_uint< 256 >
ripple::ValidatorList::removePublisherList
bool removePublisherList(lock_guard const &, PublicKey const &publisherKey, PublisherStatus reason)
Stop trusting publisher's list of keys.
Definition: ValidatorList.cpp:1419
ripple::ValidatorList::MessageWithHash
Definition: ValidatorList.h:303
ripple::ValidatorList::cacheValidatorFile
void cacheValidatorFile(lock_guard const &lock, PublicKey const &pubKey) const
Write a JSON UNL to a cache file.
Definition: ValidatorList.cpp:331
ripple::ValidatorList::hash_append
friend void hash_append(Hasher &h, PublisherListCollection pl)
Definition: ValidatorList.h:833
ripple::ValidatorList::MessageWithHash::hash
uint256 hash
Definition: ValidatorList.h:311
ripple::ValidatorList::ValidatorList
ValidatorList(ManifestCache &validatorManifests, ManifestCache &publisherManifests, TimeKeeper &timeKeeper, std::string const &databasePath, beast::Journal j, std::optional< std::size_t > minimumQuorum=std::nullopt)
Definition: ValidatorList.cpp:118
ripple::ValidatorList::dataPath_
const boost::filesystem::path dataPath_
Definition: ValidatorList.h:227
ripple::ValidatorList::PublisherListStats::status
PublisherStatus status
Definition: ValidatorList.h:299
ripple::ValidatorList::getCacheFileName
boost::filesystem::path getCacheFileName(lock_guard const &, PublicKey const &pubKey) const
Get the filename used for caching UNLs.
Definition: ValidatorList.cpp:250
ripple::ValidatorList::verify
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.
Definition: ValidatorList.cpp:1259
ripple::PublicKey
A public key.
Definition: PublicKey.h:59
ripple::ValidatorList::PublisherListStats::mergeDispositions
void mergeDispositions(PublisherListStats const &src)
Definition: ValidatorList.cpp:99
ripple::ValidatorList::PublisherList::list
std::vector< PublicKey > list
Definition: ValidatorList.h:178
ripple::ValidatorList::getListedKey
std::optional< PublicKey > getListedKey(PublicKey const &identity) const
Returns listed master public if public key is included on any lists.
Definition: ValidatorList.cpp:1374
ripple::ValidatorList
Definition: ValidatorList.h:172
ripple::ValidatorBlobInfo
Used to represent the information stored in the blobs_v2 Json array.
Definition: ValidatorList.h:116
ripple::TrustChanges::removed
hash_set< NodeID > removed
Definition: ValidatorList.h:112
ripple::ValidatorList::updateTrusted
TrustChanges updateTrusted(hash_set< NodeID > const &seenValidators, NetClock::time_point closeTime, NetworkOPs &ops, Overlay &overlay, HashRouter &hashRouter)
Update trusted nodes.
Definition: ValidatorList.cpp:1769
ripple::ValidatorList::PublisherListCollection::remaining
std::map< std::size_t, PublisherList > remaining
Definition: ValidatorList.h:216
ripple::ValidatorList::publisherManifests_
ManifestCache & publisherManifests_
Definition: ValidatorList.h:225
ripple::ValidatorList::broadcastBlobs
static void broadcastBlobs(PublicKey const &publisherKey, PublisherListCollection const &lists, std::size_t maxSequence, uint256 const &hash, Overlay &overlay, HashRouter &hashRouter, beast::Journal j)
Definition: ValidatorList.cpp:802
ripple::ValidatorList::timeKeeper_
TimeKeeper & timeKeeper_
Definition: ValidatorList.h:226
ripple::ValidatorList::PublisherList::manifests
std::vector< std::string > manifests
Definition: ValidatorList.h:179
ripple::ValidatorList::listed
bool listed(PublicKey const &identity) const
Returns true if public key is included on any lists.
Definition: ValidatorList.cpp:1349
ripple::TrustChanges::TrustChanges
TrustChanges()=default
std::chrono::time_point
ripple::ValidatorList::getAvailable
std::optional< Json::Value > 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: ValidatorList.cpp:1678
ripple::ValidatorList::PublisherList::siteUri
std::string siteUri
Definition: ValidatorList.h:183
ripple::ValidatorList::PublisherListCollection::status
PublisherStatus status
Definition: ValidatorList.h:196
ripple::ListDisposition::untrusted
@ untrusted
List signed by untrusted publisher key.
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
std::uint32_t
ripple::ValidatorList::PublisherListStats::sequence
std::size_t sequence
Definition: ValidatorList.h:300
std::atomic< std::size_t >
ripple::TimeKeeper
Manages various times used by the server.
Definition: TimeKeeper.h:32
std::map
STL class.
ripple::ListDisposition::unsupported_version
@ unsupported_version
List version is not supported.
ripple::ValidatorList::buildFileData
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,...
Definition: ValidatorList.cpp:259
ripple::ValidatorList::negativeUNLFilter
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.
Definition: ValidatorList.cpp:1954
ripple::ValidatorList::expires
std::optional< TimeKeeper::time_point > expires() const
Return the time when the validator list will expire.
Definition: ValidatorList.cpp:1500
ripple::ValidatorList::PublisherList::rawBlob
std::string rawBlob
Definition: ValidatorList.h:185
ripple::ValidatorList::calculateQuorum
std::size_t calculateQuorum(std::size_t unlSize, std::size_t effectiveUnlSize, std::size_t seenSize)
Return quorum for trusted validator set.
Definition: ValidatorList.cpp:1708
ripple::ListDisposition::known_sequence
@ known_sequence
Future sequence already seen.
ripple::ValidatorList::localPubKey_
PublicKey localPubKey_
Definition: ValidatorList.h:250
ripple::ValidatorList::applyList
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.
Definition: ValidatorList.cpp:1060
ripple::ManifestCache
Remembers manifests with the highest sequence number.
Definition: Manifest.h:231
ripple::ValidatorList::PublisherList::hash
uint256 hash
Definition: ValidatorList.h:191
ripple::ValidatorList::loadLists
std::vector< std::string > loadLists()
Definition: ValidatorList.cpp:1206
ripple::ValidatorList::PublisherListCollection::rawVersion
std::uint32_t rawVersion
Definition: ValidatorList.h:221
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::ValidatorList::trustedSigningKeys_
hash_set< PublicKey > trustedSigningKeys_
Definition: ValidatorList.h:248
ripple::ValidatorList::load
bool load(PublicKey const &localSigningKey, std::vector< std::string > const &configKeys, std::vector< std::string > const &publisherKeys)
Load configured trusted keys.
Definition: ValidatorList.cpp:136
protocol
Definition: ValidatorList.h:38
ripple::ValidatorList::PublisherList::PublisherList
PublisherList()=default
ripple::ValidatorList::PublisherListCollection::fullHash
uint256 fullHash
Definition: ValidatorList.h:219
ripple::Overlay
Manages the set of connected peers.
Definition: Overlay.h:51
ripple::ValidatorList::PublisherListCollection::current
PublisherList current
Definition: ValidatorList.h:207
ripple::PublisherStatus::unavailable
@ unavailable
ripple::ListDisposition::same_sequence
@ same_sequence
Same sequence as current list.
beast::hash_append
std::enable_if_t< is_contiguously_hashable< T, Hasher >::value > hash_append(Hasher &h, T const &t) noexcept
Logically concatenate input data to a Hasher.
Definition: hash_append.h:236
ripple::ListDisposition::invalid
@ invalid
Invalid format or signature.
ripple::ValidatorList::PublisherList::validFrom
TimeKeeper::time_point validFrom
Definition: ValidatorList.h:181
ripple::ValidatorList::mutex_
boost::shared_mutex mutex_
Definition: ValidatorList.h:229
ripple::ValidatorList::~ValidatorList
~ValidatorList()=default
ripple::ValidatorList::shared_lock
std::shared_lock< decltype(mutex_)> shared_lock
Definition: ValidatorList.h:231
ripple::ValidatorList::PublisherListStats::worstDisposition
ListDisposition worstDisposition() const
Definition: ValidatorList.cpp:92
ripple::ValidatorList::PublisherListStats::publisherKey
std::optional< PublicKey > publisherKey
Definition: ValidatorList.h:298
ripple::TrustChanges::added
hash_set< NodeID > added
Definition: ValidatorList.h:111
std::optional< std::string >
mutex
ripple::ValidatorList::getJson
Json::Value getJson() const
Return a JSON representation of the state of the validator list.
Definition: ValidatorList.cpp:1507
std::size_t
ripple::to_string
std::string to_string(Manifest const &m)
Format the specified manifest to a string for debugging purposes.
Definition: app/misc/impl/Manifest.cpp:41
ripple::ValidatorList::PublisherList::rawManifest
std::optional< std::string > rawManifest
Definition: ValidatorList.h:190
ripple::ValidatorBlobInfo::manifest
std::optional< std::string > manifest
Definition: ValidatorList.h:124
ripple::ValidatorList::PublisherListStats::dispositions
std::map< ListDisposition, std::size_t > dispositions
Definition: ValidatorList.h:297
numeric
ripple::ValidatorList::trusted
bool trusted(PublicKey const &identity) const
Returns true if public key is trusted.
Definition: ValidatorList.cpp:1367
ripple::ValidatorList::trustedMasterKeys_
hash_set< PublicKey > trustedMasterKeys_
Definition: ValidatorList.h:243
ripple::ValidatorList::getNegativeUNL
hash_set< PublicKey > getNegativeUNL() const
get the master public keys of Negative UNL validators
Definition: ValidatorList.cpp:1940
ripple::PublisherStatus
PublisherStatus
Definition: ValidatorList.h:87
ripple::ValidatorList::applyLists
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.
Definition: ValidatorList.cpp:922
ripple::ValidatorList::PublisherListCollection::rawManifest
std::string rawManifest
Definition: ValidatorList.h:220
ripple::PublisherStatus::revoked
@ revoked
ripple::hash_append
void hash_append(Hasher &h, ValidatorBlobInfo const &blobInfo)
Definition: ValidatorList.h:897
ripple::ValidatorList::count
std::size_t count() const
Return the number of configured validator list sites.
Definition: ValidatorList.cpp:1459
shared_mutex
std::unordered_map
STL class.
beast::abstract_clock< NetClock >::time_point
typename NetClock ::time_point time_point
Definition: abstract_clock.h:63
ripple::ValidatorList::publisherLists_
hash_map< PublicKey, PublisherListCollection > publisherLists_
Definition: ValidatorList.h:237
ripple::ValidatorList::for_each_available
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.
Definition: ValidatorList.cpp:1651
ripple::ValidatorList::keyListings_
hash_map< PublicKey, std::size_t > keyListings_
Definition: ValidatorList.h:240
ripple::ListDisposition::accepted
@ accepted
List is valid.
ripple::ValidatorList::quorum_
std::atomic< std::size_t > quorum_
Definition: ValidatorList.h:233
ripple::PublisherStatus::available
@ available
ripple::PublisherStatus::expired
@ expired
ripple::ValidatorList::updatePublisherList
void updatePublisherList(PublicKey const &pubKey, PublisherList const &current, std::vector< PublicKey > const &oldList, lock_guard const &)
Definition: ValidatorList.cpp:996
ripple::ValidatorList::MessageWithHash::numVLs
std::size_t numVLs
Definition: ValidatorList.h:312
std::shared_lock
STL class.
ripple::ValidatorList::PublisherList
Definition: ValidatorList.h:174
protocol::hash_append
void hash_append(Hasher &h, TMValidatorList const &msg)
Definition: ValidatorList.h:932
ripple::ValidatorList::quorum
std::size_t quorum() const
Get quorum value for current trusted key set.
Definition: ValidatorList.h:492
Json::Value
Represents a JSON value.
Definition: json_value.h:145
ripple::ValidatorList::minimumQuorum_
std::optional< std::size_t > minimumQuorum_
Definition: ValidatorList.h:234
ripple::Peer
Represents a peer connection in the overlay.
Definition: ripple/overlay/Peer.h:45