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 below variable contains the Publisher list specified in the local
253  // config file under the title of SECTION_VALIDATORS or [validators].
254  // This list is not associated with the masterKey of any publisher.
255 
256  // Appropos PublisherListCollection fields, localPublisherList does not
257  // have any "remaining" manifests. It is assumed to be perennially
258  // "available". The "validUntil" field is set to the highest possible
259  // value of the field, hence this list is always valid.
261 
262  // The master public keys of the current negative UNL
264 
265  // Currently supported versions of publisher list format
266  static constexpr std::uint32_t supportedListVersions[]{1, 2};
267  // In the initial release, to prevent potential abuse and attacks, any VL
268  // collection with more than 5 entries will be considered malformed.
269  static constexpr std::size_t maxSupportedBlobs = 5;
270  // Prefix of the file name used to store cache files.
271  static const std::string filePrefix_;
272 
273 public:
275  ManifestCache& validatorManifests,
276  ManifestCache& publisherManifests,
277  TimeKeeper& timeKeeper,
278  std::string const& databasePath,
279  beast::Journal j,
280  std::optional<std::size_t> minimumQuorum = std::nullopt);
281  ~ValidatorList() = default;
282 
289  {
290  explicit PublisherListStats() = default;
293  ListDisposition d,
294  PublicKey key,
295  PublisherStatus stat,
296  std::size_t seq);
297 
299  bestDisposition() const;
301  worstDisposition() const;
302  void
304 
305  // Tracks the dispositions of each processed list and how many times it
306  // occurred
311  };
312 
314  {
315  explicit MessageWithHash() = default;
316  explicit MessageWithHash(
317  std::shared_ptr<Message> const& message_,
318  uint256 hash_,
319  std::size_t num_);
323  };
324 
342  bool
343  load(
344  std::optional<PublicKey> const& localSigningKey,
345  std::vector<std::string> const& configKeys,
346  std::vector<std::string> const& publisherKeys);
347 
354  parseBlobs(std::uint32_t version, Json::Value const& body);
355 
357  parseBlobs(protocol::TMValidatorList const& body);
358 
360  parseBlobs(protocol::TMValidatorListCollection const& body);
361 
362  static void
364  Peer& peer,
365  std::uint64_t peerSequence,
366  PublicKey const& publisherKey,
367  std::size_t maxSequence,
368  std::uint32_t rawVersion,
369  std::string const& rawManifest,
371  HashRouter& hashRouter,
372  beast::Journal j);
373 
374  [[nodiscard]] static std::pair<std::size_t, std::size_t>
376  std::size_t messageVersion,
377  std::uint64_t peerSequence,
378  std::size_t maxSequence,
379  std::uint32_t rawVersion,
380  std::string const& rawManifest,
383  std::size_t maxSize = maximiumMessageSize);
384 
416  std::string const& manifest,
417  std::uint32_t version,
418  std::vector<ValidatorBlobInfo> const& blobs,
419  std::string siteUri,
420  uint256 const& hash,
421  Overlay& overlay,
422  HashRouter& hashRouter,
423  NetworkOPs& networkOPs);
424 
446  applyLists(
447  std::string const& manifest,
448  std::uint32_t version,
449  std::vector<ValidatorBlobInfo> const& blobs,
450  std::string siteUri,
451  std::optional<uint256> const& hash = {});
452 
453  /* Attempt to read previously stored list files. Expected to only be
454  called when loading from URL fails.
455 
456  @return A list of valid file:// URLs, if any.
457 
458  @par Thread Safety
459 
460  May be called concurrently
461  */
463  loadLists();
464 
482  hash_set<NodeID> const& seenValidators,
483  NetClock::time_point closeTime,
484  NetworkOPs& ops,
485  Overlay& overlay,
486  HashRouter& hashRouter);
487 
502  quorum() const
503  {
504  return quorum_;
505  }
506 
515  bool
516  trusted(PublicKey const& identity) const;
517 
526  bool
527  listed(PublicKey const& identity) const;
528 
540  getTrustedKey(PublicKey const& identity) const;
541 
553  getListedKey(PublicKey const& identity) const;
554 
563  bool
564  trustedPublisher(PublicKey const& identity) const;
565 
574  localPublicKey() const;
575 
591  void
592  for_each_listed(std::function<void(PublicKey const&, bool)> func) const;
593 
621  void
623  std::function<void(
624  std::string const& manifest,
625  std::uint32_t version,
627  PublicKey const& pubKey,
628  std::size_t maxSequence,
629  uint256 const& hash)> func) const;
630 
635  getAvailable(
636  boost::beast::string_view const& pubKey,
637  std::optional<std::uint32_t> forceVersion = {});
638 
641  count() const;
642 
653  expires() const;
654 
661  getJson() const;
662 
668  QuorumKeys
670  {
671  shared_lock read_lock{mutex_};
672  return {quorum_, trustedSigningKeys_};
673  }
674 
680  getTrustedMasterKeys() const;
681 
687  getNegativeUNL() const;
688 
693  void
694  setNegativeUNL(hash_set<PublicKey> const& negUnl);
695 
704  std::vector<std::shared_ptr<STValidation>>&& validations) const;
705 
706 private:
709  count(shared_lock const&) const;
710 
719  bool
720  trusted(shared_lock const&, PublicKey const& identity) const;
721 
733  getTrustedKey(shared_lock const&, PublicKey const& identity) const;
734 
745  expires(shared_lock const&) const;
746 
769  PublisherListStats
770  applyList(
771  std::string const& globalManifest,
772  std::optional<std::string> const& localManifest,
773  std::string const& blob,
774  std::string const& signature,
775  std::uint32_t version,
776  std::string siteUri,
777  std::optional<uint256> const& hash,
778  lock_guard const&);
779 
780  // This function updates the keyListings_ counts for all the trusted
781  // master keys
782  void
784  PublicKey const& pubKey,
785  PublisherList const& current,
786  std::vector<PublicKey> const& oldList,
787  lock_guard const&);
788 
789  static void
792  PublisherListCollection const& lists);
793 
795  buildBlobInfos(PublisherListCollection const& lists);
796 
797  static void
799  PublicKey const& publisherKey,
800  PublisherListCollection const& lists,
801  std::size_t maxSequence,
802  uint256 const& hash,
803  Overlay& overlay,
804  HashRouter& hashRouter,
805  beast::Journal j);
806 
807  static void
809  Peer& peer,
810  std::uint64_t peerSequence,
811  PublicKey const& publisherKey,
812  std::size_t maxSequence,
813  std::uint32_t rawVersion,
814  std::string const& rawManifest,
817  HashRouter& hashRouter,
818  beast::Journal j);
819 
822  boost::filesystem::path
823  getCacheFileName(lock_guard const&, PublicKey const& pubKey) const;
824 
828  static Json::Value
830  std::string const& pubKey,
831  PublisherListCollection const& pubCollection,
832  beast::Journal j);
833 
837  static Json::Value
839  std::string const& pubKey,
840  PublisherListCollection const& pubCollection,
841  std::optional<std::uint32_t> forceVersion,
842  beast::Journal j);
843 
844  template <class Hasher>
845  friend void
847  {
848  using beast::hash_append;
850  }
851 
854  void
855  cacheValidatorFile(lock_guard const& lock, PublicKey const& pubKey) const;
856 
866  verify(
867  lock_guard const&,
868  Json::Value& list,
869  std::string const& manifest,
870  std::string const& blob,
871  std::string const& signature);
872 
883  bool
885  lock_guard const&,
886  PublicKey const& publisherKey,
887  PublisherStatus reason);
888 
901  std::size_t unlSize,
902  std::size_t effectiveUnlSize,
903  std::size_t seenSize);
904 };
905 
906 // hashing helpers
907 template <class Hasher>
908 void
909 hash_append(Hasher& h, ValidatorBlobInfo const& blobInfo)
910 {
911  using beast::hash_append;
912  hash_append(h, blobInfo.blob, blobInfo.signature);
913  if (blobInfo.manifest)
914  {
915  hash_append(h, *blobInfo.manifest);
916  }
917 }
918 
919 template <class Hasher>
920 void
922 {
923  for (auto const& item : blobs)
924  hash_append(h, item);
925 }
926 
927 template <class Hasher>
928 void
930 {
931  for (auto const& [_, item] : blobs)
932  {
933  (void)_;
934  hash_append(h, item);
935  }
936 }
937 
938 } // namespace ripple
939 
940 namespace protocol {
941 
942 template <class Hasher>
943 void
944 hash_append(Hasher& h, TMValidatorList const& msg)
945 {
946  using beast::hash_append;
947  hash_append(h, msg.manifest(), msg.blob(), msg.signature(), msg.version());
948 }
949 
950 template <class Hasher>
951 void
952 hash_append(Hasher& h, TMValidatorListCollection const& msg)
953 {
954  using beast::hash_append;
955  hash_append(
956  h,
957  msg.manifest(),
959  msg.version());
960 }
961 
962 } // namespace protocol
963 
964 #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:1672
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:320
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:266
ripple::ValidatorList::buildBlobInfos
static void buildBlobInfos(std::map< std::size_t, ValidatorBlobInfo > &blobInfos, PublisherListCollection const &lists)
Definition: ValidatorList.cpp:778
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:871
ripple::ValidatorList::trustedPublisher
bool trustedPublisher(PublicKey const &identity) const
Returns true if public key is a trusted publisher.
Definition: ValidatorList.cpp:1425
ripple::ValidatorList::setNegativeUNL
void setNegativeUNL(hash_set< PublicKey > const &negUnl)
set the Negative UNL with validators' master public keys
Definition: ValidatorList.cpp:1991
ripple::ValidatorList::getQuorumKeys
QuorumKeys getQuorumKeys() const
Get the quorum and all of the trusted keys.
Definition: ValidatorList.h:669
ripple::ValidatorList::PublisherListStats
Describes the result of processing a Validator List (UNL), including some of the information from the...
Definition: ValidatorList.h:288
ripple::ValidatorList::negativeUNL_
hash_set< PublicKey > negativeUNL_
Definition: ValidatorList.h:263
ripple::ValidatorList::filePrefix_
static const std::string filePrefix_
Definition: ValidatorList.h:271
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:1977
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:614
std::lock_guard
STL class.
ripple::ValidatorList::maxSupportedBlobs
static constexpr std::size_t maxSupportedBlobs
Definition: ValidatorList.h:269
ripple::ValidatorList::verify
std::pair< ListDisposition, std::optional< PublicKey > > verify(lock_guard const &, Json::Value &list, std::string const &manifest, std::string const &blob, std::string const &signature)
Check response for trusted valid published list.
Definition: ValidatorList.cpp:1283
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:86
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:364
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:1417
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:751
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:1440
ripple::ValidatorList::MessageWithHash
Definition: ValidatorList.h:313
ripple::ValidatorList::cacheValidatorFile
void cacheValidatorFile(lock_guard const &lock, PublicKey const &pubKey) const
Write a JSON UNL to a cache file.
Definition: ValidatorList.cpp:333
ripple::ValidatorList::hash_append
friend void hash_append(Hasher &h, PublisherListCollection pl)
Definition: ValidatorList.h:846
ripple::ValidatorList::MessageWithHash::hash
uint256 hash
Definition: ValidatorList.h:321
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:119
ripple::ValidatorList::dataPath_
const boost::filesystem::path dataPath_
Definition: ValidatorList.h:227
ripple::ValidatorList::PublisherListStats::status
PublisherStatus status
Definition: ValidatorList.h:309
ripple::ValidatorList::getCacheFileName
boost::filesystem::path getCacheFileName(lock_guard const &, PublicKey const &pubKey) const
Get the filename used for caching UNLs.
Definition: ValidatorList.cpp:252
ripple::PublicKey
A public key.
Definition: PublicKey.h:61
ripple::ValidatorList::PublisherListStats::mergeDispositions
void mergeDispositions(PublisherListStats const &src)
Definition: ValidatorList.cpp:100
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:1395
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:1800
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:804
ripple::ValidatorList::localPublicKey
std::optional< PublicKey > localPublicKey() const
This function returns the local validator public key or a std::nullopt.
Definition: ValidatorList.cpp:1433
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:1370
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:1709
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:310
std::atomic< std::size_t >
ripple::TimeKeeper
Manages various times used by the server.
Definition: TimeKeeper.h:31
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:261
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:1998
ripple::ValidatorList::expires
std::optional< TimeKeeper::time_point > expires() const
Return the time when the validator list will expire.
Definition: ValidatorList.cpp:1536
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:1739
ripple::ValidatorList::load
bool load(std::optional< PublicKey > const &localSigningKey, std::vector< std::string > const &configKeys, std::vector< std::string > const &publisherKeys)
Load configured trusted keys.
Definition: ValidatorList.cpp:137
ripple::ListDisposition::known_sequence
@ known_sequence
Future sequence already seen.
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:1067
ripple::ManifestCache
Remembers manifests with the highest sequence number.
Definition: Manifest.h:255
ripple::ValidatorList::PublisherList::hash
uint256 hash
Definition: ValidatorList.h:191
ripple::ValidatorList::loadLists
std::vector< std::string > loadLists()
Definition: ValidatorList.cpp:1228
ripple::ValidatorList::PublisherListCollection::rawVersion
std::uint32_t rawVersion
Definition: ValidatorList.h:221
ripple::ValidatorList::localPubKey_
std::optional< PublicKey > localPubKey_
Definition: ValidatorList.h:250
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
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::ValidatorList::localPublisherList
PublisherList localPublisherList
Definition: ValidatorList.h:260
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:93
ripple::ValidatorList::PublisherListStats::publisherKey
std::optional< PublicKey > publisherKey
Definition: ValidatorList.h:308
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:1543
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:38
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:307
numeric
ripple::ValidatorList::trusted
bool trusted(PublicKey const &identity) const
Returns true if public key is trusted.
Definition: ValidatorList.cpp:1388
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:1984
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:929
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:909
ripple::ValidatorList::count
std::size_t count() const
Return the number of configured validator list sites.
Definition: ValidatorList.cpp:1480
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:1682
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:1003
ripple::ValidatorList::MessageWithHash::numVLs
std::size_t numVLs
Definition: ValidatorList.h:322
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:944
ripple::ValidatorList::quorum
std::size_t quorum() const
Get quorum value for current trusted key set.
Definition: ValidatorList.h:502
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