21#include <xrpld/app/consensus/RCLValidations.h>
22#include <xrpld/app/ledger/Ledger.h>
23#include <xrpld/app/misc/NegativeUNLVote.h>
24#include <xrpld/app/misc/ValidatorList.h>
25#include <xrpld/app/tx/apply.h>
26#include <xrpld/ledger/View.h>
27#include <xrpl/basics/Log.h>
28#include <xrpl/beast/unit_test.h>
86 hash_map<PublicKey, std::uint32_t> nUnlLedgerSeq);
227 testcase(
"Create UNLModify Tx and apply to ledgers");
232 auto l = std::make_shared<Ledger>(
237 BEAST_EXPECT(l->rules().enabled(featureNegativeUNL));
245 l = std::make_shared<Ledger>(
248 auto txDisable_0 =
createTx(
true, l->seq(), publicKeys[0]);
249 auto txReEnable_1 =
createTx(
false, l->seq(), publicKeys[1]);
261 for (
auto i = 0; i < 256 - 2; ++i)
263 l = std::make_shared<Ledger>(
266 BEAST_EXPECT(l->isFlagLedger());
267 l->updateNegativeUNL();
269 auto txDisable_0 =
createTx(
true, l->seq(), publicKeys[0]);
270 auto txDisable_1 =
createTx(
true, l->seq(), publicKeys[1]);
271 auto txReEnable_2 =
createTx(
false, l->seq(), publicKeys[2]);
281 BEAST_EXPECT(good_size);
284 BEAST_EXPECT(l->validatorToDisable() == publicKeys[0]);
286 uint256 txID = txDisable_0.getTransactionID();
287 BEAST_EXPECT(l->txExists(txID));
293 for (
auto i = 0; i < 256; ++i)
296 BEAST_EXPECT(good_size);
298 BEAST_EXPECT(l->validatorToDisable() == publicKeys[0]);
299 l = std::make_shared<Ledger>(
302 BEAST_EXPECT(l->isFlagLedger());
303 l->updateNegativeUNL();
308 BEAST_EXPECT(good_size);
311 BEAST_EXPECT(*(l->negativeUNL().begin()) == publicKeys[0]);
312 nUnlLedgerSeq.
emplace(publicKeys[0], l->seq());
315 auto txDisable_0 =
createTx(
true, l->seq(), publicKeys[0]);
316 auto txDisable_1 =
createTx(
true, l->seq(), publicKeys[1]);
317 auto txReEnable_0 =
createTx(
false, l->seq(), publicKeys[0]);
318 auto txReEnable_1 =
createTx(
false, l->seq(), publicKeys[1]);
319 auto txReEnable_2 =
createTx(
false, l->seq(), publicKeys[2]);
329 BEAST_EXPECT(good_size);
332 BEAST_EXPECT(l->negativeUNL().count(publicKeys[0]));
333 BEAST_EXPECT(l->validatorToDisable() == publicKeys[1]);
334 BEAST_EXPECT(l->validatorToReEnable() == publicKeys[0]);
342 for (
auto i = 0; i < 256; ++i)
345 BEAST_EXPECT(good_size);
348 BEAST_EXPECT(l->negativeUNL().count(publicKeys[0]));
349 BEAST_EXPECT(l->validatorToDisable() == publicKeys[1]);
350 BEAST_EXPECT(l->validatorToReEnable() == publicKeys[0]);
352 l = std::make_shared<Ledger>(
355 BEAST_EXPECT(l->isFlagLedger());
356 l->updateNegativeUNL();
361 BEAST_EXPECT(good_size);
364 BEAST_EXPECT(l->negativeUNL().count(publicKeys[1]));
367 auto txDisable_0 =
createTx(
true, l->seq(), publicKeys[0]);
373 BEAST_EXPECT(good_size);
376 BEAST_EXPECT(l->negativeUNL().count(publicKeys[1]));
377 BEAST_EXPECT(l->validatorToDisable() == publicKeys[0]);
378 nUnlLedgerSeq.
emplace(publicKeys[1], l->seq());
379 nUnlLedgerSeq.
erase(publicKeys[0]);
386 for (
auto i = 0; i < 256; ++i)
389 BEAST_EXPECT(good_size);
392 BEAST_EXPECT(l->negativeUNL().count(publicKeys[1]));
393 BEAST_EXPECT(l->validatorToDisable() == publicKeys[0]);
395 l = std::make_shared<Ledger>(
398 BEAST_EXPECT(l->isFlagLedger());
399 l->updateNegativeUNL();
404 BEAST_EXPECT(good_size);
407 BEAST_EXPECT(l->negativeUNL().count(publicKeys[0]));
408 BEAST_EXPECT(l->negativeUNL().count(publicKeys[1]));
409 nUnlLedgerSeq.
emplace(publicKeys[0], l->seq());
413 auto txDisable_0 =
createTx(
true, l->seq(), publicKeys[0]);
414 auto txReEnable_0 =
createTx(
false, l->seq(), publicKeys[0]);
415 auto txReEnable_1 =
createTx(
false, l->seq(), publicKeys[1]);
423 BEAST_EXPECT(good_size);
426 BEAST_EXPECT(l->negativeUNL().count(publicKeys[0]));
427 BEAST_EXPECT(l->negativeUNL().count(publicKeys[1]));
428 BEAST_EXPECT(l->validatorToReEnable() == publicKeys[0]);
435 for (
auto i = 0; i < 256; ++i)
438 BEAST_EXPECT(good_size);
441 BEAST_EXPECT(l->negativeUNL().count(publicKeys[0]));
442 BEAST_EXPECT(l->negativeUNL().count(publicKeys[1]));
443 BEAST_EXPECT(l->validatorToReEnable() == publicKeys[0]);
445 l = std::make_shared<Ledger>(
448 BEAST_EXPECT(l->isFlagLedger());
449 l->updateNegativeUNL();
454 BEAST_EXPECT(good_size);
457 BEAST_EXPECT(l->negativeUNL().count(publicKeys[1]));
458 nUnlLedgerSeq.
erase(publicKeys[0]);
462 auto txReEnable_1 =
createTx(
false, l->seq(), publicKeys[1]);
468 BEAST_EXPECT(good_size);
471 BEAST_EXPECT(l->negativeUNL().count(publicKeys[1]));
472 BEAST_EXPECT(l->validatorToReEnable() == publicKeys[1]);
479 for (
auto i = 0; i < 256; ++i)
482 BEAST_EXPECT(good_size);
485 BEAST_EXPECT(l->negativeUNL().count(publicKeys[1]));
486 BEAST_EXPECT(l->validatorToReEnable() == publicKeys[1]);
488 l = std::make_shared<Ledger>(
491 BEAST_EXPECT(l->isFlagLedger());
492 l->updateNegativeUNL();
500 for (
auto i = 0; i < 256; ++i)
503 l = std::make_shared<Ledger>(
506 BEAST_EXPECT(l->isFlagLedger());
507 l->updateNegativeUNL();
526 testcase(
"No negative UNL amendment");
531 auto l = std::make_shared<Ledger>(
536 BEAST_EXPECT(!l->rules().enabled(featureNegativeUNL));
539 for (
auto i = 0; i < 256 - 1; ++i)
541 l = std::make_shared<Ledger>(
544 BEAST_EXPECT(l->seq() == 256);
545 auto txDisable_0 =
createTx(
true, l->seq(), publicKeys[0]);
615 auto l = std::make_shared<Ledger>(
627 l = std::make_shared<Ledger>(
631 if (l->isFlagLedger())
633 l->updateNegativeUNL();
676 return std::make_shared<STValidation>(
682 v.setFieldH256(sfLedgerHash, ledger->info().hash);
683 v.setFieldU32(sfLedgerSequence, ledger->seq());
684 v.setFlag(vfFullValidation);
695 template <
class NeedVal
idation>
747template <
typename PreVote = decltype(defaultPreVote)>
757 auto txSet = std::make_shared<SHAMap>(
761 return countTx(txSet) == expect;
779 auto txSet = std::make_shared<SHAMap>(
786 BEAST_EXPECT(
countTx(txSet) == 0);
788 BEAST_EXPECT(
countTx(txSet) == 1);
790 BEAST_EXPECT(
countTx(txSet) == 2);
810 BEAST_EXPECT(vote.
choose(pad_0, candidates) == n_1);
811 BEAST_EXPECT(vote.
choose(pad_f, candidates) == n_1);
812 candidates.emplace_back(2);
813 BEAST_EXPECT(vote.
choose(pad_0, candidates) == n_1);
814 BEAST_EXPECT(vote.
choose(pad_f, candidates) == n_2);
815 candidates.emplace_back(3);
816 BEAST_EXPECT(vote.
choose(pad_0, candidates) == n_1);
817 BEAST_EXPECT(vote.
choose(pad_f, candidates) == n_3);
891 BEAST_EXPECT(wrongChainSuccess);
912 for (
auto& l : wrongChain)
928 BEAST_EXPECT(scoreTable);
931 for (
auto const& [n, score] : *scoreTable)
934 BEAST_EXPECT(score == 256);
936 BEAST_EXPECT(score == 0);
964 BEAST_EXPECT(scoreTable);
967 for (
auto const& [_, score] : *scoreTable)
970 BEAST_EXPECT(score == 256);
998 auto [disableCandidates, reEnableCandidates] =
1000 bool rightDisable = disableCandidates.size() == numDisable;
1001 bool rightReEnable = reEnableCandidates.size() == numReEnable;
1002 return rightDisable && rightReEnable;
1041 vote, history.
UNLNodeIDSet, negUnl_012, goodScoreTable, 0, 3));
1049 vote, history.
UNLNodeIDSet, negUnl_012, scoreTable, 35 - 3, 0));
1057 vote, history.
UNLNodeIDSet, negUnl_012, scoreTable, 0, 0));
1062 auto scoreTable = goodScoreTable;
1063 scoreTable[*negUnl_012.
begin()] =
1066 vote, history.
UNLNodeIDSet, negUnl_012, scoreTable, 0, 2));
1071 auto scoreTable = goodScoreTable;
1077 vote, history.
UNLNodeIDSet, negUnl_012, scoreTable, 2, 3));
1087 vote, UNL_temp, negUnl_012, goodScoreTable, 0, 3));
1092 auto scoreTable = goodScoreTable;
1101 vote, UNL_temp, negUnl_012, scoreTable, 0, 2));
1115 auto scoreTable = goodScoreTable;
1121 negUnl_temp.
insert(new_1);
1122 negUnl_temp.
insert(new_2);
1124 vote, UNL_temp, negUnl_temp, scoreTable, 0, 3 + 2));
1128 auto scoreTable = goodScoreTable;
1129 scoreTable[new_1] = 0;
1130 scoreTable[new_2] = 0;
1132 vote, UNL_temp, negUnl_012, scoreTable, 0, 3));
1138 auto scoreTable = goodScoreTable;
1139 scoreTable[new_1] = 0;
1140 scoreTable[new_2] = 0;
1142 vote, UNL_temp, negUnl_012, scoreTable, 2, 3));
1150 testcase(
"Find All Candidates Combination");
1186 auto fillScoreTable =
1195 for (
auto const& k : keys)
1198 unl.emplace(nodeIDs.
back());
1199 scoreTable[nodeIDs.
back()] = score;
1202 negUnl.insert(nodeIDs[i]);
1205 for (
auto us : unlSizes)
1207 for (
auto np : nUnlPercent)
1209 for (
auto score : scores)
1215 us, us * np / 100, score, unl, negUnl, scoreTable);
1216 BEAST_EXPECT(unl.
size() == us);
1217 BEAST_EXPECT(negUnl.
size() == us * np / 100);
1218 BEAST_EXPECT(scoreTable.
size() == us);
1227 toDisable_expect = us;
1235 toReEnable_expect = us * np / 100;
1243 toReEnable_expect = us;
1252 toReEnable_expect));
1259 auto fillScoreTable =
1268 for (
auto const& k : keys)
1271 unl.emplace(nodeIDs.
back());
1275 for (
auto score : scores)
1277 scoreTable[nodeIDs[nIdx++]] = score;
1278 scoreTable[nodeIDs[nIdx++]] = score;
1280 for (; nIdx < unl_size;)
1282 scoreTable[nodeIDs[nIdx++]] = scores.back();
1285 if (nUnl_percent == 100)
1289 else if (nUnl_percent == 50)
1292 negUnl.insert(nodeIDs[i]);
1296 for (
auto us : unlSizes)
1298 for (
auto np : nUnlPercent)
1304 fillScoreTable(us, np, unl, negUnl, scoreTable);
1305 BEAST_EXPECT(unl.
size() == us);
1306 BEAST_EXPECT(negUnl.
size() == us * np / 100);
1307 BEAST_EXPECT(scoreTable.
size() == us);
1313 toDisable_expect = 4;
1317 toReEnable_expect = negUnl.
size() - 6;
1321 toReEnable_expect = negUnl.
size() - 12;
1329 toReEnable_expect));
1417 testcase(
"Build Score Table Combination");
1426 {{{0, 0, 0}}, {{50, 50, 50}}, {{100, 100, 100}}, {{0, 50, 100}}}};
1428 for (
auto unlSize : unlSizes)
1433 *
this, {unlSize, 0,
false,
false, 256 + 2}};
1450 scorePattern[sp][k] == 50 && l->seq() % 2 == 0;
1451 bool add_100 = scorePattern[sp][k] == 100;
1452 bool add_me = history.
UNLNodeIDs[idx] == myId;
1453 return add_50 || add_100 || add_me;
1461 BEAST_EXPECT(scoreTable);
1468 return score == 256;
1469 if (scorePattern[sp][k] == 0)
1471 if (scorePattern[sp][k] == 50)
1472 return score == 256 / 2;
1473 if (scorePattern[sp][k] == 100)
1474 return score == 256;
1480 BEAST_EXPECT(checkScores(
1485 BEAST_EXPECT(checkScores(
1488 for (; i < unlSize; ++i)
1490 BEAST_EXPECT(checkScores(
1720 history.UNLKeySet.erase(history.UNLKeys[0]);
1721 history.UNLKeySet.erase(history.UNLKeys[1]);
1757 randomKeyPair(KeyType::ed25519).first;
1759 randomKeyPair(KeyType::ed25519).first;
1760 history.UNLKeySet.insert(extra_key_1);
1761 history.UNLKeySet.insert(extra_key_2);
1762 hash_set<NodeID> nowTrusted;
1763 nowTrusted.insert(calcNodeID(extra_key_1));
1764 nowTrusted.insert(calcNodeID(extra_key_2));
1766 history.lastLedger()->seq(), nowTrusted);
1793 randomKeyPair(KeyType::ed25519).first;
1795 randomKeyPair(KeyType::ed25519).first;
1796 history.UNLKeySet.insert(extra_key_1);
1797 history.UNLKeySet.insert(extra_key_2);
1798 hash_set<NodeID> nowTrusted;
1799 nowTrusted.insert(calcNodeID(extra_key_1));
1800 nowTrusted.insert(calcNodeID(extra_key_2));
1801 vote.newValidators(256, nowTrusted);
1821 auto l = std::make_shared<Ledger>(
1828 return std::make_shared<STValidation>(
1834 v.setFieldH256(sfLedgerHash, l->info().hash);
1835 v.setFieldU32(sfLedgerSequence, l->seq());
1836 v.setFlag(vfFullValidation);
1847 for (
int i = 0; i < numNodes; ++i)
1855 nUnlKeys.
insert(keyPair.first);
1861 auto& local = *nUnlKeys.
begin();
1863 validators.load(local, cfgKeys, cfgPublishers);
1864 validators.updateTrusted(
1870 BEAST_EXPECT(validators.getTrustedMasterKeys().size() == numNodes);
1871 validators.setNegativeUNL(nUnlKeys);
1872 BEAST_EXPECT(validators.getNegativeUNL().size() == negUnlSize);
1875 BEAST_EXPECT(vals.
size() == numNodes);
1876 vals = validators.negativeUNLFilter(std::move(vals));
1877 BEAST_EXPECT(vals.
size() == numNodes - negUnlSize);
1887BEAST_DEFINE_TESTSUITE(NegativeUNL, ledger,
ripple);
1888BEAST_DEFINE_TESTSUITE(NegativeUNLNoAmendment, ledger,
ripple);
1890BEAST_DEFINE_TESTSUITE(NegativeUNLVoteInternal, consensus,
ripple);
1891BEAST_DEFINE_TESTSUITE_MANUAL(NegativeUNLVoteScoreTable, consensus,
ripple);
1892BEAST_DEFINE_TESTSUITE_PRIO(NegativeUNLVoteGoodScore, consensus,
ripple, 1);
1893BEAST_DEFINE_TESTSUITE(NegativeUNLVoteOffline, consensus,
ripple);
1894BEAST_DEFINE_TESTSUITE(NegativeUNLVoteMaxListed, consensus,
ripple);
1895BEAST_DEFINE_TESTSUITE_PRIO(
1896 NegativeUNLVoteRetiredValidator,
1900BEAST_DEFINE_TESTSUITE(NegativeUNLVoteNewValidator, consensus,
ripple);
1901BEAST_DEFINE_TESTSUITE(NegativeUNLVoteFilterValidations, consensus,
ripple);
1913 bool sameSize = l->negativeUNL().size() == size;
1914 bool sameToDisable =
1915 (l->validatorToDisable() != std::nullopt) == hasToDisable;
1916 bool sameToReEnable =
1917 (l->validatorToReEnable() != std::nullopt) == hasToReEnable;
1919 return sameSize && sameToDisable && sameToReEnable;
1941 if (!sle->isFieldPresent(sfDisabledValidators))
1944 auto const& nUnlData = sle->getFieldArray(sfDisabledValidators);
1945 if (nUnlData.size() != nUnlLedgerSeq.
size())
1948 for (
auto const& n : nUnlData)
1950 if (!n.isFieldPresent(sfFirstLedgerSequence) ||
1951 !n.isFieldPresent(sfPublicKey))
1954 auto seq = n.getFieldU32(sfFirstLedgerSequence);
1955 auto d = n.getFieldVL(sfPublicKey);
1960 auto it = nUnlLedgerSeq.
find(pk);
1961 if (it == nUnlLedgerSeq.
end())
1963 if (it->second !=
seq)
1965 nUnlLedgerSeq.
erase(it);
1967 return nUnlLedgerSeq.
size() == 0;
1974 for (
auto i = txSet->begin(); i != txSet->end(); ++i)
1988 for (
int i = 0; i < n; ++i)
1991 Slice s(data.data(), ss);
2000 auto fill = [&](
auto& obj) {
2001 obj.setFieldU8(sfUNLModifyDisabling, disabling ? 1 : 0);
2002 obj.setFieldU32(sfLedgerSequence,
seq);
2003 obj.setFieldVL(sfUNLModifyValidator, txKey);
2005 return STTx(ttUNL_MODIFY, fill);
testcase_t testcase
Memberspace for declaring test cases.
virtual Config & config()=0
virtual Overlay & overlay()=0
virtual TimeKeeper & timeKeeper()=0
virtual NetworkOPs & getOPs()=0
virtual ValidatorList & validators()=0
virtual Family & getNodeFamily()=0
virtual HashRouter & getHashRouter()=0
Manager to create NegativeUNL votes.
static constexpr size_t negativeUNLHighWaterMark
An unreliable validator must have more than negativeUNLHighWaterMark validations in the last flag led...
NodeID choose(uint256 const &randomPadData, std::vector< NodeID > const &candidates)
Pick one candidate from a vector of candidates.
std::optional< hash_map< NodeID, std::uint32_t > > buildScoreTable(std::shared_ptr< Ledger const > const &prevLedger, hash_set< NodeID > const &unl, RCLValidations &validations)
Build a reliability measurement score table of validators' validation messages in the last flag ledge...
void purgeNewValidators(LedgerIndex seq)
Purge validators that are not new anymore.
Candidates const findAllCandidates(hash_set< NodeID > const &unl, hash_set< NodeID > const &negUnl, hash_map< NodeID, std::uint32_t > const &scoreTable)
Process the score table and find all disabling and re-enabling candidates.
static constexpr size_t newValidatorDisableSkip
We don't want to disable new validators immediately after adding them.
static constexpr size_t negativeUNLLowWaterMark
A validator is considered unreliable if its validations is less than negativeUNLLowWaterMark in the l...
void doVoting(std::shared_ptr< Ledger const > const &prevLedger, hash_set< PublicKey > const &unlKeys, RCLValidations &validations, std::shared_ptr< SHAMap > const &initialSet)
Cast our local vote on the NegativeUNL candidates.
hash_map< NodeID, LedgerIndex > newValidators_
void newValidators(LedgerIndex seq, hash_set< NodeID > const &nowTrusted)
Notify NegativeUNLVote that new validators are added.
void addTx(LedgerIndex seq, PublicKey const &vp, NegativeUNLModify modify, std::shared_ptr< SHAMap > const &initialSet)
Add a ttUNL_MODIFY Tx to the transaction set.
static constexpr size_t negativeUNLMinLocalValsToVote
The minimum number of validations of the local node for it to participate in the voting.
Writable ledger view that accumulates state and tx changes.
void apply(TxsRawView &to) const
Apply changes.
Wrapper over STValidation for generic Validation code.
An immutable linear range of bytes.
time_point now() const override
Returns the current time, using the server's clock.
time_point closeTime() const
Returns the predicted close time, in network time.
ValStatus add(NodeID const &nodeID, Validation const &val)
Add a new validation.
time_point now() const override
Returns the current time.
void testNegativeUNLNoAmendment()
void run() override
Runs the suite.
void run() override
Runs the suite.
void testFilterValidations()
void run() override
Runs the suite.
Test the private member functions of NegativeUNLVote.
void testPickOneCandidate()
void testFindAllCandidates()
void testBuildScoreTableSpecialCases()
void run() override
Runs the suite.
bool checkCandidateSizes(NegativeUNLVote &vote, hash_set< NodeID > const &unl, hash_set< NodeID > const &negUnl, hash_map< NodeID, std::uint32_t > const &scoreTable, std::size_t numDisable, std::size_t numReEnable)
Find all candidates and check if the number of candidates meets expectation.
void testFindAllCandidatesCombination()
void run() override
Runs the suite.
void run() override
Runs the suite.
void run() override
Runs the suite.
void run() override
Runs the suite.
Rest the build score table function of NegativeUNLVote.
void testBuildScoreTableCombination()
void run() override
Runs the suite.
void run() override
Runs the suite.
void testNegativeUNL()
Test filling and applying ttUNL_MODIFY Tx, as well as ledger update:
A transaction testing environment.
beast::Journal const journal
ManualTimeKeeper & timeKeeper()
T emplace_back(T... args)
Keylet const & negativeUNL() noexcept
The (fixed) index of the object containing the ledger negativeUNL.
FeatureBitset supported_amendments()
std::size_t countTx(std::shared_ptr< SHAMap > const &txSet)
Count the number of Tx in a TxSet.
bool negUnlSizeTest(std::shared_ptr< Ledger const > const &l, size_t size, bool hasToDisable, bool hasToReEnable)
Test the size of the negative UNL in a ledger, also test if the ledger has ToDisalbe and/or ToReEnabl...
std::vector< PublicKey > createPublicKeys(std::size_t n)
Create fake public keys.
STTx createTx(bool disabling, LedgerIndex seq, PublicKey const &txKey)
Create ttUNL_MODIFY Tx.
bool applyAndTestResult(jtx::Env &env, OpenView &view, STTx const &tx, bool pass)
Try to apply a ttUNL_MODIFY Tx, and test the apply result.
bool voteAndCheck(NetworkHistory &history, NodeID const &myId, std::size_t expect, PreVote const &pre=defaultPreVote)
Create a NegativeUNLVote object.
bool VerifyPubKeyAndSeq(std::shared_ptr< Ledger const > const &l, hash_map< PublicKey, std::uint32_t > nUnlLedgerSeq)
Verify the content of negative UNL entries (public key and ledger sequence) of a ledger.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
std::uint32_t LedgerIndex
A ledger index.
base_uint< 160, detail::NodeIDTag > NodeID
NodeID is a 160-bit hash representing one node.
PublicKey derivePublicKey(KeyType type, SecretKey const &sk)
Derive the public key from a secret key.
std::optional< KeyType > publicKeyType(Slice const &slice)
Returns the type of public key.
std::enable_if_t< std::is_same< T, char >::value||std::is_same< T, unsigned char >::value, Slice > makeSlice(std::array< T, N > const &a)
SecretKey randomSecretKey()
Create a secret key using secure random numbers.
NodeID calcNodeID(PublicKey const &)
Calculate the 160-bit node ID from a node public key.
ApplyResult apply(Application &app, OpenView &view, STTx const &tx, ApplyFlags flags, beast::Journal journal)
Apply a transaction to an OpenView.
create_genesis_t const create_genesis
std::pair< PublicKey, SecretKey > randomKeyPair(KeyType type)
Create a key pair using secure random numbers.
Only reasonable parameters can be honored, e.g cannot hasToReEnable when nUNLSize == 0.
std::optional< int > numLedgers
if not specified, the number of ledgers in the history is calculated from negUNLSize,...
Utility class for creating validators and ledger history.
std::shared_ptr< Ledger const > lastLedger() const
void walkHistoryAndAddValidations(NeedValidation &&needVal)
Walk the ledger history and create validation messages for the ledgers.
NetworkHistory(beast::unit_test::suite &suite, Parameter const &p)
std::vector< NodeID > UNLNodeIDs
std::shared_ptr< STValidation > createSTVal(std::shared_ptr< Ledger const > const &ledger, NodeID const &v)
Create a validation.
hash_set< NodeID > UNLNodeIDSet
std::vector< PublicKey > UNLKeys
bool createLedgerHistory()
create ledger history and apply needed ttUNL_MODIFY tx at flag ledgers
RCLValidations & validations
hash_set< PublicKey > UNLKeySet
Set the sequence number on a JTx.