Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Feature to Amendment: #340

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Builds/VisualStudio2013/RippleD.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\..\src\ripple_app\misc\FeaturesImpl.cpp">
<ClCompile Include="..\..\src\ripple_app\misc\AmendmentTableImpl.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>
Expand Down Expand Up @@ -2951,7 +2951,7 @@
<ClInclude Include="..\..\src\ripple_app\misc\AccountItems.h" />
<ClInclude Include="..\..\src\ripple_app\misc\AccountState.h" />
<ClInclude Include="..\..\src\ripple_app\misc\CanonicalTXSet.h" />
<ClInclude Include="..\..\src\ripple_app\misc\FeatureTable.h" />
<ClInclude Include="..\..\src\ripple_app\misc\AmendmentTable.h" />
<ClInclude Include="..\..\src\ripple_app\misc\FeeVote.h" />
<ClInclude Include="..\..\src\ripple_app\misc\IHashRouter.h" />
<ClInclude Include="..\..\src\ripple_app\misc\ProofOfWorkFactory.h" />
Expand Down Expand Up @@ -3242,6 +3242,7 @@
<None Include="..\..\src\ripple\validators\TODO.md" />
<None Include="..\..\src\ripple\validators\README.md" />
<None Include="..\..\src\ripple_app\ledger\TODO.md" />
<None Include="..\..\src\ripple_app\misc\README.md" />
<None Include="..\..\src\ripple_app\TODO.md" />
<None Include="..\..\src\ripple_overlay\README.md" />
<None Include="..\..\src\ripple_overlay\TODO.md" />
Expand Down
9 changes: 6 additions & 3 deletions Builds/VisualStudio2013/RippleD.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1716,10 +1716,10 @@
<ClCompile Include="..\..\src\ripple_rpc\impl\LookupLedger.cpp">
<Filter>[2] Old Ripple\ripple_rpc\impl</Filter>
</ClCompile>
<ClCompile Include="..\..\src\ripple_app\misc\FeaturesImpl.cpp">
<ClCompile Include="..\..\src\ripple_app\misc\FeeVoteImpl.cpp">
<Filter>[2] Old Ripple\ripple_app\misc</Filter>
</ClCompile>
<ClCompile Include="..\..\src\ripple_app\misc\FeeVoteImpl.cpp">
<ClCompile Include="..\..\src\ripple_app\misc\AmendmentTableImpl.cpp">
<Filter>[2] Old Ripple\ripple_app\misc</Filter>
</ClCompile>
</ItemGroup>
Expand Down Expand Up @@ -3342,7 +3342,7 @@
<ClInclude Include="..\..\src\ripple_app\misc\FeeVote.h">
<Filter>[2] Old Ripple\ripple_app\misc</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple_app\misc\FeatureTable.h">
<ClInclude Include="..\..\src\ripple_app\misc\AmendmentTable.h">
<Filter>[2] Old Ripple\ripple_app\misc</Filter>
</ClInclude>
</ItemGroup>
Expand Down Expand Up @@ -3472,5 +3472,8 @@
<None Include="..\..\src\ripple_overlay\TODO.md">
<Filter>[2] Old Ripple\ripple_overlay</Filter>
</None>
<None Include="..\..\src\ripple_app\misc\README.md">
<Filter>[2] Old Ripple\ripple_app\misc</Filter>
</None>
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions src/BeastConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ correctly to find the boost headers.
/** Config: RIPPLE_PROPOSE_FEATURES
This determines whether to add any features to the proposed transaction set.
*/
#ifndef RIPPLE_PROPOSE_FEATURES
#define RIPPLE_PROPOSE_FEATURES 0
#ifndef RIPPLE_PROPOSE_AMENDMENTS
#define RIPPLE_PROPOSE_AMENDMENTS 0
#endif

#endif
4 changes: 2 additions & 2 deletions src/ripple_app/consensus/LedgerConsensus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ class LedgerConsensusImp
// next ledger is flag ledger
{
m_feeVote.doValidation (newLCL, *v);
getApp().getFeatureTable ().doValidation (newLCL, *v);
getApp().getAmendmentTable ().doValidation (newLCL, *v);
}

v->sign (signingHash, mValPrivate);
Expand Down Expand Up @@ -1479,7 +1479,7 @@ class LedgerConsensusImp
SHAMap::pointer preSet
= initialLedger.peekTransactionMap ()->snapShot (true);
m_feeVote.doVoting (mPreviousLedger, preSet);
getApp().getFeatureTable ().doVoting (mPreviousLedger, preSet);
getApp().getAmendmentTable ().doVoting (mPreviousLedger, preSet);
initialSet = preSet->snapShot (false);
}
else
Expand Down
18 changes: 9 additions & 9 deletions src/ripple_app/ledger/Ledger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1504,11 +1504,11 @@ uint256 Ledger::getLedgerFeeIndex ()
return s.getSHA512Half ();
}

uint256 Ledger::getLedgerFeatureIndex ()
uint256 Ledger::getLedgerAmendmentIndex ()
{
// get the index of the node that holds the enabled features
// get the index of the node that holds the enabled amendments
Serializer s (2);
s.add16 (spaceFeature);
s.add16 (spaceAmendment);
return s.getSHA512Half ();
}

Expand Down Expand Up @@ -1616,15 +1616,15 @@ std::vector< std::pair<std::uint32_t, uint256> > Ledger::getLedgerHashes ()
return ret;
}

std::vector<uint256> Ledger::getLedgerFeatures ()
std::vector<uint256> Ledger::getLedgerAmendments ()
{
std::vector<uint256> usFeatures;
SLE::pointer sleFeatures = getSLEi (getLedgerFeatureIndex ());
std::vector<uint256> usAmendments;
SLE::pointer sleAmendments = getSLEi (getLedgerAmendmentIndex ());

if (sleFeatures)
usFeatures = sleFeatures->getFieldV256 (sfFeatures).peekValue ();
if (sleAmendments)
usAmendments = sleAmendments->getFieldV256 (sfAmendments).peekValue ();

return usFeatures;
return usAmendments;
}

// XRP to XRP not allowed.
Expand Down
4 changes: 2 additions & 2 deletions src/ripple_app/ledger/Ledger.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,9 @@ class Ledger
uint256 getLedgerHash (std::uint32_t ledgerIndex);
std::vector< std::pair<std::uint32_t, uint256> > getLedgerHashes ();

static uint256 getLedgerFeatureIndex ();
static uint256 getLedgerAmendmentIndex ();
static uint256 getLedgerFeeIndex ();
std::vector<uint256> getLedgerFeatures ();
std::vector<uint256> getLedgerAmendments ();

std::vector<uint256> getNeededTransactionHashes (int max, SHAMapSyncFilter * filter);
std::vector<uint256> getNeededAccountStateHashes (int max, SHAMapSyncFilter * filter);
Expand Down
2 changes: 1 addition & 1 deletion src/ripple_app/ledger/SerializedValidation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ SOTemplate const& SerializedValidation::getFormat ()
format.push_back (SOElement (sfLedgerSequence, SOE_OPTIONAL));
format.push_back (SOElement (sfCloseTime, SOE_OPTIONAL));
format.push_back (SOElement (sfLoadFee, SOE_OPTIONAL));
format.push_back (SOElement (sfFeatures, SOE_OPTIONAL));
format.push_back (SOElement (sfAmendments, SOE_OPTIONAL));
format.push_back (SOElement (sfBaseFee, SOE_OPTIONAL));
format.push_back (SOElement (sfReserveBase, SOE_OPTIONAL));
format.push_back (SOElement (sfReserveIncrement, SOE_OPTIONAL));
Expand Down
22 changes: 11 additions & 11 deletions src/ripple_app/main/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace ripple {
// VFALCO TODO Clean this global up
static bool volatile doShutdown = false;

static int const MAJORITY_FRACTION (200);
static int const MAJORITY_FRACTION (204);

//------------------------------------------------------------------------------
//
Expand Down Expand Up @@ -59,8 +59,8 @@ class PathRequestLog;
template <> char const* LogPartition::getPartitionName <PathRequestLog> () { return "PathRequest"; }
class RPCManagerLog;
template <> char const* LogPartition::getPartitionName <RPCManagerLog> () { return "RPCManager"; }
class FeaturesLog;
template <> char const* LogPartition::getPartitionName <FeaturesLog>() { return "FeatureTable"; }
class AmendmentTableLog;
template <> char const* LogPartition::getPartitionName <AmendmentTableLog>() { return "AmendmentTable"; }

template <> char const* LogPartition::getPartitionName <CollectorManager> () { return "Collector"; }

Expand Down Expand Up @@ -141,7 +141,7 @@ class ApplicationImp
std::unique_ptr <SNTPClient> m_sntpClient;
std::unique_ptr <TxQueue> m_txQueue;
std::unique_ptr <Validators::Manager> m_validators;
std::unique_ptr <FeatureTable> m_featureTable;
std::unique_ptr <AmendmentTable> m_amendmentTable;
std::unique_ptr <LoadFeeTrack> mFeeTrack;
std::unique_ptr <IHashRouter> mHashRouter;
std::unique_ptr <Validations> mValidations;
Expand Down Expand Up @@ -296,8 +296,8 @@ class ApplicationImp
getConfig ().getModuleDatabasePath (),
LogPartition::getJournal <ValidatorsLog> ())))

, m_featureTable (make_FeatureTable (weeks(2), MAJORITY_FRACTION, // 200/256
LogPartition::getJournal <FeaturesLog> ()))
, m_amendmentTable (make_AmendmentTable (weeks(2), MAJORITY_FRACTION, // 204/256 about 80%
LogPartition::getJournal <AmendmentTableLog> ()))

, mFeeTrack (LoadFeeTrack::New (LogPartition::getJournal <LoadManagerLog> ()))

Expand Down Expand Up @@ -450,9 +450,9 @@ class ApplicationImp
return *m_validators;
}

FeatureTable& getFeatureTable ()
AmendmentTable& getAmendmentTable()
{
return *m_featureTable;
return *m_amendmentTable;
}

LoadFeeTrack& getFeeTrack ()
Expand Down Expand Up @@ -609,7 +609,7 @@ class ApplicationImp
if (!getConfig ().RUN_STANDALONE)
updateTables ();

m_featureTable->addInitial ();
m_amendmentTable->addInitial();
Pathfinder::initPathTable ();

m_ledgerMaster->setMinValidations (getConfig ().VALIDATION_QUORUM);
Expand Down Expand Up @@ -1069,7 +1069,7 @@ void ApplicationImp::startNewLedger ()
{
Ledger::pointer firstLedger = boost::make_shared<Ledger> (rootAddress, SYSTEM_CURRENCY_START);
assert (!!firstLedger->getAccountState (rootAddress));
// WRITEME: Add any default features
// WRITEME: Add any default amendments
// WRITEME: Set default fee/reserve
firstLedger->updateHash ();
firstLedger->setClosed ();
Expand Down Expand Up @@ -1215,7 +1215,7 @@ bool serverOkay (std::string& reason)
return false;
}

if (getApp().getOPs ().isFeatureBlocked ())
if (getApp().getOPs ().isAmendmentBlocked ())
{
reason = "Server version too old";
return false;
Expand Down
4 changes: 2 additions & 2 deletions src/ripple_app/main/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace RPC { class Manager; }

// VFALCO TODO Fix forward declares required for header dependency loops
class CollectorManager;
class FeatureTable;
class AmendmentTable;
class IHashRouter;
class LoadFeeTrack;
class Overlay;
Expand Down Expand Up @@ -88,7 +88,7 @@ class Application : public beast::PropertyStream::Source
virtual NodeCache& getTempNodeCache () = 0;
virtual SLECache& getSLECache () = 0;
virtual Validators::Manager& getValidators () = 0;
virtual FeatureTable& getFeatureTable () = 0;
virtual AmendmentTable& getAmendmentTable() = 0;
virtual IHashRouter& getHashRouter () = 0;
virtual LoadFeeTrack& getFeeTrack () = 0;
virtual LoadManager& getLoadManager () = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,39 +17,43 @@
*/
//==============================================================================

#ifndef RIPPLE_FEATURES_H
#define RIPPLE_FEATURES_H
#ifndef RIPPLE_AMENDMENT_TABLE_H
#define RIPPLE_AMENDMENT_TABLE_H

#include "../book/Types.h"

namespace ripple {

class FeatureSet
/** The status of all amendments requested in a given window. */
class AmendmentSet
{
// the status of all features requested in a given window
public:
std::uint32_t mCloseTime;
int mTrustedValidations; // number of trusted validations
ripple::unordered_map<uint256, int> mVotes; // yes votes by feature
ripple::unordered_map<uint256, int> mVotes; // yes votes by amendment

FeatureSet (std::uint32_t ct) : mCloseTime (ct), mTrustedValidations (0)
AmendmentSet (std::uint32_t ct) : mCloseTime (ct), mTrustedValidations (0)
{
;
}
void addVoter ()
{
++mTrustedValidations;
}
void addVote (uint256 const& feature)
void addVote (uint256 const& amendment)
{
++mVotes[feature];
++mVotes[amendment];
}
};

class FeatureState
/** Current state of an amendment.
Tells if a amendment is supported, enabled or vetoed. A vetoed amendment
means the node will never announce its support.
*/
class AmendmentState
{
public:
bool mVetoed; // We don't want this feature enabled
bool mVetoed; // We don't want this amendment enabled
bool mEnabled;
bool mSupported;
bool mDefault; // Include in genesis ledger
Expand All @@ -59,7 +63,7 @@ class FeatureState

std::string mFriendlyName;

FeatureState ()
AmendmentState ()
: mVetoed (false), mEnabled (false), mSupported (false), mDefault (false),
m_firstMajority (0), m_lastMajority (0)
{
Expand Down Expand Up @@ -100,46 +104,44 @@ class FeatureState
}
};

/** Feature table interface.

The feature table stores the list of enabled and potential features.
Individuals features are voted on by validators during the consensus
/** The amendment table stores the list of enabled and potential amendments.
Individuals amendments are voted on by validators during the consensus
process.
*/
class FeatureTable
class AmendmentTable
{
public:
/** Create a new FeatureTable.
/** Create a new AmendmentTable.

@param majorityTime the number of seconds a feature must hold a majority
@param majorityTime the number of seconds an amendment must hold a majority
before we're willing to vote yes on it.
@param majorityFraction ratio, out of 256, of servers that must say
they want a feature before we consider it to
they want an amendment before we consider it to
have a majority.
@param journal
*/

virtual ~FeatureTable() { }
virtual ~AmendmentTable() { }

virtual void addInitial () = 0;

virtual FeatureState* addKnown (const char* featureID,
virtual AmendmentState* addKnown (const char* amendmentID,
const char* friendlyName, bool veto) = 0;
virtual uint256 get (const std::string& name) = 0;

virtual bool veto (uint256 const& feature) = 0;
virtual bool unVeto (uint256 const& feature) = 0;
virtual bool veto (uint256 const& amendment) = 0;
virtual bool unVeto (uint256 const& amendment) = 0;

virtual bool enable (uint256 const& feature) = 0;
virtual bool disable (uint256 const& feature) = 0;
virtual bool enable (uint256 const& amendment) = 0;
virtual bool disable (uint256 const& amendment) = 0;

virtual bool isEnabled (uint256 const& feature) = 0;
virtual bool isSupported (uint256 const& feature) = 0;
virtual bool isEnabled (uint256 const& amendment) = 0;
virtual bool isSupported (uint256 const& amendment) = 0;

virtual void setEnabled (const std::vector<uint256>& features) = 0;
virtual void setSupported (const std::vector<uint256>& features) = 0;
virtual void setEnabled (const std::vector<uint256>& amendments) = 0;
virtual void setSupported (const std::vector<uint256>& amendments) = 0;

virtual void reportValidations (const FeatureSet&) = 0;
virtual void reportValidations (const AmendmentSet&) = 0;

virtual Json::Value getJson (int) = 0;
virtual Json::Value getJson (uint256 const& ) = 0;
Expand All @@ -150,8 +152,8 @@ class FeatureTable
doVoting (Ledger::ref lastClosedLedger, SHAMap::ref initialPosition) = 0;
};

std::unique_ptr<FeatureTable>
make_FeatureTable (std::chrono::seconds majorityTime, int majorityFraction,
std::unique_ptr<AmendmentTable>
make_AmendmentTable (std::chrono::seconds majorityTime, int majorityFraction,
beast::Journal journal);

} // ripple
Expand Down
Loading