-
2124ValidatorList::negativeUNLFilter(
-
-
-
-
2128 auto ret = std::move(validations);
-
-
-
2131 if (!negativeUNL_.empty())
-
-
-
-
-
-
2137 [&](
auto const& v) ->
bool {
-
2138 if (auto const masterKey =
-
2139 getTrustedKey(read_lock, v->getSignerPublic());
-
-
-
2142 return negativeUNL_.count(*masterKey);
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
2125ValidatorList::negativeUNLFilter(
+
+
+
+
2129 auto ret = std::move(validations);
+
+
+
2132 if (!negativeUNL_.empty())
+
+
+
+
+
+
2138 [&](
auto const& v) ->
bool {
+
2139 if (auto const masterKey =
+
2140 getTrustedKey(read_lock, v->getSignerPublic());
+
+
+
2143 return negativeUNL_.count(*masterKey);
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
@@ -2399,47 +2400,47 @@ $(document).ready(function() { init_codefold(0); });
An immutable linear range of bytes.
Manages various times used by the server.
time_point now() const override
Returns the current time, using the server's clock.
-
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=maximumMessageSize)
-
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_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=maximumMessageSize)
+
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 constexpr std::uint32_t supportedListVersions[]
PublisherList localPublisherList
hash_set< PublicKey > trustedMasterKeys_
-
bool trustedPublisher(PublicKey const &identity) const
Returns true if public key is a trusted publisher.
+
bool trustedPublisher(PublicKey const &identity) const
Returns true if public key is a trusted publisher.
static constexpr std::size_t maxSupportedBlobs
ValidatorList(ManifestCache &validatorManifests, ManifestCache &publisherManifests, TimeKeeper &timeKeeper, std::string const &databasePath, beast::Journal j, std::optional< std::size_t > minimumQuorum=std::nullopt)
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,...
-
std::vector< std::string > loadLists()
+
std::vector< std::string > loadLists()
std::optional< PublicKey > localPubKey_
std::atomic< std::size_t > quorum_
-
std::pair< ListDisposition, std::optional< PublicKey > > verify(lock_guard const &, Json::Value &list, Manifest manifest, std::string const &blob, std::string const &signature)
Check response for trusted valid published list.
+
std::pair< ListDisposition, std::optional< PublicKey > > verify(lock_guard const &, Json::Value &list, Manifest manifest, std::string const &blob, std::string const &signature)
Check response for trusted valid published list.
boost::filesystem::path const dataPath_
bool load(std::optional< PublicKey > const &localSigningKey, std::vector< std::string > const &configKeys, std::vector< std::string > const &publisherKeys, std::optional< std::size_t > listThreshold={})
Load configured trusted keys.
-
bool removePublisherList(lock_guard const &, PublicKey const &publisherKey, PublisherStatus reason)
Stop trusting publisher's list of keys.
-
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.
-
std::optional< PublicKey > localPublicKey() const
This function returns the local validator public key or a std::nullopt.
-
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.
-
std::optional< PublicKey > getListedKey(PublicKey const &identity) const
Returns listed master public if public key is included on any lists.
+
bool removePublisherList(lock_guard const &, PublicKey const &publisherKey, PublisherStatus reason)
Stop trusting publisher's list of keys.
+
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.
+
std::optional< PublicKey > localPublicKey() const
This function returns the local validator public key or a std::nullopt.
+
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.
+
std::optional< PublicKey > getListedKey(PublicKey const &identity) const
Returns listed master public if public key is included on any lists.
void cacheValidatorFile(lock_guard const &lock, PublicKey const &pubKey) const
Write a JSON UNL to a cache file.
std::optional< std::size_t > minimumQuorum_
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...
ManifestCache & publisherManifests_
hash_map< PublicKey, std::size_t > keyListings_
-
std::optional< TimeKeeper::time_point > expires() const
Return the time when the validator list will expire.
-
static void buildBlobInfos(std::map< std::size_t, ValidatorBlobInfo > &blobInfos, PublisherListCollection const &lists)
+
std::optional< TimeKeeper::time_point > expires() const
Return the time when the validator list will expire.
+
static void buildBlobInfos(std::map< std::size_t, ValidatorBlobInfo > &blobInfos, PublisherListCollection const &lists)
ManifestCache & validatorManifests_
std::size_t listThreshold_
-
static void broadcastBlobs(PublicKey const &publisherKey, PublisherListCollection const &lists, std::size_t maxSequence, uint256 const &hash, Overlay &overlay, HashRouter &hashRouter, beast::Journal j)
-
std::size_t count() const
Return the number of configured validator list sites.
-
std::optional< PublicKey > getTrustedKey(PublicKey const &identity) const
Returns master public key if public key is trusted.
-
void updatePublisherList(PublicKey const &pubKey, PublisherList const ¤t, std::vector< PublicKey > const &oldList, lock_guard const &)
-
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...
+
static void broadcastBlobs(PublicKey const &publisherKey, PublisherListCollection const &lists, std::size_t maxSequence, uint256 const &hash, Overlay &overlay, HashRouter &hashRouter, beast::Journal j)
+
std::size_t count() const
Return the number of configured validator list sites.
+
std::optional< PublicKey > getTrustedKey(PublicKey const &identity) const
Returns master public key if public key is trusted.
+
void updatePublisherList(PublicKey const &pubKey, PublisherList const ¤t, std::vector< PublicKey > const &oldList, lock_guard const &)
+
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...
boost::filesystem::path getCacheFileName(lock_guard const &, PublicKey const &pubKey) const
Get the filename used for caching UNLs.
-
bool trusted(PublicKey const &identity) const
Returns true if public key is trusted.
+
bool trusted(PublicKey const &identity) const
Returns true if public key is trusted.
static std::string const filePrefix_
-
bool listed(PublicKey const &identity) const
Returns true if public key is included on any lists.
+
bool listed(PublicKey const &identity) const
Returns true if public key is included on any lists.
hash_map< PublicKey, PublisherListCollection > publisherLists_
diff --git a/ValidatorList_8h_source.html b/ValidatorList_8h_source.html
index a45428109c..370873c177 100644
--- a/ValidatorList_8h_source.html
+++ b/ValidatorList_8h_source.html
@@ -699,64 +699,64 @@ $(document).ready(function() { init_codefold(0); });
Manages various times used by the server.
-
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=maximumMessageSize)
-
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_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=maximumMessageSize)
+
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 constexpr std::uint32_t supportedListVersions[]
std::shared_lock< decltype(mutex_)> shared_lock
PublisherList localPublisherList
hash_set< PublicKey > trustedMasterKeys_
-
bool trustedPublisher(PublicKey const &identity) const
Returns true if public key is a trusted publisher.
+
bool trustedPublisher(PublicKey const &identity) const
Returns true if public key is a trusted publisher.
static constexpr std::size_t maxSupportedBlobs
hash_set< PublicKey > trustedSigningKeys_
-
std::size_t calculateQuorum(std::size_t unlSize, std::size_t effectiveUnlSize, std::size_t seenSize)
Return quorum for trusted validator set.
+
std::size_t calculateQuorum(std::size_t unlSize, std::size_t effectiveUnlSize, std::size_t seenSize)
Return quorum for trusted validator set.
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,...
-
std::vector< std::string > loadLists()
-
Json::Value getJson() const
Return a JSON representation of the state of the validator list.
-
void for_each_listed(std::function< void(PublicKey const &, bool)> func) const
Invokes the callback once for every listed validation public key.
-
hash_set< PublicKey > getTrustedMasterKeys() const
get the trusted master public keys
+
std::vector< std::string > loadLists()
+
Json::Value getJson() const
Return a JSON representation of the state of the validator list.
+
void for_each_listed(std::function< void(PublicKey const &, bool)> func) const
Invokes the callback once for every listed validation public key.
+
hash_set< PublicKey > getTrustedMasterKeys() const
get the trusted master public keys
std::optional< PublicKey > localPubKey_
std::atomic< std::size_t > quorum_
QuorumKeys getQuorumKeys() const
Get the quorum and all of the trusted keys.
-
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.
-
std::pair< ListDisposition, std::optional< PublicKey > > verify(lock_guard const &, Json::Value &list, Manifest manifest, std::string const &blob, std::string const &signature)
Check response for trusted valid published list.
+
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.
+
std::pair< ListDisposition, std::optional< PublicKey > > verify(lock_guard const &, Json::Value &list, Manifest manifest, std::string const &blob, std::string const &signature)
Check response for trusted valid published list.
-
TrustChanges updateTrusted(hash_set< NodeID > const &seenValidators, NetClock::time_point closeTime, NetworkOPs &ops, Overlay &overlay, HashRouter &hashRouter)
Update trusted nodes.
+
TrustChanges updateTrusted(hash_set< NodeID > const &seenValidators, NetClock::time_point closeTime, NetworkOPs &ops, Overlay &overlay, HashRouter &hashRouter)
Update trusted nodes.
boost::filesystem::path const dataPath_
bool load(std::optional< PublicKey > const &localSigningKey, std::vector< std::string > const &configKeys, std::vector< std::string > const &publisherKeys, std::optional< std::size_t > listThreshold={})
Load configured trusted keys.
-
bool removePublisherList(lock_guard const &, PublicKey const &publisherKey, PublisherStatus reason)
Stop trusting publisher's list of keys.
-
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.
-
std::optional< PublicKey > localPublicKey() const
This function returns the local validator public key or a std::nullopt.
+
bool removePublisherList(lock_guard const &, PublicKey const &publisherKey, PublisherStatus reason)
Stop trusting publisher's list of keys.
+
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.
+
std::optional< PublicKey > localPublicKey() const
This function returns the local validator public key or a std::nullopt.
std::size_t quorum() const
Get quorum value for current trusted key set.
-
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.
-
std::optional< PublicKey > getListedKey(PublicKey const &identity) const
Returns listed master public if public key is included on any lists.
+
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.
+
std::optional< PublicKey > getListedKey(PublicKey const &identity) const
Returns listed master public if public key is included on any lists.
void cacheValidatorFile(lock_guard const &lock, PublicKey const &pubKey) const
Write a JSON UNL to a cache file.
std::lock_guard< decltype(mutex_)> lock_guard
-
hash_set< PublicKey > getNegativeUNL() const
get the master public keys of Negative UNL validators
+
hash_set< PublicKey > getNegativeUNL() const
get the master public keys of Negative UNL validators
std::optional< std::size_t > minimumQuorum_
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...
ManifestCache & publisherManifests_
hash_map< PublicKey, std::size_t > keyListings_
-
std::size_t getListThreshold() const
get the validator list threshold
-
std::optional< TimeKeeper::time_point > expires() const
Return the time when the validator list will expire.
-
static void buildBlobInfos(std::map< std::size_t, ValidatorBlobInfo > &blobInfos, PublisherListCollection const &lists)
+
std::size_t getListThreshold() const
get the validator list threshold
+
std::optional< TimeKeeper::time_point > expires() const
Return the time when the validator list will expire.
+
static void buildBlobInfos(std::map< std::size_t, ValidatorBlobInfo > &blobInfos, PublisherListCollection const &lists)
ManifestCache & validatorManifests_
hash_set< PublicKey > negativeUNL_
std::size_t listThreshold_
-
void setNegativeUNL(hash_set< PublicKey > const &negUnl)
set the Negative UNL with validators' master public keys
-
static void broadcastBlobs(PublicKey const &publisherKey, PublisherListCollection const &lists, std::size_t maxSequence, uint256 const &hash, Overlay &overlay, HashRouter &hashRouter, beast::Journal j)
-
std::size_t count() const
Return the number of configured validator list sites.
-
std::optional< PublicKey > getTrustedKey(PublicKey const &identity) const
Returns master public key if public key is trusted.
-
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.
-
std::optional< Json::Value > getAvailable(std::string_view pubKey, std::optional< std::uint32_t > forceVersion={})
Returns the current valid list for the given publisher key, if available, as a Json object.
-
void updatePublisherList(PublicKey const &pubKey, PublisherList const ¤t, std::vector< PublicKey > const &oldList, lock_guard const &)
-
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...
+
void setNegativeUNL(hash_set< PublicKey > const &negUnl)
set the Negative UNL with validators' master public keys
+
static void broadcastBlobs(PublicKey const &publisherKey, PublisherListCollection const &lists, std::size_t maxSequence, uint256 const &hash, Overlay &overlay, HashRouter &hashRouter, beast::Journal j)
+
std::size_t count() const
Return the number of configured validator list sites.
+
std::optional< PublicKey > getTrustedKey(PublicKey const &identity) const
Returns master public key if public key is trusted.
+
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.
+
std::optional< Json::Value > getAvailable(std::string_view pubKey, std::optional< std::uint32_t > forceVersion={})
Returns the current valid list for the given publisher key, if available, as a Json object.
+
void updatePublisherList(PublicKey const &pubKey, PublisherList const ¤t, std::vector< PublicKey > const &oldList, lock_guard const &)
+
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...
boost::filesystem::path getCacheFileName(lock_guard const &, PublicKey const &pubKey) const
Get the filename used for caching UNLs.
-
bool trusted(PublicKey const &identity) const
Returns true if public key is trusted.
+
bool trusted(PublicKey const &identity) const
Returns true if public key is trusted.
static std::string const filePrefix_
-
bool listed(PublicKey const &identity) const
Returns true if public key is included on any lists.
+
bool listed(PublicKey const &identity) const
Returns true if public key is included on any lists.
hash_map< PublicKey, PublisherListCollection > publisherLists_
friend void hash_append(Hasher &h, PublisherListCollection pl)
diff --git a/ValidatorList__test_8cpp_source.html b/ValidatorList__test_8cpp_source.html
index 69c05cddaf..2711b79def 100644
--- a/ValidatorList__test_8cpp_source.html
+++ b/ValidatorList__test_8cpp_source.html
@@ -2491,1791 +2491,1792 @@ $(document).ready(function() { init_codefold(0); });
2370 &extractHeader](
Message& message) {
2371 auto [header, buffers] = extractHeader(message);
2372 if (BEAST_EXPECT(header) &&
-
2373 BEAST_EXPECT(header->message_type == protocol::mtVALIDATORLIST))
-
-
-
2376 detail::parseMessageContent<protocol::TMValidatorList>(
-
2377 *header, buffers.data());
-
-
-
-
-
-
2383 auto extractProtocolMessage2 = [
this,
-
2384 &extractHeader](
Message& message) {
-
2385 auto [header, buffers] = extractHeader(message);
-
2386 if (BEAST_EXPECT(header) &&
-
-
2388 header->message_type ==
-
2389 protocol::mtVALIDATORLISTCOLLECTION))
-
-
2391 auto const msg = detail::parseMessageContent<
-
2392 protocol::TMValidatorListCollection>(
-
2393 *header, buffers.data());
-
-
-
-
-
-
2399 auto verifyMessage =
-
-
-
2402 &extractProtocolMessage1,
-
2403 &extractProtocolMessage2](
-
-
-
2406 auto const& blobInfos,
-
2407 auto const& messages,
-
-
-
2410 BEAST_EXPECT(messages.size() == expectedInfo.size());
-
2411 auto msgIter = expectedInfo.begin();
-
2412 for (
auto const& messageWithHash : messages)
-
-
2414 if (!BEAST_EXPECT(msgIter != expectedInfo.end()))
-
-
2416 if (!BEAST_EXPECT(messageWithHash.message))
-
-
2418 auto const& expectedSeqs = msgIter->second;
-
2419 auto seqIter = expectedSeqs.begin();
-
-
2421 messageWithHash.message
-
2422 ->getBuffer(compression::Compressed::Off)
-
-
-
2425 BEAST_EXPECT(size == msgIter->first);
-
2426 if (expectedSeqs.size() == 1)
-
-
-
2429 extractProtocolMessage1(*messageWithHash.message);
-
2430 auto const expectedVersion = 1;
-
2431 if (BEAST_EXPECT(msg))
-
-
2433 BEAST_EXPECT(msg->version() == expectedVersion);
-
2434 if (!BEAST_EXPECT(seqIter != expectedSeqs.end()))
-
-
2436 auto const& expectedBlob = blobInfos.at(*seqIter);
-
-
2438 (*seqIter < manifestCutoff) ==
-
2439 !!expectedBlob.manifest);
-
2440 auto const expectedManifest =
-
2441 *seqIter < manifestCutoff &&
-
2442 expectedBlob.manifest
-
2443 ? *expectedBlob.manifest
-
-
2445 BEAST_EXPECT(msg->manifest() == expectedManifest);
-
2446 BEAST_EXPECT(msg->blob() == expectedBlob.blob);
-
-
2448 msg->signature() == expectedBlob.signature);
-
-
2450 BEAST_EXPECT(seqIter == expectedSeqs.end());
-
-
-
2453 messageWithHash.hash ==
-
-
-
-
2457 expectedBlob.signature,
-
-
-
-
-
-
-
2464 hashingBlobs.
reserve(msgIter->second.size());
-
-
-
2467 extractProtocolMessage2(*messageWithHash.message);
-
2468 if (BEAST_EXPECT(msg))
-
-
2470 BEAST_EXPECT(msg->version() == version);
-
2471 BEAST_EXPECT(msg->manifest() ==
manifest);
-
2472 for (
auto const& blobInfo : msg->blobs())
-
-
-
2475 seqIter != expectedSeqs.end()))
-
-
2477 auto const& expectedBlob =
-
2478 blobInfos.at(*seqIter);
-
-
-
2481 blobInfo.has_manifest() ==
-
2482 !!expectedBlob.manifest);
-
-
2484 blobInfo.has_manifest() ==
-
2485 (*seqIter < manifestCutoff));
-
-
2487 if (*seqIter < manifestCutoff)
-
-
2489 blobInfo.manifest() ==
-
2490 *expectedBlob.manifest);
-
-
2492 blobInfo.blob() == expectedBlob.blob);
-
-
2494 blobInfo.signature() ==
-
2495 expectedBlob.signature);
-
-
-
2498 BEAST_EXPECT(seqIter == expectedSeqs.end());
-
-
-
2501 messageWithHash.hash ==
-
-
-
-
-
2506 BEAST_EXPECT(msgIter == expectedInfo.end());
-
-
2508 auto verifyBuildMessages =
-
-
-
-
-
2513 BEAST_EXPECT(result.
first == expectedSequence);
-
2514 BEAST_EXPECT(result.
second == expectedSize);
-
-
-
-
-
-
2520 auto const blobInfos = [manifestCutoff = manifestCutoff]() {
-
-
-
2523 for (
auto seq : {5, 6, 7, 10, 12})
-
-
-
-
2527 s <<
"This is not a blob with sequence " <<
seq;
-
-
-
2530 s <<
"This is not a signature for sequence " <<
seq;
-
2531 b.signature = s.
str();
-
2532 if (
seq < manifestCutoff)
-
-
-
-
2536 s <<
"This is not manifest " <<
seq;
-
2537 b.manifest = s.
str();
-
-
-
-
-
2542 auto const maxSequence = blobInfos.
rbegin()->first;
-
2543 BEAST_EXPECT(maxSequence == 12);
-
-
-
-
-
-
-
2550 verifyBuildMessages(
-
2551 ValidatorList::buildValidatorListMessages(
-
2552 1, 8, maxSequence, version,
manifest, blobInfos, messages),
-
-
-
2555 BEAST_EXPECT(messages.size() == 0);
-
-
-
-
-
-
2561 messages.emplace_back();
-
2562 verifyBuildMessages(
-
2563 ValidatorList::buildValidatorListMessages(
-
2564 1, 3, maxSequence, version,
manifest, blobInfos, messages),
-
-
-
2567 BEAST_EXPECT(messages.size() == 1 && !messages.front().message);
-
-
-
-
2571 verifyBuildMessages(
-
2572 ValidatorList::buildValidatorListMessages(
-
2573 1, 3, maxSequence, version,
manifest, blobInfos, messages),
-
-
-
2576 if (BEAST_EXPECT(messages.size() == 1) &&
-
2577 BEAST_EXPECT(messages.front().message))
-
-
2579 auto const& messageWithHash = messages.front();
-
2580 auto const msg = extractProtocolMessage1(*messageWithHash.message);
-
-
2582 messageWithHash.message->getBuffer(compression::Compressed::Off)
-
-
-
2585 BEAST_EXPECT(size == 108);
-
2586 auto const& expected = blobInfos.at(5);
-
2587 if (BEAST_EXPECT(msg))
-
-
2589 BEAST_EXPECT(msg->version() == 1);
-
2590 BEAST_EXPECT(msg->manifest() == *expected.manifest);
-
2591 BEAST_EXPECT(msg->blob() == expected.blob);
-
2592 BEAST_EXPECT(msg->signature() == expected.signature);
-
-
-
2595 messageWithHash.hash ==
-
-
2597 *expected.manifest, expected.blob, expected.signature, 1));
-
-
-
-
-
-
-
-
2605 verifyBuildMessages(
-
2606 ValidatorList::buildValidatorListMessages(
-
-
-
-
-
-
-
-
-
-
2616 BEAST_EXPECT(messages.size() == 0);
-
-
-
-
-
-
2622 messages.emplace_back();
-
2623 verifyBuildMessages(
-
2624 ValidatorList::buildValidatorListMessages(
-
2625 2, 3, maxSequence, version,
manifest, blobInfos, messages),
-
-
-
2628 BEAST_EXPECT(messages.size() == 1 && !messages.front().message);
-
-
-
-
2632 verifyBuildMessages(
-
2633 ValidatorList::buildValidatorListMessages(
-
2634 2, 5, maxSequence, version,
manifest, blobInfos, messages),
-
-
-
-
2638 version,
manifest, blobInfos, messages, {{372, {6, 7, 10, 12}}});
-
-
-
-
-
-
2644 verifyBuildMessages(
-
2645 ValidatorList::buildValidatorListMessages(
-
2646 2, 5, maxSequence, version,
manifest, blobInfos, messages, 300),
-
-
-
-
-
-
-
-
2654 {{212, {6, 7}}, {192, {10, 12}}});
-
-
-
-
-
2659 verifyBuildMessages(
-
2660 ValidatorList::buildValidatorListMessages(
-
2661 2, 5, maxSequence, version,
manifest, blobInfos, messages, 200),
-
-
-
-
-
-
-
-
2669 {{108, {6}}, {108, {7}}, {192, {10, 12}}});
-
-
-
-
2673 verifyBuildMessages(
-
2674 ValidatorList::buildValidatorListMessages(
-
2675 2, 5, maxSequence, version,
manifest, blobInfos, messages, 150),
-
-
-
-
-
-
-
-
2683 {{108, {6}}, {108, {7}}, {110, {10}}, {110, {12}}});
-
-
-
-
-
2688 verifyBuildMessages(
-
2689 ValidatorList::buildValidatorListMessages(
-
2690 2, 5, maxSequence, version,
manifest, blobInfos, messages, 108),
-
-
-
-
-
-
-
-
2698 {{108, {6}}, {108, {7}}, {110, {10}}, {110, {12}}});
-
+
+
2374 header->message_type == protocol::mtVALIDATOR_LIST))
+
+
+
2377 detail::parseMessageContent<protocol::TMValidatorList>(
+
2378 *header, buffers.data());
+
+
+
+
+
+
2384 auto extractProtocolMessage2 = [
this,
+
2385 &extractHeader](
Message& message) {
+
2386 auto [header, buffers] = extractHeader(message);
+
2387 if (BEAST_EXPECT(header) &&
+
+
2389 header->message_type ==
+
2390 protocol::mtVALIDATOR_LIST_COLLECTION))
+
+
2392 auto const msg = detail::parseMessageContent<
+
2393 protocol::TMValidatorListCollection>(
+
2394 *header, buffers.data());
+
+
+
+
+
+
2400 auto verifyMessage =
+
+
+
2403 &extractProtocolMessage1,
+
2404 &extractProtocolMessage2](
+
+
+
2407 auto const& blobInfos,
+
2408 auto const& messages,
+
+
+
2411 BEAST_EXPECT(messages.size() == expectedInfo.size());
+
2412 auto msgIter = expectedInfo.begin();
+
2413 for (
auto const& messageWithHash : messages)
+
+
2415 if (!BEAST_EXPECT(msgIter != expectedInfo.end()))
+
+
2417 if (!BEAST_EXPECT(messageWithHash.message))
+
+
2419 auto const& expectedSeqs = msgIter->second;
+
2420 auto seqIter = expectedSeqs.begin();
+
+
2422 messageWithHash.message
+
2423 ->getBuffer(compression::Compressed::Off)
+
+
+
2426 BEAST_EXPECT(size == msgIter->first);
+
2427 if (expectedSeqs.size() == 1)
+
+
+
2430 extractProtocolMessage1(*messageWithHash.message);
+
2431 auto const expectedVersion = 1;
+
2432 if (BEAST_EXPECT(msg))
+
+
2434 BEAST_EXPECT(msg->version() == expectedVersion);
+
2435 if (!BEAST_EXPECT(seqIter != expectedSeqs.end()))
+
+
2437 auto const& expectedBlob = blobInfos.at(*seqIter);
+
+
2439 (*seqIter < manifestCutoff) ==
+
2440 !!expectedBlob.manifest);
+
2441 auto const expectedManifest =
+
2442 *seqIter < manifestCutoff &&
+
2443 expectedBlob.manifest
+
2444 ? *expectedBlob.manifest
+
+
2446 BEAST_EXPECT(msg->manifest() == expectedManifest);
+
2447 BEAST_EXPECT(msg->blob() == expectedBlob.blob);
+
+
2449 msg->signature() == expectedBlob.signature);
+
+
2451 BEAST_EXPECT(seqIter == expectedSeqs.end());
+
+
+
2454 messageWithHash.hash ==
+
+
+
+
2458 expectedBlob.signature,
+
+
+
+
+
+
+
2465 hashingBlobs.
reserve(msgIter->second.size());
+
+
+
2468 extractProtocolMessage2(*messageWithHash.message);
+
2469 if (BEAST_EXPECT(msg))
+
+
2471 BEAST_EXPECT(msg->version() == version);
+
2472 BEAST_EXPECT(msg->manifest() ==
manifest);
+
2473 for (
auto const& blobInfo : msg->blobs())
+
+
+
2476 seqIter != expectedSeqs.end()))
+
+
2478 auto const& expectedBlob =
+
2479 blobInfos.at(*seqIter);
+
+
+
2482 blobInfo.has_manifest() ==
+
2483 !!expectedBlob.manifest);
+
+
2485 blobInfo.has_manifest() ==
+
2486 (*seqIter < manifestCutoff));
+
+
2488 if (*seqIter < manifestCutoff)
+
+
2490 blobInfo.manifest() ==
+
2491 *expectedBlob.manifest);
+
+
2493 blobInfo.blob() == expectedBlob.blob);
+
+
2495 blobInfo.signature() ==
+
2496 expectedBlob.signature);
+
+
+
2499 BEAST_EXPECT(seqIter == expectedSeqs.end());
+
+
+
2502 messageWithHash.hash ==
+
+
+
+
+
2507 BEAST_EXPECT(msgIter == expectedInfo.end());
+
+
2509 auto verifyBuildMessages =
+
+
+
+
+
2514 BEAST_EXPECT(result.
first == expectedSequence);
+
2515 BEAST_EXPECT(result.
second == expectedSize);
+
+
+
+
+
+
2521 auto const blobInfos = [manifestCutoff = manifestCutoff]() {
+
+
+
2524 for (
auto seq : {5, 6, 7, 10, 12})
+
+
+
+
2528 s <<
"This is not a blob with sequence " <<
seq;
+
+
+
2531 s <<
"This is not a signature for sequence " <<
seq;
+
2532 b.signature = s.
str();
+
2533 if (
seq < manifestCutoff)
+
+
+
+
2537 s <<
"This is not manifest " <<
seq;
+
2538 b.manifest = s.
str();
+
+
+
+
+
2543 auto const maxSequence = blobInfos.
rbegin()->first;
+
2544 BEAST_EXPECT(maxSequence == 12);
+
+
+
+
+
+
+
2551 verifyBuildMessages(
+
2552 ValidatorList::buildValidatorListMessages(
+
2553 1, 8, maxSequence, version,
manifest, blobInfos, messages),
+
+
+
2556 BEAST_EXPECT(messages.size() == 0);
+
+
+
+
+
+
2562 messages.emplace_back();
+
2563 verifyBuildMessages(
+
2564 ValidatorList::buildValidatorListMessages(
+
2565 1, 3, maxSequence, version,
manifest, blobInfos, messages),
+
+
+
2568 BEAST_EXPECT(messages.size() == 1 && !messages.front().message);
+
+
+
+
2572 verifyBuildMessages(
+
2573 ValidatorList::buildValidatorListMessages(
+
2574 1, 3, maxSequence, version,
manifest, blobInfos, messages),
+
+
+
2577 if (BEAST_EXPECT(messages.size() == 1) &&
+
2578 BEAST_EXPECT(messages.front().message))
+
+
2580 auto const& messageWithHash = messages.front();
+
2581 auto const msg = extractProtocolMessage1(*messageWithHash.message);
+
+
2583 messageWithHash.message->getBuffer(compression::Compressed::Off)
+
+
+
2586 BEAST_EXPECT(size == 108);
+
2587 auto const& expected = blobInfos.at(5);
+
2588 if (BEAST_EXPECT(msg))
+
+
2590 BEAST_EXPECT(msg->version() == 1);
+
2591 BEAST_EXPECT(msg->manifest() == *expected.manifest);
+
2592 BEAST_EXPECT(msg->blob() == expected.blob);
+
2593 BEAST_EXPECT(msg->signature() == expected.signature);
+
+
+
2596 messageWithHash.hash ==
+
+
2598 *expected.manifest, expected.blob, expected.signature, 1));
+
+
+
+
+
+
+
+
2606 verifyBuildMessages(
+
2607 ValidatorList::buildValidatorListMessages(
+
+
+
+
+
+
+
+
+
+
2617 BEAST_EXPECT(messages.size() == 0);
+
+
+
+
+
+
2623 messages.emplace_back();
+
2624 verifyBuildMessages(
+
2625 ValidatorList::buildValidatorListMessages(
+
2626 2, 3, maxSequence, version,
manifest, blobInfos, messages),
+
+
+
2629 BEAST_EXPECT(messages.size() == 1 && !messages.front().message);
+
+
+
+
2633 verifyBuildMessages(
+
2634 ValidatorList::buildValidatorListMessages(
+
2635 2, 5, maxSequence, version,
manifest, blobInfos, messages),
+
+
+
+
2639 version,
manifest, blobInfos, messages, {{372, {6, 7, 10, 12}}});
+
+
+
+
+
+
2645 verifyBuildMessages(
+
2646 ValidatorList::buildValidatorListMessages(
+
2647 2, 5, maxSequence, version,
manifest, blobInfos, messages, 300),
+
+
+
+
+
+
+
+
2655 {{212, {6, 7}}, {192, {10, 12}}});
+
+
+
+
+
2660 verifyBuildMessages(
+
2661 ValidatorList::buildValidatorListMessages(
+
2662 2, 5, maxSequence, version,
manifest, blobInfos, messages, 200),
+
+
+
+
+
+
+
+
2670 {{108, {6}}, {108, {7}}, {192, {10, 12}}});
+
+
+
+
2674 verifyBuildMessages(
+
2675 ValidatorList::buildValidatorListMessages(
+
2676 2, 5, maxSequence, version,
manifest, blobInfos, messages, 150),
+
+
+
+
+
+
+
+
2684 {{108, {6}}, {108, {7}}, {110, {10}}, {110, {12}}});
+
+
+
+
+
2689 verifyBuildMessages(
+
2690 ValidatorList::buildValidatorListMessages(
+
2691 2, 5, maxSequence, version,
manifest, blobInfos, messages, 108),
+
+
+
+
+
+
+
+
2699 {{108, {6}}, {108, {7}}, {110, {10}}, {110, {12}}});
+
-
-
-
2704 testcase(
"Test quorum disabled");
-
-
2706 std::string const siteUri =
"testQuorumDisabled.test";
-
-
2708 auto& app = env.
app();
-
-
-
-
-
2713 while (valKeys.
size() != maxKeys)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
2730 auto makeValidatorList = [&,
this](
-
-
-
-
-
-
-
-
-
-
-
-
-
2743 app.config().legacy(
"database_path"),
-
-
-
-
-
-
-
2750 auto const publisherPublic =
-
-
2752 auto const pubSigningKeys =
randomKeyPair(KeyType::secp256k1);
-
-
-
-
-
-
-
-
2760 pubSigningKeys.first,
-
2761 pubSigningKeys.second,
-
2762 i < countRevoked ?
revoked : 1));
-
2763 publishers.push_back(Publisher{
-
-
-
-
-
-
-
-
-
-
-
-
2775 valManifests.applyManifest(
-
-
2777 BEAST_EXPECT(result->load(
-
2778 self->signingPublic,
-
-
-
-
-
-
-
-
2786 result->load({}, emptyCfgKeys, cfgPublishers, threshold));
-
-
-
-
-
2791 using namespace std::chrono_literals;
-
-
2793 (i == countTotal - 1 ? 60s : 3600s);
-
2794 auto const blob = makeList(
-
-
-
2797 publishers[i].expiry.time_since_epoch().count());
-
2798 auto const sig = signList(blob, publishers[i].signingKeys);
-
-
-
-
-
-
-
-
-
2807 .bestDisposition() ==
-
2808 (publishers[i].
revoked ? ListDisposition::untrusted
-
2809 : ListDisposition::accepted));
-
-
-
-
-
-
-
-
-
-
-
-
-
-
2823 auto const self = randomValidator();
-
2824 auto const keysTotal = valKeys.
size() + 1;
-
2825 auto trustedKeys = makeValidatorList(
-
-
-
-
-
-
-
-
2833 BEAST_EXPECT(trustedKeys->getListThreshold() == 5);
-
2834 for (
auto const& p : publishers)
-
2835 BEAST_EXPECT(trustedKeys->trustedPublisher(p.pubKey));
-
-
-
-
-
-
-
-
2843 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
-
-
2845 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
-
-
-
-
2849 for (
auto const& val : valKeys)
-
-
2851 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
-
-
-
2854 BEAST_EXPECT(changes.
added == added);
-
2855 BEAST_EXPECT(changes.
removed.empty());
-
-
-
-
2859 changes = trustedKeys->updateTrusted(
-
-
-
-
-
-
2865 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
-
2866 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1);
-
-
-
2869 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
-
2870 for (
auto const& val : valKeys)
-
-
2872 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
-
2873 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
-
-
-
2876 BEAST_EXPECT(changes.
added.empty());
-
2877 BEAST_EXPECT(changes.
removed == removed);
-
-
-
-
-
-
-
2884 auto const keysTotal = valKeys.
size();
-
2885 auto trustedKeys = makeValidatorList(
-
-
-
-
-
-
-
-
2893 BEAST_EXPECT(trustedKeys->getListThreshold() == 5);
-
2894 for (
auto const& p : publishers)
-
2895 BEAST_EXPECT(trustedKeys->trustedPublisher(p.pubKey));
-
-
-
-
-
-
-
-
2903 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
-
-
2905 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
-
-
-
2908 for (
auto const& val : valKeys)
-
-
2910 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
-
-
-
2913 BEAST_EXPECT(changes.
added == added);
-
2914 BEAST_EXPECT(changes.
removed.empty());
-
-
-
-
2918 changes = trustedKeys->updateTrusted(
-
-
-
-
-
-
2924 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
-
2925 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 0);
-
-
-
2928 for (
auto const& val : valKeys)
-
-
2930 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
-
2931 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
-
-
-
2934 BEAST_EXPECT(changes.
added.empty());
-
2935 BEAST_EXPECT(changes.
removed == removed);
-
-
-
-
-
-
-
-
2943 auto const self = valKeys[1];
-
2944 auto const keysTotal = valKeys.
size();
-
2945 auto trustedKeys = makeValidatorList(
-
-
-
-
-
-
-
-
2953 BEAST_EXPECT(trustedKeys->getListThreshold() == 4);
-
2954 int untrustedCount = 0;
-
2955 for (
auto const& p : publishers)
-
-
2957 bool const trusted = trustedKeys->trustedPublisher(p.pubKey);
-
2958 BEAST_EXPECT(p.revoked ^ trusted);
-
2959 untrustedCount += trusted ? 0 : 1;
-
-
2961 BEAST_EXPECT(untrustedCount == 1);
-
-
-
-
-
-
-
-
2969 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
-
-
2971 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
-
-
-
2974 for (
auto const& val : valKeys)
-
-
2976 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
-
-
-
2979 BEAST_EXPECT(changes.
added == added);
-
2980 BEAST_EXPECT(changes.
removed.empty());
-
-
-
-
2984 changes = trustedKeys->updateTrusted(
-
-
-
-
-
-
2990 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
-
2991 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1);
-
-
-
2994 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
-
2995 for (
auto const& val : valKeys)
-
-
2997 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
-
2998 if (val.masterPublic != self.masterPublic)
-
-
3000 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
-
-
-
-
3004 BEAST_EXPECT(changes.
added.empty());
-
3005 BEAST_EXPECT(changes.
removed == removed);
-
-
-
-
-
-
-
-
3013 auto const self = randomValidator();
-
3014 auto const keysTotal = valKeys.
size() + 1;
-
3015 auto trustedKeys = makeValidatorList(
-
-
-
-
-
-
-
-
3023 BEAST_EXPECT(trustedKeys->getListThreshold() == 3);
-
3024 int untrustedCount = 0;
-
3025 for (
auto const& p : publishers)
-
-
3027 bool const trusted = trustedKeys->trustedPublisher(p.pubKey);
-
3028 BEAST_EXPECT(p.revoked ^ trusted);
-
3029 untrustedCount += trusted ? 0 : 1;
-
-
3031 BEAST_EXPECT(untrustedCount == 2);
-
-
-
-
-
-
-
-
3039 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
-
-
3041 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
-
-
-
-
3045 for (
auto const& val : valKeys)
-
-
3047 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
-
-
-
3050 BEAST_EXPECT(changes.
added == added);
-
3051 BEAST_EXPECT(changes.
removed.empty());
-
-
-
-
3055 changes = trustedKeys->updateTrusted(
-
-
-
-
-
-
3061 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
-
3062 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1);
-
-
-
3065 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
-
3066 for (
auto const& val : valKeys)
-
-
3068 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
-
3069 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
-
-
-
3072 BEAST_EXPECT(changes.
added.empty());
-
3073 BEAST_EXPECT(changes.
removed == removed);
-
-
-
-
-
-
-
-
3081 auto const self = valKeys[5];
-
3082 auto const keysTotal = valKeys.
size();
-
3083 auto trustedKeys = makeValidatorList(
-
-
-
-
-
-
-
-
3091 BEAST_EXPECT(trustedKeys->getListThreshold() == 3);
-
3092 int untrustedCount = 0;
-
3093 for (
auto const& p : publishers)
-
-
3095 bool const trusted = trustedKeys->trustedPublisher(p.pubKey);
-
3096 BEAST_EXPECT(p.revoked ^ trusted);
-
3097 untrustedCount += trusted ? 0 : 1;
-
-
3099 BEAST_EXPECT(untrustedCount == 2);
-
-
-
-
-
-
-
-
3107 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
-
-
3109 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
-
-
-
3112 for (
auto const& val : valKeys)
-
-
3114 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
-
-
-
3117 BEAST_EXPECT(changes.
added == added);
-
3118 BEAST_EXPECT(changes.
removed.empty());
-
-
-
-
3122 changes = trustedKeys->updateTrusted(
-
-
-
-
-
-
3128 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
-
3129 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1);
-
-
-
3132 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
-
3133 for (
auto const& val : valKeys)
-
-
3135 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
-
3136 if (val.masterPublic != self.masterPublic)
-
-
3138 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
-
-
-
-
3142 BEAST_EXPECT(changes.
added.empty());
-
3143 BEAST_EXPECT(changes.
removed == removed);
-
-
-
-
-
-
-
3150 auto const keysTotal = valKeys.
size();
-
3151 auto trustedKeys = makeValidatorList(
-
-
-
-
-
-
-
-
3159 BEAST_EXPECT(trustedKeys->getListThreshold() == 3);
-
3160 int untrustedCount = 0;
-
3161 for (
auto const& p : publishers)
-
-
3163 bool const trusted = trustedKeys->trustedPublisher(p.pubKey);
-
3164 BEAST_EXPECT(p.revoked ^ trusted);
-
3165 untrustedCount += trusted ? 0 : 1;
-
-
3167 BEAST_EXPECT(untrustedCount == 2);
-
-
-
-
-
-
-
-
3175 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
-
-
3177 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
-
-
-
3180 for (
auto const& val : valKeys)
-
-
3182 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
-
-
-
3185 BEAST_EXPECT(changes.
added == added);
-
3186 BEAST_EXPECT(changes.
removed.empty());
-
-
-
-
3190 changes = trustedKeys->updateTrusted(
-
-
-
-
-
-
3196 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
-
3197 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 0);
-
-
-
3200 for (
auto const& val : valKeys)
-
-
3202 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
-
3203 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
-
-
-
3206 BEAST_EXPECT(changes.
added.empty());
-
3207 BEAST_EXPECT(changes.
removed == removed);
-
-
-
-
-
-
-
-
3215 auto const self = randomValidator();
-
3216 auto const keysTotal = valKeys.
size() + 1;
-
3217 auto trustedKeys = makeValidatorList(
-
-
-
-
-
-
-
-
3225 BEAST_EXPECT(trustedKeys->getListThreshold() == 2);
-
3226 int untrustedCount = 0;
-
3227 for (
auto const& p : publishers)
-
-
3229 bool const trusted = trustedKeys->trustedPublisher(p.pubKey);
-
3230 BEAST_EXPECT(p.revoked ^ trusted);
-
3231 untrustedCount += trusted ? 0 : 1;
-
-
3233 BEAST_EXPECT(untrustedCount == 1);
-
-
-
-
-
-
-
-
3241 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
-
-
3243 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
-
-
-
-
3247 for (
auto const& val : valKeys)
-
-
3249 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
-
-
-
3252 BEAST_EXPECT(changes.
added == added);
-
3253 BEAST_EXPECT(changes.
removed.empty());
-
-
-
-
3257 changes = trustedKeys->updateTrusted(
-
-
-
-
-
-
3263 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
-
-
3265 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
-
-
3267 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
-
3268 for (
auto const& val : valKeys)
-
-
3270 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
-
3271 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
-
-
3273 BEAST_EXPECT(changes.
added.empty());
-
3274 BEAST_EXPECT(changes.
removed.empty());
-
-
-
-
-
-
-
-
3282 auto const self = randomValidator();
-
3283 auto const keysTotal = valKeys.
size() + 1;
-
3284 auto trustedKeys = makeValidatorList(
-
-
-
-
-
-
-
-
3292 BEAST_EXPECT(trustedKeys->getListThreshold() == 1);
-
3293 for (
auto const& p : publishers)
-
3294 BEAST_EXPECT(trustedKeys->trustedPublisher(p.pubKey));
-
-
-
-
-
-
-
-
3302 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
-
-
3304 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
-
-
-
-
3308 for (
auto const& val : valKeys)
-
-
3310 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
-
-
-
3313 BEAST_EXPECT(changes.
added == added);
-
3314 BEAST_EXPECT(changes.
removed.empty());
-
-
-
-
3318 changes = trustedKeys->updateTrusted(
-
-
-
-
-
-
3324 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
-
-
3326 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
-
-
3328 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
-
3329 for (
auto const& val : valKeys)
-
-
3331 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
-
3332 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
-
-
3334 BEAST_EXPECT(changes.
added.empty());
-
3335 BEAST_EXPECT(changes.
removed.empty());
-
-
-
-
-
-
-
-
3343 auto const self = valKeys[7];
-
3344 auto const keysTotal = valKeys.
size();
-
3345 auto trustedKeys = makeValidatorList(
-
-
-
-
-
-
-
-
3353 BEAST_EXPECT(trustedKeys->getListThreshold() == 1);
-
3354 for (
auto const& p : publishers)
-
3355 BEAST_EXPECT(trustedKeys->trustedPublisher(p.pubKey));
-
-
-
-
-
-
-
-
3363 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
-
-
3365 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
-
-
-
3368 for (
auto const& val : valKeys)
-
-
3370 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
-
-
-
3373 BEAST_EXPECT(changes.
added == added);
-
3374 BEAST_EXPECT(changes.
removed.empty());
-
-
-
-
3378 changes = trustedKeys->updateTrusted(
-
-
-
-
-
-
3384 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
-
-
3386 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
-
-
3388 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
-
3389 for (
auto const& val : valKeys)
-
-
3391 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
-
3392 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
-
-
3394 BEAST_EXPECT(changes.
added.empty());
-
3395 BEAST_EXPECT(changes.
removed.empty());
-
-
-
-
-
-
-
3402 auto const keysTotal = valKeys.
size();
-
3403 auto trustedKeys = makeValidatorList(
-
-
-
-
-
-
-
-
3411 BEAST_EXPECT(trustedKeys->getListThreshold() == 1);
-
3412 for (
auto const& p : publishers)
-
3413 BEAST_EXPECT(trustedKeys->trustedPublisher(p.pubKey));
-
-
-
-
-
-
-
-
3421 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
-
-
3423 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
-
-
-
3426 for (
auto const& val : valKeys)
-
-
3428 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
-
-
-
3431 BEAST_EXPECT(changes.
added == added);
-
3432 BEAST_EXPECT(changes.
removed.empty());
-
-
-
-
3436 changes = trustedKeys->updateTrusted(
-
-
-
-
-
-
3442 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
-
-
3444 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
-
-
3446 for (
auto const& val : valKeys)
-
-
3448 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
-
3449 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
-
-
3451 BEAST_EXPECT(changes.
added.empty());
-
3452 BEAST_EXPECT(changes.
removed.empty());
-
-
-
-
-
-
-
-
-
-
3462 auto const self = randomValidator();
-
3463 auto const keysTotal = valKeys.
size() + 1;
-
3464 auto trustedKeys = makeValidatorList(
-
-
+
+
+
+
+
+
2705 testcase(
"Test quorum disabled");
+
+
2707 std::string const siteUri =
"testQuorumDisabled.test";
+
+
2709 auto& app = env.
app();
+
+
+
+
+
2714 while (valKeys.
size() != maxKeys)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
2731 auto makeValidatorList = [&,
this](
+
+
+
+
+
+
+
+
+
+
+
+
+
2744 app.config().legacy(
"database_path"),
+
+
+
+
+
+
+
2751 auto const publisherPublic =
+
+
2753 auto const pubSigningKeys =
randomKeyPair(KeyType::secp256k1);
+
+
+
+
+
+
+
+
2761 pubSigningKeys.first,
+
2762 pubSigningKeys.second,
+
2763 i < countRevoked ?
revoked : 1));
+
2764 publishers.push_back(Publisher{
+
+
+
+
+
+
+
+
+
+
+
+
2776 valManifests.applyManifest(
+
+
2778 BEAST_EXPECT(result->load(
+
2779 self->signingPublic,
+
+
+
+
+
+
+
+
2787 result->load({}, emptyCfgKeys, cfgPublishers, threshold));
+
+
+
+
+
2792 using namespace std::chrono_literals;
+
+
2794 (i == countTotal - 1 ? 60s : 3600s);
+
2795 auto const blob = makeList(
+
+
+
2798 publishers[i].expiry.time_since_epoch().count());
+
2799 auto const sig = signList(blob, publishers[i].signingKeys);
+
+
+
+
+
+
+
+
+
2808 .bestDisposition() ==
+
2809 (publishers[i].
revoked ? ListDisposition::untrusted
+
2810 : ListDisposition::accepted));
+
+
+
+
+
+
+
+
+
+
+
+
+
+
2824 auto const self = randomValidator();
+
2825 auto const keysTotal = valKeys.
size() + 1;
+
2826 auto trustedKeys = makeValidatorList(
+
+
+
+
+
+
+
+
2834 BEAST_EXPECT(trustedKeys->getListThreshold() == 5);
+
2835 for (
auto const& p : publishers)
+
2836 BEAST_EXPECT(trustedKeys->trustedPublisher(p.pubKey));
+
+
+
+
+
+
+
+
2844 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
+
+
2846 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
+
+
+
+
2850 for (
auto const& val : valKeys)
+
+
2852 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
+
+
+
2855 BEAST_EXPECT(changes.
added == added);
+
2856 BEAST_EXPECT(changes.
removed.empty());
+
+
+
+
2860 changes = trustedKeys->updateTrusted(
+
+
+
+
+
+
2866 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
+
2867 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1);
+
+
+
2870 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
+
2871 for (
auto const& val : valKeys)
+
+
2873 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
+
2874 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
+
+
+
2877 BEAST_EXPECT(changes.
added.empty());
+
2878 BEAST_EXPECT(changes.
removed == removed);
+
+
+
+
+
+
+
2885 auto const keysTotal = valKeys.
size();
+
2886 auto trustedKeys = makeValidatorList(
+
+
+
+
+
+
+
+
2894 BEAST_EXPECT(trustedKeys->getListThreshold() == 5);
+
2895 for (
auto const& p : publishers)
+
2896 BEAST_EXPECT(trustedKeys->trustedPublisher(p.pubKey));
+
+
+
+
+
+
+
+
2904 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
+
+
2906 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
+
+
+
2909 for (
auto const& val : valKeys)
+
+
2911 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
+
+
+
2914 BEAST_EXPECT(changes.
added == added);
+
2915 BEAST_EXPECT(changes.
removed.empty());
+
+
+
+
2919 changes = trustedKeys->updateTrusted(
+
+
+
+
+
+
2925 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
+
2926 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 0);
+
+
+
2929 for (
auto const& val : valKeys)
+
+
2931 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
+
2932 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
+
+
+
2935 BEAST_EXPECT(changes.
added.empty());
+
2936 BEAST_EXPECT(changes.
removed == removed);
+
+
+
+
+
+
+
+
2944 auto const self = valKeys[1];
+
2945 auto const keysTotal = valKeys.
size();
+
2946 auto trustedKeys = makeValidatorList(
+
+
+
+
+
+
+
+
2954 BEAST_EXPECT(trustedKeys->getListThreshold() == 4);
+
2955 int untrustedCount = 0;
+
2956 for (
auto const& p : publishers)
+
+
2958 bool const trusted = trustedKeys->trustedPublisher(p.pubKey);
+
2959 BEAST_EXPECT(p.revoked ^ trusted);
+
2960 untrustedCount += trusted ? 0 : 1;
+
+
2962 BEAST_EXPECT(untrustedCount == 1);
+
+
+
+
+
+
+
+
2970 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
+
+
2972 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
+
+
+
2975 for (
auto const& val : valKeys)
+
+
2977 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
+
+
+
2980 BEAST_EXPECT(changes.
added == added);
+
2981 BEAST_EXPECT(changes.
removed.empty());
+
+
+
+
2985 changes = trustedKeys->updateTrusted(
+
+
+
+
+
+
2991 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
+
2992 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1);
+
+
+
2995 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
+
2996 for (
auto const& val : valKeys)
+
+
2998 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
+
2999 if (val.masterPublic != self.masterPublic)
+
+
3001 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
+
+
+
+
3005 BEAST_EXPECT(changes.
added.empty());
+
3006 BEAST_EXPECT(changes.
removed == removed);
+
+
+
+
+
+
+
+
3014 auto const self = randomValidator();
+
3015 auto const keysTotal = valKeys.
size() + 1;
+
3016 auto trustedKeys = makeValidatorList(
+
+
+
+
+
+
+
+
3024 BEAST_EXPECT(trustedKeys->getListThreshold() == 3);
+
3025 int untrustedCount = 0;
+
3026 for (
auto const& p : publishers)
+
+
3028 bool const trusted = trustedKeys->trustedPublisher(p.pubKey);
+
3029 BEAST_EXPECT(p.revoked ^ trusted);
+
3030 untrustedCount += trusted ? 0 : 1;
+
+
3032 BEAST_EXPECT(untrustedCount == 2);
+
+
+
+
+
+
+
+
3040 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
+
+
3042 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
+
+
+
+
3046 for (
auto const& val : valKeys)
+
+
3048 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
+
+
+
3051 BEAST_EXPECT(changes.
added == added);
+
3052 BEAST_EXPECT(changes.
removed.empty());
+
+
+
+
3056 changes = trustedKeys->updateTrusted(
+
+
+
+
+
+
3062 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
+
3063 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1);
+
+
+
3066 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
+
3067 for (
auto const& val : valKeys)
+
+
3069 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
+
3070 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
+
+
+
3073 BEAST_EXPECT(changes.
added.empty());
+
3074 BEAST_EXPECT(changes.
removed == removed);
+
+
+
+
+
+
+
+
3082 auto const self = valKeys[5];
+
3083 auto const keysTotal = valKeys.
size();
+
3084 auto trustedKeys = makeValidatorList(
+
+
+
+
+
+
+
+
3092 BEAST_EXPECT(trustedKeys->getListThreshold() == 3);
+
3093 int untrustedCount = 0;
+
3094 for (
auto const& p : publishers)
+
+
3096 bool const trusted = trustedKeys->trustedPublisher(p.pubKey);
+
3097 BEAST_EXPECT(p.revoked ^ trusted);
+
3098 untrustedCount += trusted ? 0 : 1;
+
+
3100 BEAST_EXPECT(untrustedCount == 2);
+
+
+
+
+
+
+
+
3108 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
+
+
3110 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
+
+
+
3113 for (
auto const& val : valKeys)
+
+
3115 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
+
+
+
3118 BEAST_EXPECT(changes.
added == added);
+
3119 BEAST_EXPECT(changes.
removed.empty());
+
+
+
+
3123 changes = trustedKeys->updateTrusted(
+
+
+
+
+
+
3129 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
+
3130 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1);
+
+
+
3133 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
+
3134 for (
auto const& val : valKeys)
+
+
3136 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
+
3137 if (val.masterPublic != self.masterPublic)
+
+
3139 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
+
+
+
+
3143 BEAST_EXPECT(changes.
added.empty());
+
3144 BEAST_EXPECT(changes.
removed == removed);
+
+
+
+
+
+
+
3151 auto const keysTotal = valKeys.
size();
+
3152 auto trustedKeys = makeValidatorList(
+
+
+
+
+
+
+
+
3160 BEAST_EXPECT(trustedKeys->getListThreshold() == 3);
+
3161 int untrustedCount = 0;
+
3162 for (
auto const& p : publishers)
+
+
3164 bool const trusted = trustedKeys->trustedPublisher(p.pubKey);
+
3165 BEAST_EXPECT(p.revoked ^ trusted);
+
3166 untrustedCount += trusted ? 0 : 1;
+
+
3168 BEAST_EXPECT(untrustedCount == 2);
+
+
+
+
+
+
+
+
3176 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
+
+
3178 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
+
+
+
3181 for (
auto const& val : valKeys)
+
+
3183 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
+
+
+
3186 BEAST_EXPECT(changes.
added == added);
+
3187 BEAST_EXPECT(changes.
removed.empty());
+
+
+
+
3191 changes = trustedKeys->updateTrusted(
+
+
+
+
+
+
3197 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
+
3198 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 0);
+
+
+
3201 for (
auto const& val : valKeys)
+
+
3203 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
+
3204 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
+
+
+
3207 BEAST_EXPECT(changes.
added.empty());
+
3208 BEAST_EXPECT(changes.
removed == removed);
+
+
+
+
+
+
+
+
3216 auto const self = randomValidator();
+
3217 auto const keysTotal = valKeys.
size() + 1;
+
3218 auto trustedKeys = makeValidatorList(
+
+
+
+
+
+
+
+
3226 BEAST_EXPECT(trustedKeys->getListThreshold() == 2);
+
3227 int untrustedCount = 0;
+
3228 for (
auto const& p : publishers)
+
+
3230 bool const trusted = trustedKeys->trustedPublisher(p.pubKey);
+
3231 BEAST_EXPECT(p.revoked ^ trusted);
+
3232 untrustedCount += trusted ? 0 : 1;
+
+
3234 BEAST_EXPECT(untrustedCount == 1);
+
+
+
+
+
+
+
+
3242 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
+
+
3244 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
+
+
+
+
3248 for (
auto const& val : valKeys)
+
+
3250 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
+
+
+
3253 BEAST_EXPECT(changes.
added == added);
+
3254 BEAST_EXPECT(changes.
removed.empty());
+
+
+
+
3258 changes = trustedKeys->updateTrusted(
+
+
+
+
+
+
3264 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
+
+
3266 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
+
+
3268 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
+
3269 for (
auto const& val : valKeys)
+
+
3271 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
+
3272 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
+
+
3274 BEAST_EXPECT(changes.
added.empty());
+
3275 BEAST_EXPECT(changes.
removed.empty());
+
+
+
+
+
+
+
+
3283 auto const self = randomValidator();
+
3284 auto const keysTotal = valKeys.
size() + 1;
+
3285 auto trustedKeys = makeValidatorList(
+
+
+
+
+
+
+
+
3293 BEAST_EXPECT(trustedKeys->getListThreshold() == 1);
+
3294 for (
auto const& p : publishers)
+
3295 BEAST_EXPECT(trustedKeys->trustedPublisher(p.pubKey));
+
+
+
+
+
+
+
+
3303 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
+
+
3305 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
+
+
+
+
3309 for (
auto const& val : valKeys)
+
+
3311 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
+
+
+
3314 BEAST_EXPECT(changes.
added == added);
+
3315 BEAST_EXPECT(changes.
removed.empty());
+
+
+
+
3319 changes = trustedKeys->updateTrusted(
+
+
+
+
+
+
3325 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
+
+
3327 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
+
+
3329 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
+
3330 for (
auto const& val : valKeys)
+
+
3332 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
+
3333 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
+
+
3335 BEAST_EXPECT(changes.
added.empty());
+
3336 BEAST_EXPECT(changes.
removed.empty());
+
+
+
+
+
+
+
+
3344 auto const self = valKeys[7];
+
3345 auto const keysTotal = valKeys.
size();
+
3346 auto trustedKeys = makeValidatorList(
+
+
+
+
+
+
+
+
3354 BEAST_EXPECT(trustedKeys->getListThreshold() == 1);
+
3355 for (
auto const& p : publishers)
+
3356 BEAST_EXPECT(trustedKeys->trustedPublisher(p.pubKey));
+
+
+
+
+
+
+
+
3364 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
+
+
3366 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
+
+
+
3369 for (
auto const& val : valKeys)
+
+
3371 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
+
+
+
3374 BEAST_EXPECT(changes.
added == added);
+
3375 BEAST_EXPECT(changes.
removed.empty());
+
+
+
+
3379 changes = trustedKeys->updateTrusted(
+
+
+
+
+
+
3385 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
+
+
3387 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
+
+
3389 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
+
3390 for (
auto const& val : valKeys)
+
+
3392 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
+
3393 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
+
+
3395 BEAST_EXPECT(changes.
added.empty());
+
3396 BEAST_EXPECT(changes.
removed.empty());
+
+
+
+
+
+
+
3403 auto const keysTotal = valKeys.
size();
+
3404 auto trustedKeys = makeValidatorList(
+
+
+
+
+
+
+
+
3412 BEAST_EXPECT(trustedKeys->getListThreshold() == 1);
+
3413 for (
auto const& p : publishers)
+
3414 BEAST_EXPECT(trustedKeys->trustedPublisher(p.pubKey));
+
+
+
+
+
+
+
+
3422 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
+
+
3424 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
+
+
+
3427 for (
auto const& val : valKeys)
+
+
3429 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
+
+
+
3432 BEAST_EXPECT(changes.
added == added);
+
3433 BEAST_EXPECT(changes.
removed.empty());
+
+
+
+
3437 changes = trustedKeys->updateTrusted(
+
+
+
+
+
+
3443 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
+
+
3445 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
+
+
3447 for (
auto const& val : valKeys)
+
+
3449 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
+
3450 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
+
+
3452 BEAST_EXPECT(changes.
added.empty());
+
3453 BEAST_EXPECT(changes.
removed.empty());
+
+
+
+
+
+
+
+
+
+
3463 auto const self = randomValidator();
+
3464 auto const keysTotal = valKeys.
size() + 1;
+
3465 auto trustedKeys = makeValidatorList(
+
-
-
-
-
-
3472 BEAST_EXPECT(trustedKeys->getListThreshold() == 1);
-
3473 int untrustedCount = 0;
-
3474 for (
auto const& p : publishers)
-
-
3476 bool const trusted = trustedKeys->trustedPublisher(p.pubKey);
-
3477 BEAST_EXPECT(p.revoked ^ trusted);
-
3478 untrustedCount += trusted ? 0 : 1;
-
-
3480 BEAST_EXPECT(untrustedCount == 1);
-
-
-
-
-
-
-
-
3488 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
-
-
3490 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
-
-
-
-
3494 for (
auto const& val : valKeys)
-
-
3496 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
-
-
-
3499 BEAST_EXPECT(changes.
added == added);
-
3500 BEAST_EXPECT(changes.
removed.empty());
-
-
-
-
3504 changes = trustedKeys->updateTrusted(
-
-
-
-
-
-
3510 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
-
3511 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1);
-
-
-
3514 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
-
3515 for (
auto const& val : valKeys)
-
-
3517 BEAST_EXPECT(!trustedKeys->listed(val.masterPublic));
-
3518 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
-
-
-
3521 BEAST_EXPECT(changes.
added.empty());
-
3522 BEAST_EXPECT(changes.
removed == removed);
-
-
-
-
-
-
-
-
3530 auto const self = valKeys[5];
-
3531 auto const keysTotal = valKeys.
size();
-
3532 auto trustedKeys = makeValidatorList(
-
-
+
+
+
+
+
+
3473 BEAST_EXPECT(trustedKeys->getListThreshold() == 1);
+
3474 int untrustedCount = 0;
+
3475 for (
auto const& p : publishers)
+
+
3477 bool const trusted = trustedKeys->trustedPublisher(p.pubKey);
+
3478 BEAST_EXPECT(p.revoked ^ trusted);
+
3479 untrustedCount += trusted ? 0 : 1;
+
+
3481 BEAST_EXPECT(untrustedCount == 1);
+
+
+
+
+
+
+
+
3489 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
+
+
3491 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
+
+
+
+
3495 for (
auto const& val : valKeys)
+
+
3497 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
+
+
+
3500 BEAST_EXPECT(changes.
added == added);
+
3501 BEAST_EXPECT(changes.
removed.empty());
+
+
+
+
3505 changes = trustedKeys->updateTrusted(
+
+
+
+
+
+
3511 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
+
3512 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1);
+
+
+
3515 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
+
3516 for (
auto const& val : valKeys)
+
+
3518 BEAST_EXPECT(!trustedKeys->listed(val.masterPublic));
+
3519 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
+
+
+
3522 BEAST_EXPECT(changes.
added.empty());
+
3523 BEAST_EXPECT(changes.
removed == removed);
+
+
+
+
+
+
+
+
3531 auto const self = valKeys[5];
+
3532 auto const keysTotal = valKeys.
size();
+
3533 auto trustedKeys = makeValidatorList(
+
-
-
-
-
-
3540 BEAST_EXPECT(trustedKeys->getListThreshold() == 1);
-
3541 int untrustedCount = 0;
-
3542 for (
auto const& p : publishers)
-
-
3544 bool const trusted = trustedKeys->trustedPublisher(p.pubKey);
-
3545 BEAST_EXPECT(p.revoked ^ trusted);
-
3546 untrustedCount += trusted ? 0 : 1;
-
-
3548 BEAST_EXPECT(untrustedCount == 1);
-
-
-
-
-
-
-
-
3556 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
-
-
3558 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
-
-
-
3561 for (
auto const& val : valKeys)
-
-
3563 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
-
-
-
3566 BEAST_EXPECT(changes.
added == added);
-
3567 BEAST_EXPECT(changes.
removed.empty());
-
-
-
-
3571 changes = trustedKeys->updateTrusted(
-
-
-
-
-
-
3577 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
-
3578 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1);
-
-
-
3581 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
-
3582 for (
auto const& val : valKeys)
-
-
3584 if (val.masterPublic != self.masterPublic)
-
-
3586 BEAST_EXPECT(!trustedKeys->listed(val.masterPublic));
-
3587 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
-
-
-
-
3591 BEAST_EXPECT(changes.
added.empty());
-
3592 BEAST_EXPECT(changes.
removed == removed);
-
-
-
-
-
-
-
3599 auto const keysTotal = valKeys.
size();
-
3600 auto trustedKeys = makeValidatorList(
-
-
+
+
+
+
+
+
3541 BEAST_EXPECT(trustedKeys->getListThreshold() == 1);
+
3542 int untrustedCount = 0;
+
3543 for (
auto const& p : publishers)
+
+
3545 bool const trusted = trustedKeys->trustedPublisher(p.pubKey);
+
3546 BEAST_EXPECT(p.revoked ^ trusted);
+
3547 untrustedCount += trusted ? 0 : 1;
+
+
3549 BEAST_EXPECT(untrustedCount == 1);
+
+
+
+
+
+
+
+
3557 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
+
+
3559 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
+
+
+
3562 for (
auto const& val : valKeys)
+
+
3564 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
+
+
+
3567 BEAST_EXPECT(changes.
added == added);
+
3568 BEAST_EXPECT(changes.
removed.empty());
+
+
+
+
3572 changes = trustedKeys->updateTrusted(
+
+
+
+
+
+
3578 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
+
3579 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1);
+
+
+
3582 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
+
3583 for (
auto const& val : valKeys)
+
+
3585 if (val.masterPublic != self.masterPublic)
+
+
3587 BEAST_EXPECT(!trustedKeys->listed(val.masterPublic));
+
3588 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
+
+
+
+
3592 BEAST_EXPECT(changes.
added.empty());
+
3593 BEAST_EXPECT(changes.
removed == removed);
+
+
+
+
+
+
+
3600 auto const keysTotal = valKeys.
size();
+
3601 auto trustedKeys = makeValidatorList(
+
-
-
-
-
-
3608 BEAST_EXPECT(trustedKeys->getListThreshold() == 1);
-
3609 int untrustedCount = 0;
-
3610 for (
auto const& p : publishers)
-
-
3612 bool const trusted = trustedKeys->trustedPublisher(p.pubKey);
-
3613 BEAST_EXPECT(p.revoked ^ trusted);
-
3614 untrustedCount += trusted ? 0 : 1;
-
-
3616 BEAST_EXPECT(untrustedCount == 1);
-
-
-
-
-
-
-
-
3624 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
-
-
3626 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
-
-
-
3629 for (
auto const& val : valKeys)
-
-
3631 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
-
-
-
3634 BEAST_EXPECT(changes.
added == added);
-
3635 BEAST_EXPECT(changes.
removed.empty());
-
-
-
-
3639 changes = trustedKeys->updateTrusted(
-
-
-
-
-
-
3645 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
-
3646 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 0);
-
-
-
3649 for (
auto const& val : valKeys)
-
-
3651 BEAST_EXPECT(!trustedKeys->listed(val.masterPublic));
-
3652 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
-
-
-
3655 BEAST_EXPECT(changes.
added.empty());
-
3656 BEAST_EXPECT(changes.
removed == removed);
-
-
-
-
-
-
-
-
3664 auto const self = randomValidator();
-
3665 auto const keysTotal = valKeys.
size() + 1;
-
3666 auto trustedKeys = makeValidatorList(
-
-
-
-
-
-
-
-
3674 BEAST_EXPECT(trustedKeys->getListThreshold() == 2);
-
3675 for (
auto const& p : publishers)
-
3676 BEAST_EXPECT(trustedKeys->trustedPublisher(p.pubKey));
-
-
-
-
-
-
-
-
3684 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
-
-
3686 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
-
-
-
-
3690 for (
auto const& val : valKeys)
-
-
3692 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
-
-
-
3695 BEAST_EXPECT(changes.
added == added);
-
3696 BEAST_EXPECT(changes.
removed.empty());
-
-
-
-
3700 changes = trustedKeys->updateTrusted(
-
-
-
-
-
-
3706 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
-
3707 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1);
-
-
-
3710 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
-
3711 for (
auto const& val : valKeys)
-
-
3713 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
-
3714 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
-
-
-
3717 BEAST_EXPECT(changes.
added.empty());
-
3718 BEAST_EXPECT(changes.
removed == removed);
-
-
-
-
-
-
-
-
3726 auto const self = valKeys[5];
-
3727 auto const keysTotal = valKeys.
size();
-
3728 auto trustedKeys = makeValidatorList(
-
-
-
-
-
-
-
-
3736 BEAST_EXPECT(trustedKeys->getListThreshold() == 2);
-
3737 for (
auto const& p : publishers)
-
3738 BEAST_EXPECT(trustedKeys->trustedPublisher(p.pubKey));
-
-
-
-
-
-
-
-
3746 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
-
-
3748 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
-
-
-
-
3752 for (
auto const& val : valKeys)
-
-
3754 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
-
-
-
3757 BEAST_EXPECT(changes.
added == added);
-
3758 BEAST_EXPECT(changes.
removed.empty());
-
-
-
-
3762 changes = trustedKeys->updateTrusted(
-
-
-
-
-
-
3768 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
-
3769 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1);
-
-
-
3772 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
-
3773 for (
auto const& val : valKeys)
-
-
3775 if (val.masterPublic != self.masterPublic)
-
-
3777 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
-
3778 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
-
-
-
-
3782 BEAST_EXPECT(changes.
added.empty());
-
3783 BEAST_EXPECT(changes.
removed == removed);
-
-
-
-
-
-
-
3790 auto const keysTotal = valKeys.
size();
-
3791 auto trustedKeys = makeValidatorList(
-
-
-
-
-
-
-
-
3799 BEAST_EXPECT(trustedKeys->getListThreshold() == 2);
-
3800 for (
auto const& p : publishers)
-
3801 BEAST_EXPECT(trustedKeys->trustedPublisher(p.pubKey));
-
-
-
-
-
-
-
-
3809 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
-
-
3811 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
-
-
-
3814 for (
auto const& val : valKeys)
-
-
3816 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
-
-
-
3819 BEAST_EXPECT(changes.
added == added);
-
3820 BEAST_EXPECT(changes.
removed.empty());
-
-
-
-
3824 changes = trustedKeys->updateTrusted(
-
-
-
-
-
-
3830 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
-
3831 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 0);
-
-
-
3834 for (
auto const& val : valKeys)
-
-
3836 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
-
3837 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
-
-
-
3840 BEAST_EXPECT(changes.
added.empty());
-
3841 BEAST_EXPECT(changes.
removed == removed);
-
-
-
-
-
-
-
-
-
-
3851 auto const self = randomValidator();
-
3852 auto const keysTotal = valKeys.
size() + 1;
-
3853 auto trustedKeys = makeValidatorList(
-
-
+
+
+
+
+
+
3609 BEAST_EXPECT(trustedKeys->getListThreshold() == 1);
+
3610 int untrustedCount = 0;
+
3611 for (
auto const& p : publishers)
+
+
3613 bool const trusted = trustedKeys->trustedPublisher(p.pubKey);
+
3614 BEAST_EXPECT(p.revoked ^ trusted);
+
3615 untrustedCount += trusted ? 0 : 1;
+
+
3617 BEAST_EXPECT(untrustedCount == 1);
+
+
+
+
+
+
+
+
3625 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
+
+
3627 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
+
+
+
3630 for (
auto const& val : valKeys)
+
+
3632 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
+
+
+
3635 BEAST_EXPECT(changes.
added == added);
+
3636 BEAST_EXPECT(changes.
removed.empty());
+
+
+
+
3640 changes = trustedKeys->updateTrusted(
+
+
+
+
+
+
3646 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
+
3647 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 0);
+
+
+
3650 for (
auto const& val : valKeys)
+
+
3652 BEAST_EXPECT(!trustedKeys->listed(val.masterPublic));
+
3653 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
+
+
+
3656 BEAST_EXPECT(changes.
added.empty());
+
3657 BEAST_EXPECT(changes.
removed == removed);
+
+
+
+
+
+
+
+
3665 auto const self = randomValidator();
+
3666 auto const keysTotal = valKeys.
size() + 1;
+
3667 auto trustedKeys = makeValidatorList(
+
+
+
+
+
+
+
+
3675 BEAST_EXPECT(trustedKeys->getListThreshold() == 2);
+
3676 for (
auto const& p : publishers)
+
3677 BEAST_EXPECT(trustedKeys->trustedPublisher(p.pubKey));
+
+
+
+
+
+
+
+
3685 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
+
+
3687 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
+
+
+
+
3691 for (
auto const& val : valKeys)
+
+
3693 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
+
+
+
3696 BEAST_EXPECT(changes.
added == added);
+
3697 BEAST_EXPECT(changes.
removed.empty());
+
+
+
+
3701 changes = trustedKeys->updateTrusted(
+
+
+
+
+
+
3707 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
+
3708 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1);
+
+
+
3711 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
+
3712 for (
auto const& val : valKeys)
+
+
3714 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
+
3715 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
+
+
+
3718 BEAST_EXPECT(changes.
added.empty());
+
3719 BEAST_EXPECT(changes.
removed == removed);
+
+
+
+
+
+
+
+
3727 auto const self = valKeys[5];
+
3728 auto const keysTotal = valKeys.
size();
+
3729 auto trustedKeys = makeValidatorList(
+
+
+
+
+
+
+
+
3737 BEAST_EXPECT(trustedKeys->getListThreshold() == 2);
+
3738 for (
auto const& p : publishers)
+
3739 BEAST_EXPECT(trustedKeys->trustedPublisher(p.pubKey));
+
+
+
+
+
+
+
+
3747 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
+
+
3749 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
+
+
+
+
3753 for (
auto const& val : valKeys)
+
+
3755 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
+
+
+
3758 BEAST_EXPECT(changes.
added == added);
+
3759 BEAST_EXPECT(changes.
removed.empty());
+
+
+
+
3763 changes = trustedKeys->updateTrusted(
+
+
+
+
+
+
3769 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
+
3770 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1);
+
+
+
3773 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
+
3774 for (
auto const& val : valKeys)
+
+
3776 if (val.masterPublic != self.masterPublic)
+
+
3778 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
+
3779 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
+
+
+
+
3783 BEAST_EXPECT(changes.
added.empty());
+
3784 BEAST_EXPECT(changes.
removed == removed);
+
+
+
+
+
+
+
3791 auto const keysTotal = valKeys.
size();
+
3792 auto trustedKeys = makeValidatorList(
+
+
+
+
+
+
+
+
3800 BEAST_EXPECT(trustedKeys->getListThreshold() == 2);
+
3801 for (
auto const& p : publishers)
+
3802 BEAST_EXPECT(trustedKeys->trustedPublisher(p.pubKey));
+
+
+
+
+
+
+
+
3810 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
+
+
3812 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
+
+
+
3815 for (
auto const& val : valKeys)
+
+
3817 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
+
+
+
3820 BEAST_EXPECT(changes.
added == added);
+
3821 BEAST_EXPECT(changes.
removed.empty());
+
+
+
+
3825 changes = trustedKeys->updateTrusted(
+
+
+
+
+
+
3831 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
+
3832 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 0);
+
+
+
3835 for (
auto const& val : valKeys)
+
+
3837 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
+
3838 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
+
+
+
3841 BEAST_EXPECT(changes.
added.empty());
+
3842 BEAST_EXPECT(changes.
removed == removed);
+
+
+
+
+
+
+
+
+
+
3852 auto const self = randomValidator();
+
3853 auto const keysTotal = valKeys.
size() + 1;
+
3854 auto trustedKeys = makeValidatorList(
+
-
-
-
-
-
3861 BEAST_EXPECT(trustedKeys->getListThreshold() == 1);
-
3862 for (
auto const& p : publishers)
-
3863 BEAST_EXPECT(trustedKeys->trustedPublisher(p.pubKey));
-
-
-
-
-
-
-
-
3871 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
-
-
3873 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
-
-
-
-
3877 for (
auto const& val : valKeys)
-
-
3879 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
-
-
-
3882 BEAST_EXPECT(changes.
added == added);
-
3883 BEAST_EXPECT(changes.
removed.empty());
-
-
-
-
3887 changes = trustedKeys->updateTrusted(
-
-
-
-
-
-
3893 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
-
3894 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1);
-
-
-
3897 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
-
3898 for (
auto const& val : valKeys)
-
-
3900 BEAST_EXPECT(!trustedKeys->listed(val.masterPublic));
-
3901 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
-
-
-
3904 BEAST_EXPECT(changes.
added.empty());
-
3905 BEAST_EXPECT(changes.
removed == removed);
-
-
-
-
-
-
-
-
-
-
3915 auto const self = valKeys[2];
-
3916 auto const keysTotal = valKeys.
size();
-
3917 auto trustedKeys = makeValidatorList(
-
-
+
+
+
+
+
+
3862 BEAST_EXPECT(trustedKeys->getListThreshold() == 1);
+
3863 for (
auto const& p : publishers)
+
3864 BEAST_EXPECT(trustedKeys->trustedPublisher(p.pubKey));
+
+
+
+
+
+
+
+
3872 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
+
+
3874 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
+
+
+
+
3878 for (
auto const& val : valKeys)
+
+
3880 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
+
+
+
3883 BEAST_EXPECT(changes.
added == added);
+
3884 BEAST_EXPECT(changes.
removed.empty());
+
+
+
+
3888 changes = trustedKeys->updateTrusted(
+
+
+
+
+
+
3894 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
+
3895 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1);
+
+
+
3898 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
+
3899 for (
auto const& val : valKeys)
+
+
3901 BEAST_EXPECT(!trustedKeys->listed(val.masterPublic));
+
3902 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
+
+
+
3905 BEAST_EXPECT(changes.
added.empty());
+
3906 BEAST_EXPECT(changes.
removed == removed);
+
+
+
+
+
+
+
+
+
+
3916 auto const self = valKeys[2];
+
3917 auto const keysTotal = valKeys.
size();
+
3918 auto trustedKeys = makeValidatorList(
+
-
-
-
-
-
3925 BEAST_EXPECT(trustedKeys->getListThreshold() == 2);
-
3926 for (
auto const& p : publishers)
-
3927 BEAST_EXPECT(trustedKeys->trustedPublisher(p.pubKey));
-
-
-
-
-
-
-
-
3935 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
-
-
3937 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
-
-
-
3940 for (
auto const& val : valKeys)
-
-
3942 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
-
-
-
3945 BEAST_EXPECT(changes.
added == added);
-
3946 BEAST_EXPECT(changes.
removed.empty());
-
-
-
-
-
-
-
-
-
3955 auto const keysTotal = valKeys.
size();
-
3956 auto trustedKeys = makeValidatorList(
-
-
+
+
+
+
+
+
3926 BEAST_EXPECT(trustedKeys->getListThreshold() == 2);
+
3927 for (
auto const& p : publishers)
+
3928 BEAST_EXPECT(trustedKeys->trustedPublisher(p.pubKey));
+
+
+
+
+
+
+
+
3936 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
+
+
3938 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
+
+
+
3941 for (
auto const& val : valKeys)
+
+
3943 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
+
+
+
3946 BEAST_EXPECT(changes.
added == added);
+
3947 BEAST_EXPECT(changes.
removed.empty());
+
+
+
+
+
+
+
+
+
3956 auto const keysTotal = valKeys.
size();
+
3957 auto trustedKeys = makeValidatorList(
+
-
-
-
-
-
3964 BEAST_EXPECT(trustedKeys->getListThreshold() == 3);
-
3965 for (
auto const& p : publishers)
-
3966 BEAST_EXPECT(trustedKeys->trustedPublisher(p.pubKey));
-
-
-
-
-
-
-
-
3974 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
-
-
3976 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
-
-
-
3979 for (
auto const& val : valKeys)
-
-
3981 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
-
-
-
3984 BEAST_EXPECT(changes.
added == added);
-
3985 BEAST_EXPECT(changes.
removed.empty());
-
-
-
-
-
-
-
-
-
-
3995 auto const self = randomValidator();
-
3996 auto const keysTotal = valKeys.
size() + 1;
-
3997 auto trustedKeys = makeValidatorList(
-
-
-
-
-
-
-
-
4005 BEAST_EXPECT(trustedKeys->getListThreshold() == 4);
-
4006 int untrustedCount = 0;
-
4007 for (
auto const& p : publishers)
-
-
4009 bool const trusted = trustedKeys->trustedPublisher(p.pubKey);
-
4010 BEAST_EXPECT(p.revoked ^ trusted);
-
4011 untrustedCount += trusted ? 0 : 1;
-
-
4013 BEAST_EXPECT(untrustedCount == 2);
-
-
-
-
-
-
-
-
4021 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
-
-
4023 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
-
-
-
-
4027 for (
auto const& val : valKeys)
-
-
4029 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
-
-
-
4032 BEAST_EXPECT(changes.
added == added);
-
4033 BEAST_EXPECT(changes.
removed.empty());
-
-
-
-
4037 changes = trustedKeys->updateTrusted(
-
-
-
-
-
-
4043 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
-
4044 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1);
-
-
-
4047 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
-
4048 for (
auto const& val : valKeys)
-
-
4050 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
-
4051 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
-
-
-
4054 BEAST_EXPECT(changes.
added.empty());
-
4055 BEAST_EXPECT(changes.
removed == removed);
-
-
-
-
-
-
-
-
-
-
4065 auto const self = valKeys[2];
-
4066 auto const keysTotal = valKeys.
size();
-
4067 auto trustedKeys = makeValidatorList(
-
-
-
-
-
-
-
-
4075 BEAST_EXPECT(trustedKeys->getListThreshold() == 4);
-
4076 int untrustedCount = 0;
-
4077 for (
auto const& p : publishers)
-
-
4079 bool const trusted = trustedKeys->trustedPublisher(p.pubKey);
-
4080 BEAST_EXPECT(p.revoked ^ trusted);
-
4081 untrustedCount += trusted ? 0 : 1;
-
-
4083 BEAST_EXPECT(untrustedCount == 3);
-
-
-
-
-
-
-
-
4091 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
-
-
4093 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
-
-
-
4096 for (
auto const& val : valKeys)
-
-
4098 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
-
-
-
4101 BEAST_EXPECT(changes.
added == added);
-
4102 BEAST_EXPECT(changes.
removed.empty());
-
-
-
-
4106 changes = trustedKeys->updateTrusted(
-
-
-
-
-
-
4112 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
-
4113 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1);
-
-
-
4116 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
-
4117 for (
auto const& val : valKeys)
-
-
4119 if (val.masterPublic != self.masterPublic)
-
-
4121 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
-
4122 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
-
-
-
-
4126 BEAST_EXPECT(changes.
added.empty());
-
4127 BEAST_EXPECT(changes.
removed == removed);
-
-
+
+
+
+
+
+
3965 BEAST_EXPECT(trustedKeys->getListThreshold() == 3);
+
3966 for (
auto const& p : publishers)
+
3967 BEAST_EXPECT(trustedKeys->trustedPublisher(p.pubKey));
+
+
+
+
+
+
+
+
3975 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
+
+
3977 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
+
+
+
3980 for (
auto const& val : valKeys)
+
+
3982 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
+
+
+
3985 BEAST_EXPECT(changes.
added == added);
+
3986 BEAST_EXPECT(changes.
removed.empty());
+
+
+
+
+
+
+
+
+
+
3996 auto const self = randomValidator();
+
3997 auto const keysTotal = valKeys.
size() + 1;
+
3998 auto trustedKeys = makeValidatorList(
+
+
+
+
+
+
+
+
4006 BEAST_EXPECT(trustedKeys->getListThreshold() == 4);
+
4007 int untrustedCount = 0;
+
4008 for (
auto const& p : publishers)
+
+
4010 bool const trusted = trustedKeys->trustedPublisher(p.pubKey);
+
4011 BEAST_EXPECT(p.revoked ^ trusted);
+
4012 untrustedCount += trusted ? 0 : 1;
+
+
4014 BEAST_EXPECT(untrustedCount == 2);
+
+
+
+
+
+
+
+
4022 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
+
+
4024 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
+
+
+
+
4028 for (
auto const& val : valKeys)
+
+
4030 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
+
+
+
4033 BEAST_EXPECT(changes.
added == added);
+
4034 BEAST_EXPECT(changes.
removed.empty());
+
+
+
+
4038 changes = trustedKeys->updateTrusted(
+
+
+
+
+
+
4044 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
+
4045 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1);
+
+
+
4048 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
+
4049 for (
auto const& val : valKeys)
+
+
4051 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
+
4052 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
+
+
+
4055 BEAST_EXPECT(changes.
added.empty());
+
4056 BEAST_EXPECT(changes.
removed == removed);
+
+
+
+
+
+
+
+
+
+
4066 auto const self = valKeys[2];
+
4067 auto const keysTotal = valKeys.
size();
+
4068 auto trustedKeys = makeValidatorList(
+
+
+
+
+
+
+
+
4076 BEAST_EXPECT(trustedKeys->getListThreshold() == 4);
+
4077 int untrustedCount = 0;
+
4078 for (
auto const& p : publishers)
+
+
4080 bool const trusted = trustedKeys->trustedPublisher(p.pubKey);
+
4081 BEAST_EXPECT(p.revoked ^ trusted);
+
4082 untrustedCount += trusted ? 0 : 1;
+
+
4084 BEAST_EXPECT(untrustedCount == 3);
+
+
+
+
+
+
+
+
4092 BEAST_EXPECT(trustedKeys->quorum() ==
std::ceil(keysTotal * 0.8f));
+
+
4094 trustedKeys->getTrustedMasterKeys().size() == keysTotal);
+
+
+
4097 for (
auto const& val : valKeys)
+
+
4099 BEAST_EXPECT(trustedKeys->trusted(val.masterPublic));
+
+
+
4102 BEAST_EXPECT(changes.
added == added);
+
4103 BEAST_EXPECT(changes.
removed.empty());
+
+
+
+
4107 changes = trustedKeys->updateTrusted(
+
+
+
+
+
+
4113 BEAST_EXPECT(trustedKeys->quorum() == quorumDisabled);
+
4114 BEAST_EXPECT(trustedKeys->getTrustedMasterKeys().size() == 1);
+
+
+
4117 BEAST_EXPECT(trustedKeys->trusted(self.masterPublic));
+
4118 for (
auto const& val : valKeys)
+
+
4120 if (val.masterPublic != self.masterPublic)
+
+
4122 BEAST_EXPECT(trustedKeys->listed(val.masterPublic));
+
4123 BEAST_EXPECT(!trustedKeys->trusted(val.masterPublic));
+
+
+
+
4127 BEAST_EXPECT(changes.
added.empty());
+
4128 BEAST_EXPECT(changes.
removed == removed);
+
+
-
-
-
-
-
-
-
4135 testGenesisQuorum();
-
-
-
-
4139 testUpdateTrusted();
-
-
-
-
4143 testBuildMessages();
-
4144 testQuorumDisabled();
-
+
+
+
+
+
+
+
4136 testGenesisQuorum();
+
+
+
+
4140 testUpdateTrusted();
+
+
+
+
4144 testBuildMessages();
+
4145 testQuorumDisabled();
+
-
+
-
-
-
-
-
+
+
+
+
+
@@ -4316,7 +4317,7 @@ $(document).ready(function() { init_codefold(0); });
std::string signList(std::string const &blob, std::pair< PublicKey, SecretKey > const &keys)
static std::string makeRevocationString(PublicKey const &pk, SecretKey const &sk)
-
void testQuorumDisabled()
+
void testQuorumDisabled()
static hash_set< NodeID > asNodeIDs(std::initializer_list< PublicKey > const &pks)
@@ -4326,7 +4327,7 @@ $(document).ready(function() { init_codefold(0); });
static Validator randomValidator()
void checkResult(ValidatorList::PublisherListStats const &result, PublicKey pubKey, ListDisposition expectedWorst, ListDisposition expectedBest)
-
void run() override
Runs the suite.
+
void run() override
Runs the suite.
static std::string makeManifestString(PublicKey const &pk, SecretKey const &sk, PublicKey const &spk, SecretKey const &ssk, int seq)
diff --git a/ValidatorSite_8cpp_source.html b/ValidatorSite_8cpp_source.html
index 3ab16a0793..b793e8e19e 100644
--- a/ValidatorSite_8cpp_source.html
+++ b/ValidatorSite_8cpp_source.html
@@ -832,9 +832,9 @@ $(document).ready(function() { init_codefold(0); });
virtual Overlay & overlay()=0
virtual ValidatorList & validators()=0
virtual NetworkOPs & getOPs()=0
-
std::vector< std::string > loadLists()
+
std::vector< std::string > loadLists()
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...
-
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...
+
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...
void onRequestTimeout(std::size_t siteIdx, error_code const &ec)
request took too long
void setTimer(std::lock_guard< std::mutex > const &, std::lock_guard< std::mutex > const &)
Queue next site to be fetched lock over site_mutex_ and state_mutex_ required.
diff --git a/Validators_8cpp_source.html b/Validators_8cpp_source.html
index 33366b077e..bf6c317668 100644
--- a/Validators_8cpp_source.html
+++ b/Validators_8cpp_source.html
@@ -100,7 +100,7 @@ $(document).ready(function() { init_codefold(0); });
virtual ValidatorList & validators()=0
-
Json::Value getJson() const
Return a JSON representation of the state of the validator list.
+
Json::Value getJson() const
Return a JSON representation of the state of the validator list.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Json::Value doValidators(RPC::JsonContext &)
diff --git a/classxrpl_1_1ValidatorList.html b/classxrpl_1_1ValidatorList.html
index 13fdd5f2b8..b10fcbac82 100644
--- a/classxrpl_1_1ValidatorList.html
+++ b/classxrpl_1_1ValidatorList.html
@@ -804,7 +804,7 @@ Trusted Validators List