mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-01 00:15:51 +00:00
Add validators sources
This commit is contained in:
@@ -355,6 +355,18 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\ripple_core\ripple_core.cpp" />
|
||||
<ClCompile Include="..\..\modules\ripple_core\validator\ripple_Validator.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\ripple_core\validator\ripple_Validators.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\ripple_data\crypto\ripple_Base58.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@@ -1416,6 +1428,8 @@
|
||||
<ClInclude Include="..\..\modules\ripple_core\functional\ripple_LoadFeeTrack.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_core\functional\ripple_LoadMonitor.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_core\ripple_core.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_core\validator\ripple_Validator.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_core\validator\ripple_Validators.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_data\crypto\ripple_Base58.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_data\crypto\ripple_Base58Data.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_data\crypto\ripple_CBigNum.h" />
|
||||
|
||||
@@ -154,6 +154,9 @@
|
||||
<Filter Include="[1] Ripple\ripple_hyperleveldb">
|
||||
<UniqueIdentifier>{571acd5b-065c-4202-8de3-8692735171dc}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="[1] Ripple\ripple_core\validator">
|
||||
<UniqueIdentifier>{efccddf1-024d-41c4-b7f5-26ce2dd79f21}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\Subtrees\sqlite\sqlite3.c">
|
||||
@@ -837,6 +840,12 @@
|
||||
<ClCompile Include="..\..\modules\ripple_app\data\ripple_SqliteDatabase.cpp">
|
||||
<Filter>[1] Ripple\ripple_app\data</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\ripple_core\validator\ripple_Validator.cpp">
|
||||
<Filter>[1] Ripple\ripple_core\validator</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\ripple_core\validator\ripple_Validators.cpp">
|
||||
<Filter>[1] Ripple\ripple_core\validator</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\ripple_app\ledger\Ledger.cpp">
|
||||
<Filter>[1] Ripple\ripple_app\ledger</Filter>
|
||||
</ClCompile>
|
||||
@@ -1596,6 +1605,12 @@
|
||||
<ClInclude Include="..\..\modules\ripple_app\data\ripple_SqliteDatabase.h">
|
||||
<Filter>[1] Ripple\ripple_app\data</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\modules\ripple_core\validator\ripple_Validator.h">
|
||||
<Filter>[1] Ripple\ripple_core\validator</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\modules\ripple_core\validator\ripple_Validators.h">
|
||||
<Filter>[1] Ripple\ripple_core\validator</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\modules\ripple_app\ledger\Ledger.h">
|
||||
<Filter>[1] Ripple\ripple_app\ledger</Filter>
|
||||
</ClInclude>
|
||||
|
||||
84
TODO.txt
84
TODO.txt
@@ -294,3 +294,87 @@ What we want from the unique node list:
|
||||
* Malicious intent
|
||||
* Or, just hardware problems (faulty drive or memory)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Goals:
|
||||
Make default configuration of rippled secure.
|
||||
* Ship with TrustedUriList
|
||||
* Also have a preset RankedValidators
|
||||
Eliminate administrative burden of maintaining
|
||||
Produce the ChosenValidators list.
|
||||
Allow quantitative analysis of network health.
|
||||
|
||||
What determines that a validator is good?
|
||||
- Are they present (i.e. sending validations)
|
||||
- Are they on the consensus ledger
|
||||
- What percentage of consensus rounds do they participate in
|
||||
- Are they stalling consensus
|
||||
* Measurements of constructive/destructive behavior is
|
||||
calculated in units of percentage of ledgers for which
|
||||
the behavior is measured.
|
||||
|
||||
Nouns
|
||||
|
||||
Validator
|
||||
- Signs ledgers and participate in consensus
|
||||
- Fields
|
||||
* Public key
|
||||
* Friendly name
|
||||
* Jurisdiction
|
||||
* Org type: profit, nonprofit, "profit/gateway"
|
||||
- Metadata
|
||||
* Visible on the network?
|
||||
* On the consensus ledger?
|
||||
* Percentage of recent participation in consensus
|
||||
* Frequency of stalling the consensus process
|
||||
|
||||
ValidatorSource
|
||||
- Abstract
|
||||
- Provides a list of Validator
|
||||
|
||||
ValidatorList
|
||||
- Essentially an array of Validator
|
||||
|
||||
TrustedUriValidatorSource
|
||||
- ValidatorSource which uses HTTPS and a predefined URI
|
||||
- Domain owner is responsible for removing bad validators
|
||||
|
||||
TrustedUriValidatorSource::List
|
||||
- Essentially an array of TrustedUriValidatorSource
|
||||
- Can be read from a file
|
||||
|
||||
LocalFileValidatorSource
|
||||
- ValidatorSource which reads information from a local file.
|
||||
|
||||
TrustedUriList // A copy of this ships with the app
|
||||
* has a KnownValidators
|
||||
|
||||
KnownValidators
|
||||
* A series of KnownValidator that comes from a TrustedUri
|
||||
* Persistent storage has a timestamp
|
||||
|
||||
RankedValidators
|
||||
* Created as the union of all KnownValidators with "weight" being the
|
||||
number of appearances.
|
||||
|
||||
ChosenValidators
|
||||
* Result of the algorithm that chooses a random subset of RankedKnownValidators
|
||||
* "local health" percentage is the percent of validations from this list that
|
||||
you've seen recently. And have they been behaving.
|
||||
|
||||
Process:
|
||||
|
||||
For each TrustedUri:
|
||||
Perform HTTPS request to retrieve a KnownValidators list
|
||||
|
||||
Create the union of all unique KnownValidator, keyed by public key
|
||||
- Calculate the number of appearances to determine the "weight"
|
||||
|
||||
Algorithm:
|
||||
|
||||
ChosenValidators chooseRandomSubset (RankedKnownValidators)
|
||||
|
||||
@@ -24,13 +24,16 @@ namespace ripple
|
||||
{
|
||||
|
||||
#include "functional/ripple_Config.cpp"
|
||||
#include "functional/ripple_LoadFeeTrack.h" // private
|
||||
#include "functional/ripple_LoadFeeTrack.h" // private
|
||||
#include "functional/ripple_LoadFeeTrack.cpp"
|
||||
#include "functional/ripple_Job.cpp"
|
||||
#include "functional/ripple_JobQueue.cpp"
|
||||
#include "functional/ripple_LoadEvent.cpp"
|
||||
#include "functional/ripple_LoadMonitor.cpp"
|
||||
|
||||
#include "validator/ripple_Validator.cpp"
|
||||
#include "validator/ripple_Validators.cpp"
|
||||
|
||||
}
|
||||
|
||||
// These must be outside the namespace
|
||||
|
||||
@@ -37,6 +37,9 @@ namespace ripple
|
||||
/*.*/#include "functional/ripple_Job.h"
|
||||
/**/#include "functional/ripple_JobQueue.h"
|
||||
|
||||
#include "validator/ripple_Validator.h"
|
||||
#include "validator/ripple_Validators.h"
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
9
modules/ripple_core/validator/ripple_Validator.cpp
Normal file
9
modules/ripple_core/validator/ripple_Validator.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
Validator::Validator ()
|
||||
{
|
||||
}
|
||||
25
modules/ripple_core/validator/ripple_Validator.h
Normal file
25
modules/ripple_core/validator/ripple_Validator.h
Normal file
@@ -0,0 +1,25 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_VALIDATOR_H_INCLUDED
|
||||
#define RIPPLE_VALIDATOR_H_INCLUDED
|
||||
|
||||
/** Identifies a validator.
|
||||
|
||||
A validator signs ledgers and participates in the consensus process.
|
||||
*/
|
||||
class Validator
|
||||
{
|
||||
public:
|
||||
typedef RippleAddress PublicKey;
|
||||
|
||||
Validator ();
|
||||
|
||||
private:
|
||||
PublicKey m_publicKey;
|
||||
};
|
||||
|
||||
#endif
|
||||
46
modules/ripple_core/validator/ripple_Validators.cpp
Normal file
46
modules/ripple_core/validator/ripple_Validators.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
class ValidatorsImp
|
||||
: public Validators
|
||||
, private InterruptibleThread::EntryPoint
|
||||
{
|
||||
public:
|
||||
explicit ValidatorsImp (Listener* listener)
|
||||
: m_thread ("Validators")
|
||||
, m_listener (listener)
|
||||
{
|
||||
}
|
||||
|
||||
~ValidatorsImp ()
|
||||
{
|
||||
}
|
||||
|
||||
void addTrustedUri (String uri)
|
||||
{
|
||||
m_trustedUris.add (uri);
|
||||
}
|
||||
|
||||
void start ()
|
||||
{
|
||||
m_thread.start (this);
|
||||
}
|
||||
|
||||
void threadRun ()
|
||||
{
|
||||
// process the trustedUri list and blah blah
|
||||
}
|
||||
|
||||
private:
|
||||
InterruptibleThread m_thread;
|
||||
Listener* const m_listener;
|
||||
StringArray m_trustedUris;
|
||||
};
|
||||
|
||||
Validators* Validators::New (Listener* listener)
|
||||
{
|
||||
return new ValidatorsImp (listener);
|
||||
}
|
||||
36
modules/ripple_core/validator/ripple_Validators.h
Normal file
36
modules/ripple_core/validator/ripple_Validators.h
Normal file
@@ -0,0 +1,36 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
Copyright (c) 2011-2013, OpenCoin, Inc.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_VALIDATORS_H_INCLUDED
|
||||
#define RIPPLE_VALIDATORS_H_INCLUDED
|
||||
|
||||
/** Maintains the list of chosen validators.
|
||||
|
||||
The algorithm for acquiring, building, and calculating metadata on
|
||||
the list of chosen validators is critical to the health of the network.
|
||||
|
||||
All operations are performed asynchronously on an internal thread.
|
||||
*/
|
||||
class Validators : Uncopyable
|
||||
{
|
||||
public:
|
||||
class Listener
|
||||
{
|
||||
public:
|
||||
//virtual void onValidatorsChosen (ValidatorList validators) { }
|
||||
};
|
||||
|
||||
public:
|
||||
static Validators* New (Listener* listener);
|
||||
|
||||
virtual ~Validators () { }
|
||||
|
||||
virtual void addTrustedUri (String uri) = 0;
|
||||
|
||||
virtual void start () = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user