Remove validation cookie support code

This commit is contained in:
Brad Chase
2018-05-04 11:59:33 -04:00
committed by Nikolaos D. Bougalis
parent 04f1388860
commit 6156ff3eb7
16 changed files with 9 additions and 171 deletions

View File

@@ -398,8 +398,7 @@ public:
calcNodeID(val.first),
true,
STValidation::FeeSettings{},
field,
boost::none);
field);
validations.emplace_back(v);
}

View File

@@ -45,8 +45,7 @@ class RCLValidations_test : public beast::unit_test::suite
calcNodeID(keys.first),
true,
STValidation::FeeSettings{},
std::vector<uint256>{},
1001 /* cookie */);
std::vector<uint256>{});
BEAST_EXPECT(v->isTrusted());
v->setUntrusted();

View File

@@ -17,7 +17,6 @@
*/
//==============================================================================
#include <ripple/basics/random.h>
#include <ripple/basics/tagged_integer.h>
#include <ripple/beast/clock/manual_clock.h>
#include <ripple/beast/unit_test.h>
@@ -57,15 +56,11 @@ class Validations_test : public beast::unit_test::suite
bool trusted_ = true;
std::size_t signIdx_ = 1;
boost::optional<std::uint32_t> loadFee_;
std::uint64_t cookie_;
public:
Node(PeerID nodeID, clock_type const& c)
: c_(c)
, 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(),
nodeID_,
full,
cookie_,
loadFee_};
if (trusted_)
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
run() override
{
@@ -1205,7 +1160,6 @@ class Validations_test : public beast::unit_test::suite
testNumTrustedForLedger();
testSeqEnforcer();
testTrustChanged();
testCookie();
}
};

View File

@@ -19,7 +19,6 @@
#ifndef 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/consensus/Consensus.h>
#include <ripple/consensus/Validations.h>
@@ -259,9 +258,6 @@ struct Peer
//! The collectors to report events to
CollectorRefs & collectors;
//! Random cookie used to tag validations
std::uint64_t cookie;
/** Constructor
@param i Unique PeerID
@@ -294,9 +290,6 @@ struct Peer
, validations{ValidationParms{}, s.clock(), *this}
, fullyValidatedLedger{Ledger::MakeGenesis{}}
, 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
ledgers[lastClosedLedger.id()] = lastClosedLedger;
@@ -593,8 +586,7 @@ struct Peer
now(),
key,
id,
isFull,
cookie};
isFull};
// share the new validation; it is trusted by the receiver
share(v);
// we trust ourselves

View File

@@ -55,7 +55,6 @@ class Validation
PeerID nodeID_{0};
bool trusted_ = false;
bool full_ = false;
std::uint64_t cookie_;
boost::optional<std::uint32_t> loadFee_;
public:
@@ -69,7 +68,6 @@ public:
PeerKey key,
PeerID nodeID,
bool full,
std::uint64_t cookie,
boost::optional<std::uint32_t> loadFee = boost::none)
: ledgerID_{id}
, seq_{seq}
@@ -78,7 +76,6 @@ public:
, key_{key}
, nodeID_{nodeID}
, full_{full}
, cookie_{cookie}
, loadFee_{loadFee}
{
}
@@ -147,12 +144,6 @@ public:
return *this;
}
std::uint64_t
cookie() const
{
return cookie_;
}
auto
asTie() const
{