mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Dynamize trusted validator list and quorum (RIPD-1220):
Instead of specifying a static list of trusted validators in the config or validators file, the configuration can now include trusted validator list publisher keys. The trusted validator list and quorum are now reset each consensus round using the latest validator lists and the list of recent validations seen. The minimum validation quorum is now only configurable via the command line.
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
#include <ripple/app/misc/AmendmentTable.h>
|
||||
#include <ripple/app/misc/HashRouter.h>
|
||||
#include <ripple/app/misc/LoadFeeTrack.h>
|
||||
#include <ripple/app/misc/Manifest.h>
|
||||
#include <ripple/app/misc/NetworkOPs.h>
|
||||
#include <ripple/app/misc/SHAMapStore.h>
|
||||
#include <ripple/app/misc/TxQ.h>
|
||||
@@ -347,6 +348,8 @@ public:
|
||||
TaggedCache <uint256, AcceptedLedger> m_acceptedLedgerCache;
|
||||
std::unique_ptr <NetworkOPs> m_networkOPs;
|
||||
std::unique_ptr <Cluster> cluster_;
|
||||
std::unique_ptr <ManifestCache> validatorManifests_;
|
||||
std::unique_ptr <ManifestCache> publisherManifests_;
|
||||
std::unique_ptr <ValidatorList> validators_;
|
||||
std::unique_ptr <ServerHandler> serverHandler_;
|
||||
std::unique_ptr <AmendmentTable> m_amendmentTable;
|
||||
@@ -473,8 +476,15 @@ public:
|
||||
, cluster_ (std::make_unique<Cluster> (
|
||||
logs_->journal("Overlay")))
|
||||
|
||||
, validatorManifests_ (std::make_unique<ManifestCache> (
|
||||
logs_->journal("ManifestCache")))
|
||||
|
||||
, publisherManifests_ (std::make_unique<ManifestCache> (
|
||||
logs_->journal("ManifestCache")))
|
||||
|
||||
, validators_ (std::make_unique<ValidatorList> (
|
||||
logs_->journal("UniqueNodeList")))
|
||||
*validatorManifests_, *publisherManifests_, *timeKeeper_,
|
||||
logs_->journal("ValidatorList"), config_->VALIDATION_QUORUM))
|
||||
|
||||
, serverHandler_ (make_ServerHandler (*this, *m_networkOPs, get_io_service (),
|
||||
*m_jobQueue, *m_networkOPs, *m_resourceManager, *m_collectorManager))
|
||||
@@ -691,6 +701,16 @@ public:
|
||||
return *validators_;
|
||||
}
|
||||
|
||||
ManifestCache& validatorManifests() override
|
||||
{
|
||||
return *validatorManifests_;
|
||||
}
|
||||
|
||||
ManifestCache& publisherManifests() override
|
||||
{
|
||||
return *publisherManifests_;
|
||||
}
|
||||
|
||||
Cluster& cluster () override
|
||||
{
|
||||
return *cluster_;
|
||||
@@ -846,7 +866,18 @@ public:
|
||||
|
||||
mValidations->flush ();
|
||||
|
||||
m_overlay->saveValidatorKeyManifests (getWalletDB ());
|
||||
// TODO Store manifests in manifests.sqlite instead of wallet.db
|
||||
validatorManifests_->save (getWalletDB (), "ValidatorManifests",
|
||||
[this](PublicKey const& pubKey)
|
||||
{
|
||||
return validators().listed (pubKey);
|
||||
});
|
||||
|
||||
publisherManifests_->save (getWalletDB (), "PublisherManifests",
|
||||
[this](PublicKey const& pubKey)
|
||||
{
|
||||
return validators().trustedPublisher (pubKey);
|
||||
});
|
||||
|
||||
stopped ();
|
||||
}
|
||||
@@ -1013,9 +1044,6 @@ bool ApplicationImp::setup()
|
||||
|
||||
Pathfinder::initPathTable();
|
||||
|
||||
m_ledgerMaster->setMinValidations (
|
||||
config_->VALIDATION_QUORUM, config_->LOCK_QUORUM);
|
||||
|
||||
auto const startUp = config_->START_UP;
|
||||
if (startUp == Config::FRESH)
|
||||
{
|
||||
@@ -1062,15 +1090,26 @@ bool ApplicationImp::setup()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!validators_->load (config().section (SECTION_VALIDATORS)))
|
||||
if (!validatorManifests_->load (
|
||||
getWalletDB (), "ValidatorManifests",
|
||||
config().section (SECTION_VALIDATION_MANIFEST).lines()))
|
||||
{
|
||||
JLOG(m_journal.fatal()) << "Invalid entry in validator configuration.";
|
||||
JLOG(m_journal.fatal()) << "Invalid configured validator manifest.";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (validators_->size () == 0 && !config_->standalone())
|
||||
publisherManifests_->load (
|
||||
getWalletDB (), "PublisherManifests");
|
||||
|
||||
// Setup trusted validators
|
||||
if (!validators_->load (
|
||||
config_->VALIDATION_PUB,
|
||||
config().section (SECTION_VALIDATORS).values (),
|
||||
config().section (SECTION_VALIDATOR_LIST_KEYS).values ()))
|
||||
{
|
||||
JLOG(m_journal.warn()) << "No validators are configured.";
|
||||
JLOG(m_journal.fatal()) <<
|
||||
"Invalid entry in validator configuration.";
|
||||
return false;
|
||||
}
|
||||
|
||||
m_nodeStore->tune (config_->getSize (siNodeCacheSize), config_->getSize (siNodeCacheAge));
|
||||
@@ -1101,8 +1140,6 @@ bool ApplicationImp::setup()
|
||||
return false;
|
||||
}
|
||||
|
||||
m_overlay->setupValidatorKeyManifests (*config_, getWalletDB ());
|
||||
|
||||
{
|
||||
auto setup = setup_ServerHandler(
|
||||
*config_,
|
||||
|
||||
Reference in New Issue
Block a user