mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-26 14:05:51 +00:00
Remove validation cookie support code
This commit is contained in:
committed by
Nikolaos D. Bougalis
parent
04f1388860
commit
6156ff3eb7
@@ -83,7 +83,6 @@ RCLConsensus::Adaptor::Adaptor(
|
|||||||
, nodeID_{validatorKeys.nodeID}
|
, nodeID_{validatorKeys.nodeID}
|
||||||
, valPublic_{validatorKeys.publicKey}
|
, valPublic_{validatorKeys.publicKey}
|
||||||
, valSecret_{validatorKeys.secretKey}
|
, valSecret_{validatorKeys.secretKey}
|
||||||
, cookie_{validatorKeys.cookie}
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -853,10 +852,6 @@ RCLConsensus::Adaptor::validate(RCLCxLedger const& ledger,
|
|||||||
amendments = app_.getAmendmentTable().doValidation (getEnabledAmendments(*ledger.ledger_));
|
amendments = app_.getAmendmentTable().doValidation (getEnabledAmendments(*ledger.ledger_));
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<std::uint64_t> maybeCookie;
|
|
||||||
if (ledgerMaster_.getValidatedRules().enabled(featureValidationCookies))
|
|
||||||
maybeCookie.emplace(cookie_);
|
|
||||||
|
|
||||||
auto v = std::make_shared<STValidation>(
|
auto v = std::make_shared<STValidation>(
|
||||||
ledger.id(),
|
ledger.id(),
|
||||||
ledger.seq(),
|
ledger.seq(),
|
||||||
@@ -867,8 +862,7 @@ RCLConsensus::Adaptor::validate(RCLCxLedger const& ledger,
|
|||||||
nodeID_,
|
nodeID_,
|
||||||
proposing /* full if proposed */,
|
proposing /* full if proposed */,
|
||||||
fees,
|
fees,
|
||||||
amendments,
|
amendments);
|
||||||
maybeCookie);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ class RCLConsensus
|
|||||||
NodeID const nodeID_;
|
NodeID const nodeID_;
|
||||||
PublicKey const valPublic_;
|
PublicKey const valPublic_;
|
||||||
SecretKey const valSecret_;
|
SecretKey const valSecret_;
|
||||||
std::uint64_t const cookie_;
|
|
||||||
|
|
||||||
// Ledger we most recently needed to acquire
|
// Ledger we most recently needed to acquire
|
||||||
LedgerHash acquiringLedger_;
|
LedgerHash acquiringLedger_;
|
||||||
|
|||||||
@@ -320,17 +320,9 @@ handleNewValidation(Application& app,
|
|||||||
if(j.debug())
|
if(j.debug())
|
||||||
dmp(j.debug(), to_string(outcome));
|
dmp(j.debug(), to_string(outcome));
|
||||||
|
|
||||||
auto const seq = val->getFieldU32(sfLedgerSequence);
|
|
||||||
|
|
||||||
if (outcome == ValStatus::badCookie && j.error())
|
|
||||||
{
|
|
||||||
dmp(j.error(),
|
|
||||||
"already received validation for seq " + to_string(seq) +
|
|
||||||
" with different cookie; are two validators running with "
|
|
||||||
"the same keys?");
|
|
||||||
}
|
|
||||||
if (outcome == ValStatus::badSeq && j.warn())
|
if (outcome == ValStatus::badSeq && j.warn())
|
||||||
{
|
{
|
||||||
|
auto const seq = val->getFieldU32(sfLedgerSequence);
|
||||||
dmp(j.warn(),
|
dmp(j.warn(),
|
||||||
"already validated sequence at or past " + to_string(seq));
|
"already validated sequence at or past " + to_string(seq));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -134,13 +134,6 @@ public:
|
|||||||
return val_;
|
return val_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the validator cookie (or 0 if none set)
|
|
||||||
std::uint64_t
|
|
||||||
cookie() const
|
|
||||||
{
|
|
||||||
return val_->getFieldU64(sfCookie);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Wraps a ledger instance for use in generic Validations LedgerTrie.
|
/** Wraps a ledger instance for use in generic Validations LedgerTrie.
|
||||||
|
|||||||
@@ -40,9 +40,6 @@ public:
|
|||||||
SecretKey secretKey;
|
SecretKey secretKey;
|
||||||
NodeID nodeID;
|
NodeID nodeID;
|
||||||
std::string manifest;
|
std::string manifest;
|
||||||
std::uint64_t cookie; //< Randomly generated at startup to tag validations
|
|
||||||
//< so nodes can identify unintentional configuration
|
|
||||||
//< reuse
|
|
||||||
|
|
||||||
ValidatorKeys(Config const& config, beast::Journal j);
|
ValidatorKeys(Config const& config, beast::Journal j);
|
||||||
|
|
||||||
|
|||||||
@@ -21,14 +21,12 @@
|
|||||||
|
|
||||||
#include <ripple/app/misc/Manifest.h>
|
#include <ripple/app/misc/Manifest.h>
|
||||||
#include <ripple/basics/Log.h>
|
#include <ripple/basics/Log.h>
|
||||||
#include <ripple/basics/random.h>
|
|
||||||
#include <ripple/core/Config.h>
|
#include <ripple/core/Config.h>
|
||||||
#include <ripple/core/ConfigSections.h>
|
#include <ripple/core/ConfigSections.h>
|
||||||
#include <beast/core/detail/base64.hpp>
|
#include <beast/core/detail/base64.hpp>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
ValidatorKeys::ValidatorKeys(Config const& config, beast::Journal j)
|
ValidatorKeys::ValidatorKeys(Config const& config, beast::Journal j)
|
||||||
: cookie{rand_int<std::uint64_t>(1, std::numeric_limits<std::uint64_t>::max())}
|
|
||||||
{
|
{
|
||||||
if (config.exists(SECTION_VALIDATOR_TOKEN) &&
|
if (config.exists(SECTION_VALIDATOR_TOKEN) &&
|
||||||
config.exists(SECTION_VALIDATION_SEED))
|
config.exists(SECTION_VALIDATION_SEED))
|
||||||
|
|||||||
@@ -156,9 +156,7 @@ enum class ValStatus {
|
|||||||
/// Not current or was older than current from this node
|
/// Not current or was older than current from this node
|
||||||
stale,
|
stale,
|
||||||
/// A validation violates the increasing seq requirement
|
/// A validation violates the increasing seq requirement
|
||||||
badSeq,
|
badSeq
|
||||||
/// A validation used an inconsistent cookie
|
|
||||||
badCookie
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::string
|
inline std::string
|
||||||
@@ -172,8 +170,6 @@ to_string(ValStatus m)
|
|||||||
return "stale";
|
return "stale";
|
||||||
case ValStatus::badSeq:
|
case ValStatus::badSeq:
|
||||||
return "badSeq";
|
return "badSeq";
|
||||||
case ValStatus::badCookie:
|
|
||||||
return "badCookie";
|
|
||||||
default:
|
default:
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
@@ -244,11 +240,6 @@ to_string(ValStatus m)
|
|||||||
implementation_specific_t
|
implementation_specific_t
|
||||||
unwrap() -> return the implementation-specific type being wrapped
|
unwrap() -> return the implementation-specific type being wrapped
|
||||||
|
|
||||||
// Randomly generated cookie for a validator instance used to detect
|
|
||||||
// if multiple validators are accidentally running with the same
|
|
||||||
// validator keys
|
|
||||||
std::uint64_t cookie() const;
|
|
||||||
|
|
||||||
// ... implementation specific
|
// ... implementation specific
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -313,14 +304,6 @@ class Validations
|
|||||||
beast::uhash<>>
|
beast::uhash<>>
|
||||||
byLedger_;
|
byLedger_;
|
||||||
|
|
||||||
//! Validations from listed nodes indexed by ledger seq (partial and full)
|
|
||||||
beast::aged_unordered_map<
|
|
||||||
Seq,
|
|
||||||
hash_map<NodeID, Validation>,
|
|
||||||
std::chrono::steady_clock,
|
|
||||||
beast::uhash<>>
|
|
||||||
bySeq_;
|
|
||||||
|
|
||||||
// Represents the ancestry of validated ledgers
|
// Represents the ancestry of validated ledgers
|
||||||
LedgerTrie<Ledger> trie_;
|
LedgerTrie<Ledger> trie_;
|
||||||
|
|
||||||
@@ -549,7 +532,7 @@ public:
|
|||||||
ValidationParms const& p,
|
ValidationParms const& p,
|
||||||
beast::abstract_clock<std::chrono::steady_clock>& c,
|
beast::abstract_clock<std::chrono::steady_clock>& c,
|
||||||
Ts&&... ts)
|
Ts&&... ts)
|
||||||
: byLedger_(c), bySeq_(c), parms_(p), adaptor_(std::forward<Ts>(ts)...)
|
: byLedger_(c), parms_(p), adaptor_(std::forward<Ts>(ts)...)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -600,34 +583,6 @@ public:
|
|||||||
{
|
{
|
||||||
ScopedLock lock{mutex_};
|
ScopedLock lock{mutex_};
|
||||||
|
|
||||||
// Check if a validator with this nodeID already issued a validation
|
|
||||||
// for this sequence using a different cookie
|
|
||||||
auto const bySeqIt = bySeq_[val.seq()].emplace(nodeID, val);
|
|
||||||
if(!bySeqIt.second)
|
|
||||||
{
|
|
||||||
if(bySeqIt.first->second.cookie() != val.cookie())
|
|
||||||
{
|
|
||||||
// Remove prior validation if it was for a different ledger
|
|
||||||
ID const priorID = bySeqIt.first->second.ledgerID();
|
|
||||||
if (priorID != val.ledgerID())
|
|
||||||
{
|
|
||||||
auto const byLedgerIt = byLedger_.find(priorID);
|
|
||||||
if (byLedgerIt != byLedger_.end())
|
|
||||||
byLedger_[priorID].erase(nodeID);
|
|
||||||
|
|
||||||
auto const currIt = current_.find(nodeID);
|
|
||||||
if (currIt != current_.end() &&
|
|
||||||
currIt->second.ledgerID() == priorID)
|
|
||||||
{
|
|
||||||
removeTrie(lock, currIt->first, currIt->second);
|
|
||||||
adaptor_.onStale(std::move(currIt->second));
|
|
||||||
current_.erase(currIt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ValStatus::badCookie;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check that validation sequence is greater than any non-expired
|
// Check that validation sequence is greater than any non-expired
|
||||||
// validations sequence from that validator
|
// validations sequence from that validator
|
||||||
auto const now = byLedger_.clock().now();
|
auto const now = byLedger_.clock().now();
|
||||||
@@ -674,7 +629,6 @@ public:
|
|||||||
{
|
{
|
||||||
ScopedLock lock{mutex_};
|
ScopedLock lock{mutex_};
|
||||||
beast::expire(byLedger_, parms_.validationSET_EXPIRES);
|
beast::expire(byLedger_, parms_.validationSET_EXPIRES);
|
||||||
beast::expire(bySeq_, parms_.validationSET_EXPIRES);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Update trust status of validations
|
/** Update trust status of validations
|
||||||
@@ -719,21 +673,6 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& it : bySeq_)
|
|
||||||
{
|
|
||||||
for (auto& nodeVal : it.second)
|
|
||||||
{
|
|
||||||
if (added.find(nodeVal.first) != added.end())
|
|
||||||
{
|
|
||||||
nodeVal.second.setTrusted();
|
|
||||||
}
|
|
||||||
else if (removed.find(nodeVal.first) != removed.end())
|
|
||||||
{
|
|
||||||
nodeVal.second.setUntrusted();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value
|
Json::Value
|
||||||
|
|||||||
@@ -78,7 +78,6 @@ class FeatureCollections
|
|||||||
"Checks",
|
"Checks",
|
||||||
"fix1571",
|
"fix1571",
|
||||||
"fix1543",
|
"fix1543",
|
||||||
"ValidationCookies",
|
|
||||||
"fix1623"
|
"fix1623"
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -363,7 +362,6 @@ extern uint256 const featureDepositAuth;
|
|||||||
extern uint256 const featureChecks;
|
extern uint256 const featureChecks;
|
||||||
extern uint256 const fix1571;
|
extern uint256 const fix1571;
|
||||||
extern uint256 const fix1543;
|
extern uint256 const fix1543;
|
||||||
extern uint256 const featureValidationCookies;
|
|
||||||
extern uint256 const fix1623;
|
extern uint256 const fix1623;
|
||||||
|
|
||||||
} // ripple
|
} // ripple
|
||||||
|
|||||||
@@ -117,7 +117,6 @@ public:
|
|||||||
@param isFull Whether the validation is full or partial
|
@param isFull Whether the validation is full or partial
|
||||||
@param fee FeeSettings to include in the validation
|
@param fee FeeSettings to include in the validation
|
||||||
@param amendments If not empty, the amendments to include in this validation
|
@param amendments If not empty, the amendments to include in this validation
|
||||||
@param cookie If not none, the validation cookie to set
|
|
||||||
|
|
||||||
@note The fee and amendment settings are only set if not boost::none.
|
@note The fee and amendment settings are only set if not boost::none.
|
||||||
Typically, the amendments and fees are set for validations of flag
|
Typically, the amendments and fees are set for validations of flag
|
||||||
@@ -133,8 +132,7 @@ public:
|
|||||||
NodeID const& nodeID,
|
NodeID const& nodeID,
|
||||||
bool isFull,
|
bool isFull,
|
||||||
FeeSettings const& fees,
|
FeeSettings const& fees,
|
||||||
std::vector<uint256> const& amendments,
|
std::vector<uint256> const& amendments);
|
||||||
boost::optional<std::uint64_t> const cookie);
|
|
||||||
|
|
||||||
STBase*
|
STBase*
|
||||||
copy(std::size_t n, void* buf) const override
|
copy(std::size_t n, void* buf) const override
|
||||||
|
|||||||
@@ -110,7 +110,6 @@ detail::supportedAmendments ()
|
|||||||
{ "157D2D480E006395B76F948E3E07A45A05FE10230D88A7993C71F97AE4B1F2D1 Checks" },
|
{ "157D2D480E006395B76F948E3E07A45A05FE10230D88A7993C71F97AE4B1F2D1 Checks" },
|
||||||
{ "7117E2EC2DBF119CA55181D69819F1999ECEE1A0225A7FD2B9ED47940968479C fix1571" },
|
{ "7117E2EC2DBF119CA55181D69819F1999ECEE1A0225A7FD2B9ED47940968479C fix1571" },
|
||||||
{ "CA7C02118BA27599528543DFE77BA6838D1B0F43B447D4D7F53523CE6A0E9AC2 fix1543" },
|
{ "CA7C02118BA27599528543DFE77BA6838D1B0F43B447D4D7F53523CE6A0E9AC2 fix1543" },
|
||||||
{ "8413364A1E27704241F7106789570A4B36EE2AFA14F94828E78BE942AB2F24BE ValidationCookies" },
|
|
||||||
{ "58BE9B5968C4DA7C59BA900961828B113E5490699B21877DEF9A31E9D0FE5D5F fix1623" }
|
{ "58BE9B5968C4DA7C59BA900961828B113E5490699B21877DEF9A31E9D0FE5D5F fix1623" }
|
||||||
};
|
};
|
||||||
return supported;
|
return supported;
|
||||||
@@ -163,7 +162,6 @@ uint256 const featureDepositAuth = *getRegisteredFeature("DepositAuth");
|
|||||||
uint256 const featureChecks = *getRegisteredFeature("Checks");
|
uint256 const featureChecks = *getRegisteredFeature("Checks");
|
||||||
uint256 const fix1571 = *getRegisteredFeature("fix1571");
|
uint256 const fix1571 = *getRegisteredFeature("fix1571");
|
||||||
uint256 const fix1543 = *getRegisteredFeature("fix1543");
|
uint256 const fix1543 = *getRegisteredFeature("fix1543");
|
||||||
uint256 const featureValidationCookies = *getRegisteredFeature("ValidationCookies");
|
|
||||||
uint256 const fix1623 = *getRegisteredFeature("fix1623");
|
uint256 const fix1623 = *getRegisteredFeature("fix1623");
|
||||||
|
|
||||||
} // ripple
|
} // ripple
|
||||||
|
|||||||
@@ -35,8 +35,7 @@ STValidation::STValidation(
|
|||||||
NodeID const& nodeID,
|
NodeID const& nodeID,
|
||||||
bool isFull,
|
bool isFull,
|
||||||
FeeSettings const& fees,
|
FeeSettings const& fees,
|
||||||
std::vector<uint256> const& amendments,
|
std::vector<uint256> const& amendments)
|
||||||
boost::optional<std::uint64_t> const cookie)
|
|
||||||
: STObject(getFormat(), sfValidation), mNodeID(nodeID), mSeen(signTime)
|
: STObject(getFormat(), sfValidation), mNodeID(nodeID), mSeen(signTime)
|
||||||
{
|
{
|
||||||
// This is our own public key and it should always be valid.
|
// This is our own public key and it should always be valid.
|
||||||
@@ -70,8 +69,6 @@ STValidation::STValidation(
|
|||||||
|
|
||||||
setFlag(vfFullyCanonicalSig);
|
setFlag(vfFullyCanonicalSig);
|
||||||
|
|
||||||
if(cookie != boost::none)
|
|
||||||
setFieldU64(sfCookie, *cookie);
|
|
||||||
auto const signingHash = getSigningHash();
|
auto const signingHash = getSigningHash();
|
||||||
setFieldVL(
|
setFieldVL(
|
||||||
sfSignature, signDigest(getSignerPublic(), secretKey, signingHash));
|
sfSignature, signDigest(getSignerPublic(), secretKey, signingHash));
|
||||||
|
|||||||
@@ -398,8 +398,7 @@ public:
|
|||||||
calcNodeID(val.first),
|
calcNodeID(val.first),
|
||||||
true,
|
true,
|
||||||
STValidation::FeeSettings{},
|
STValidation::FeeSettings{},
|
||||||
field,
|
field);
|
||||||
boost::none);
|
|
||||||
|
|
||||||
validations.emplace_back(v);
|
validations.emplace_back(v);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,8 +45,7 @@ class RCLValidations_test : public beast::unit_test::suite
|
|||||||
calcNodeID(keys.first),
|
calcNodeID(keys.first),
|
||||||
true,
|
true,
|
||||||
STValidation::FeeSettings{},
|
STValidation::FeeSettings{},
|
||||||
std::vector<uint256>{},
|
std::vector<uint256>{});
|
||||||
1001 /* cookie */);
|
|
||||||
|
|
||||||
BEAST_EXPECT(v->isTrusted());
|
BEAST_EXPECT(v->isTrusted());
|
||||||
v->setUntrusted();
|
v->setUntrusted();
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#include <ripple/basics/random.h>
|
|
||||||
#include <ripple/basics/tagged_integer.h>
|
#include <ripple/basics/tagged_integer.h>
|
||||||
#include <ripple/beast/clock/manual_clock.h>
|
#include <ripple/beast/clock/manual_clock.h>
|
||||||
#include <ripple/beast/unit_test.h>
|
#include <ripple/beast/unit_test.h>
|
||||||
@@ -57,15 +56,11 @@ class Validations_test : public beast::unit_test::suite
|
|||||||
bool trusted_ = true;
|
bool trusted_ = true;
|
||||||
std::size_t signIdx_ = 1;
|
std::size_t signIdx_ = 1;
|
||||||
boost::optional<std::uint32_t> loadFee_;
|
boost::optional<std::uint32_t> loadFee_;
|
||||||
std::uint64_t cookie_;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Node(PeerID nodeID, clock_type const& c)
|
Node(PeerID nodeID, clock_type const& c)
|
||||||
: c_(c)
|
: c_(c)
|
||||||
, nodeID_(nodeID)
|
, nodeID_(nodeID)
|
||||||
, cookie_(rand_int<std::uint64_t>(
|
|
||||||
1,
|
|
||||||
std::numeric_limits<std::uint64_t>::max()))
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +128,6 @@ class Validations_test : public beast::unit_test::suite
|
|||||||
currKey(),
|
currKey(),
|
||||||
nodeID_,
|
nodeID_,
|
||||||
full,
|
full,
|
||||||
cookie_,
|
|
||||||
loadFee_};
|
loadFee_};
|
||||||
if (trusted_)
|
if (trusted_)
|
||||||
v.setTrusted();
|
v.setTrusted();
|
||||||
@@ -1149,45 +1143,6 @@ class Validations_test : public beast::unit_test::suite
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
testCookie()
|
|
||||||
{
|
|
||||||
testcase("Bad cookie");
|
|
||||||
|
|
||||||
LedgerHistoryHelper h;
|
|
||||||
TestHarness harness(h.oracle);
|
|
||||||
Node a = harness.makeNode();
|
|
||||||
Node aReuse{a.nodeID(), harness.clock()};
|
|
||||||
Node b = harness.makeNode();
|
|
||||||
|
|
||||||
BEAST_EXPECT(ValStatus::current == harness.add(a.validate(h["a"])));
|
|
||||||
BEAST_EXPECT(ValStatus::current == harness.add(b.validate(h["b"])));
|
|
||||||
|
|
||||||
BEAST_EXPECT(harness.vals().numTrustedForLedger(h["a"].id()) == 1);
|
|
||||||
BEAST_EXPECT(harness.vals().numTrustedForLedger(h["b"].id()) == 1);
|
|
||||||
BEAST_EXPECT(harness.vals().currentTrusted().size() == 2);
|
|
||||||
// Re-issuing for the same ledger gives badCookie status, but does not
|
|
||||||
// ignore that ledger
|
|
||||||
BEAST_EXPECT(
|
|
||||||
ValStatus::badCookie == harness.add(aReuse.validate(h["a"])));
|
|
||||||
|
|
||||||
BEAST_EXPECT(harness.vals().numTrustedForLedger(h["a"].id()) == 1);
|
|
||||||
BEAST_EXPECT(harness.vals().numTrustedForLedger(h["b"].id()) == 1);
|
|
||||||
BEAST_EXPECT(harness.vals().currentTrusted().size() == 2);
|
|
||||||
|
|
||||||
// Re-issuing for a different ledger gives badCookie status and ignores
|
|
||||||
// the prior validated ledger
|
|
||||||
BEAST_EXPECT(
|
|
||||||
ValStatus::badCookie == harness.add(aReuse.validate(h["b"])));
|
|
||||||
|
|
||||||
BEAST_EXPECT(harness.vals().numTrustedForLedger(h["a"].id()) == 0);
|
|
||||||
BEAST_EXPECT(harness.vals().numTrustedForLedger(h["b"].id()) == 1);
|
|
||||||
BEAST_EXPECT(harness.vals().currentTrusted().size() == 1);
|
|
||||||
|
|
||||||
BEAST_EXPECT(
|
|
||||||
ValStatus::badCookie == harness.add(aReuse.validate(h["b"])));
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
run() override
|
run() override
|
||||||
{
|
{
|
||||||
@@ -1205,7 +1160,6 @@ class Validations_test : public beast::unit_test::suite
|
|||||||
testNumTrustedForLedger();
|
testNumTrustedForLedger();
|
||||||
testSeqEnforcer();
|
testSeqEnforcer();
|
||||||
testTrustChanged();
|
testTrustChanged();
|
||||||
testCookie();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,6 @@
|
|||||||
#ifndef RIPPLE_TEST_CSF_PEER_H_INCLUDED
|
#ifndef RIPPLE_TEST_CSF_PEER_H_INCLUDED
|
||||||
#define RIPPLE_TEST_CSF_PEER_H_INCLUDED
|
#define RIPPLE_TEST_CSF_PEER_H_INCLUDED
|
||||||
|
|
||||||
#include <ripple/basics/random.h>
|
|
||||||
#include <ripple/beast/utility/WrappedSink.h>
|
#include <ripple/beast/utility/WrappedSink.h>
|
||||||
#include <ripple/consensus/Consensus.h>
|
#include <ripple/consensus/Consensus.h>
|
||||||
#include <ripple/consensus/Validations.h>
|
#include <ripple/consensus/Validations.h>
|
||||||
@@ -259,9 +258,6 @@ struct Peer
|
|||||||
//! The collectors to report events to
|
//! The collectors to report events to
|
||||||
CollectorRefs & collectors;
|
CollectorRefs & collectors;
|
||||||
|
|
||||||
//! Random cookie used to tag validations
|
|
||||||
std::uint64_t cookie;
|
|
||||||
|
|
||||||
/** Constructor
|
/** Constructor
|
||||||
|
|
||||||
@param i Unique PeerID
|
@param i Unique PeerID
|
||||||
@@ -294,9 +290,6 @@ struct Peer
|
|||||||
, validations{ValidationParms{}, s.clock(), *this}
|
, validations{ValidationParms{}, s.clock(), *this}
|
||||||
, fullyValidatedLedger{Ledger::MakeGenesis{}}
|
, fullyValidatedLedger{Ledger::MakeGenesis{}}
|
||||||
, collectors{c}
|
, collectors{c}
|
||||||
, cookie{rand_int<std::uint64_t>(
|
|
||||||
1,
|
|
||||||
std::numeric_limits<std::uint64_t>::max())}
|
|
||||||
{
|
{
|
||||||
// All peers start from the default constructed genesis ledger
|
// All peers start from the default constructed genesis ledger
|
||||||
ledgers[lastClosedLedger.id()] = lastClosedLedger;
|
ledgers[lastClosedLedger.id()] = lastClosedLedger;
|
||||||
@@ -593,8 +586,7 @@ struct Peer
|
|||||||
now(),
|
now(),
|
||||||
key,
|
key,
|
||||||
id,
|
id,
|
||||||
isFull,
|
isFull};
|
||||||
cookie};
|
|
||||||
// share the new validation; it is trusted by the receiver
|
// share the new validation; it is trusted by the receiver
|
||||||
share(v);
|
share(v);
|
||||||
// we trust ourselves
|
// we trust ourselves
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ class Validation
|
|||||||
PeerID nodeID_{0};
|
PeerID nodeID_{0};
|
||||||
bool trusted_ = false;
|
bool trusted_ = false;
|
||||||
bool full_ = false;
|
bool full_ = false;
|
||||||
std::uint64_t cookie_;
|
|
||||||
boost::optional<std::uint32_t> loadFee_;
|
boost::optional<std::uint32_t> loadFee_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -69,7 +68,6 @@ public:
|
|||||||
PeerKey key,
|
PeerKey key,
|
||||||
PeerID nodeID,
|
PeerID nodeID,
|
||||||
bool full,
|
bool full,
|
||||||
std::uint64_t cookie,
|
|
||||||
boost::optional<std::uint32_t> loadFee = boost::none)
|
boost::optional<std::uint32_t> loadFee = boost::none)
|
||||||
: ledgerID_{id}
|
: ledgerID_{id}
|
||||||
, seq_{seq}
|
, seq_{seq}
|
||||||
@@ -78,7 +76,6 @@ public:
|
|||||||
, key_{key}
|
, key_{key}
|
||||||
, nodeID_{nodeID}
|
, nodeID_{nodeID}
|
||||||
, full_{full}
|
, full_{full}
|
||||||
, cookie_{cookie}
|
|
||||||
, loadFee_{loadFee}
|
, loadFee_{loadFee}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -147,12 +144,6 @@ public:
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint64_t
|
|
||||||
cookie() const
|
|
||||||
{
|
|
||||||
return cookie_;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto
|
auto
|
||||||
asTie() const
|
asTie() const
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user