2#include <test/jtx/Env.h>
4#include <xrpld/app/consensus/RCLValidations.h>
5#include <xrpld/app/misc/NegativeUNLVote.h>
6#include <xrpld/app/misc/ValidatorList.h>
8#include <xrpl/basics/Slice.h>
9#include <xrpl/basics/UnorderedContainers.h>
10#include <xrpl/basics/base_uint.h>
11#include <xrpl/beast/unit_test/suite.h>
12#include <xrpl/ledger/ApplyView.h>
13#include <xrpl/ledger/Ledger.h>
14#include <xrpl/ledger/OpenView.h>
15#include <xrpl/protocol/Indexes.h>
16#include <xrpl/protocol/KeyType.h>
17#include <xrpl/protocol/Protocol.h>
18#include <xrpl/protocol/PublicKey.h>
19#include <xrpl/protocol/SField.h>
20#include <xrpl/protocol/STTx.h>
21#include <xrpl/protocol/STValidation.h>
22#include <xrpl/protocol/SecretKey.h>
23#include <xrpl/protocol/TER.h>
24#include <xrpl/protocol/TxFormats.h>
25#include <xrpl/protocol/UintTypes.h>
26#include <xrpl/protocol/tokens.h>
27#include <xrpl/shamap/SHAMapMissingNode.h>
28#include <xrpl/tx/apply.h>
64 std::shared_ptr<Ledger const>
const& l,
92 std::shared_ptr<Ledger const>
const& l,
102countTx(std::shared_ptr<SHAMap>
const& txSet);
110std::vector<PublicKey>
234 testcase(
"Create UNLModify Tx and apply to ledgers");
242 env.
app().config().fees.toFees(),
254 auto txDisable0 =
createTx(
true, l->seq(), publicKeys[0]);
255 auto txReEnable1 =
createTx(
false, l->seq(), publicKeys[1]);
267 for (
auto i = 0; i < 256 - 2; ++i)
271 BEAST_EXPECT(l->isFlagLedger());
272 l->updateNegativeUNL();
274 auto txDisable0 =
createTx(
true, l->seq(), publicKeys[0]);
275 auto txDisable1 =
createTx(
true, l->seq(), publicKeys[1]);
276 auto txReEnable2 =
createTx(
false, l->seq(), publicKeys[2]);
286 BEAST_EXPECT(goodSize);
289 BEAST_EXPECT(l->validatorToDisable() == publicKeys[0]);
291 uint256 const txID = txDisable0.getTransactionID();
292 BEAST_EXPECT(l->txExists(txID));
298 for (
auto i = 0; i < 256; ++i)
301 BEAST_EXPECT(goodSize);
303 BEAST_EXPECT(l->validatorToDisable() == publicKeys[0]);
306 BEAST_EXPECT(l->isFlagLedger());
307 l->updateNegativeUNL();
312 BEAST_EXPECT(goodSize);
315 BEAST_EXPECT(*(l->negativeUNL().begin()) == publicKeys[0]);
316 nUnlLedgerSeq.
emplace(publicKeys[0], l->seq());
319 auto txDisable0 =
createTx(
true, l->seq(), publicKeys[0]);
320 auto txDisable1 =
createTx(
true, l->seq(), publicKeys[1]);
321 auto txReEnable0 =
createTx(
false, l->seq(), publicKeys[0]);
322 auto txReEnable1 =
createTx(
false, l->seq(), publicKeys[1]);
323 auto txReEnable2 =
createTx(
false, l->seq(), publicKeys[2]);
333 BEAST_EXPECT(goodSize);
336 BEAST_EXPECT(l->negativeUNL().count(publicKeys[0]));
337 BEAST_EXPECT(l->validatorToDisable() == publicKeys[1]);
338 BEAST_EXPECT(l->validatorToReEnable() == publicKeys[0]);
346 for (
auto i = 0; i < 256; ++i)
349 BEAST_EXPECT(goodSize);
352 BEAST_EXPECT(l->negativeUNL().count(publicKeys[0]));
353 BEAST_EXPECT(l->validatorToDisable() == publicKeys[1]);
354 BEAST_EXPECT(l->validatorToReEnable() == publicKeys[0]);
358 BEAST_EXPECT(l->isFlagLedger());
359 l->updateNegativeUNL();
364 BEAST_EXPECT(goodSize);
367 BEAST_EXPECT(l->negativeUNL().count(publicKeys[1]));
370 auto txDisable0 =
createTx(
true, l->seq(), publicKeys[0]);
376 BEAST_EXPECT(goodSize);
379 BEAST_EXPECT(l->negativeUNL().count(publicKeys[1]));
380 BEAST_EXPECT(l->validatorToDisable() == publicKeys[0]);
381 nUnlLedgerSeq.
emplace(publicKeys[1], l->seq());
382 nUnlLedgerSeq.
erase(publicKeys[0]);
389 for (
auto i = 0; i < 256; ++i)
392 BEAST_EXPECT(goodSize);
395 BEAST_EXPECT(l->negativeUNL().count(publicKeys[1]));
396 BEAST_EXPECT(l->validatorToDisable() == publicKeys[0]);
400 BEAST_EXPECT(l->isFlagLedger());
401 l->updateNegativeUNL();
406 BEAST_EXPECT(goodSize);
409 BEAST_EXPECT(l->negativeUNL().count(publicKeys[0]));
410 BEAST_EXPECT(l->negativeUNL().count(publicKeys[1]));
411 nUnlLedgerSeq.
emplace(publicKeys[0], l->seq());
415 auto txDisable0 =
createTx(
true, l->seq(), publicKeys[0]);
416 auto txReEnable0 =
createTx(
false, l->seq(), publicKeys[0]);
417 auto txReEnable1 =
createTx(
false, l->seq(), publicKeys[1]);
425 BEAST_EXPECT(goodSize);
428 BEAST_EXPECT(l->negativeUNL().count(publicKeys[0]));
429 BEAST_EXPECT(l->negativeUNL().count(publicKeys[1]));
430 BEAST_EXPECT(l->validatorToReEnable() == publicKeys[0]);
437 for (
auto i = 0; i < 256; ++i)
440 BEAST_EXPECT(goodSize);
443 BEAST_EXPECT(l->negativeUNL().count(publicKeys[0]));
444 BEAST_EXPECT(l->negativeUNL().count(publicKeys[1]));
445 BEAST_EXPECT(l->validatorToReEnable() == publicKeys[0]);
449 BEAST_EXPECT(l->isFlagLedger());
450 l->updateNegativeUNL();
455 BEAST_EXPECT(goodSize);
458 BEAST_EXPECT(l->negativeUNL().count(publicKeys[1]));
459 nUnlLedgerSeq.
erase(publicKeys[0]);
463 auto txReEnable1 =
createTx(
false, l->seq(), publicKeys[1]);
469 BEAST_EXPECT(goodSize);
472 BEAST_EXPECT(l->negativeUNL().count(publicKeys[1]));
473 BEAST_EXPECT(l->validatorToReEnable() == publicKeys[1]);
480 for (
auto i = 0; i < 256; ++i)
483 BEAST_EXPECT(goodSize);
486 BEAST_EXPECT(l->negativeUNL().count(publicKeys[1]));
487 BEAST_EXPECT(l->validatorToReEnable() == publicKeys[1]);
491 BEAST_EXPECT(l->isFlagLedger());
492 l->updateNegativeUNL();
500 for (
auto i = 0; i < 256; ++i)
505 BEAST_EXPECT(l->isFlagLedger());
506 l->updateNegativeUNL();
548 if (!
param.numLedgers)
549 param.numLedgers = 256 * (
param.negUNLSize + 1);
556 assert(
param.numNodes <= 256);
558 for (
int i = 0; i <
param.numNodes; ++i)
577 env.app().config().fees.toFees(),
579 env.app().getNodeFamily());
585 while (l->seq() <=
param.numLedgers)
590 if (l->isFlagLedger())
592 l->updateNegativeUNL();
594 if (l->negativeUNL().size() <
param.negUNLSize)
601 else if (l->negativeUNL().size() ==
param.negUNLSize)
603 if (
param.hasToDisable)
610 if (
param.hasToReEnable)
635 env.app().getTimeKeeper().now(),
640 v.setFieldH256(sfLedgerHash, ledger->header().hash);
641 v.setFieldU32(sfLedgerSequence, ledger->seq());
642 v.setFlag(kVfFullValidation);
653 template <
class NeedVal
idation>
662 for (; curr !=
history.size(); ++curr)
705template <
typename PreVote = decltype(gDefaultPreVote)>
718 return countTx(txSet) == expect;
740 BEAST_EXPECT(
countTx(txSet) == 0);
742 BEAST_EXPECT(
countTx(txSet) == 1);
744 BEAST_EXPECT(
countTx(txSet) == 2);
764 BEAST_EXPECT(vote.
choose(pad0, candidates) == n1);
765 BEAST_EXPECT(vote.
choose(padF, candidates) == n1);
766 candidates.emplace_back(2);
767 BEAST_EXPECT(vote.
choose(pad0, candidates) == n1);
768 BEAST_EXPECT(vote.
choose(padF, candidates) == n2);
769 candidates.emplace_back(3);
770 BEAST_EXPECT(vote.
choose(pad0, candidates) == n1);
771 BEAST_EXPECT(vote.
choose(padF, candidates) == n3);
792 .hasToDisable =
false,
793 .hasToReEnable =
false,
810 .hasToDisable =
false,
811 .hasToReEnable =
false,
812 .numLedgers = 256 / 2}};
828 .hasToDisable =
false,
829 .hasToReEnable =
false,
830 .numLedgers = 256 + 2}};
838 return history.
unlNodeIDs[idx] != myId || l->seq() % 2 != 0;
853 .hasToDisable =
false,
854 .hasToReEnable =
false,
855 .numLedgers = 256 + 2}};
857 bool const wrongChainSuccess = history.
goodHistory;
858 BEAST_EXPECT(wrongChainSuccess);
877 for (
auto& l : wrongChain)
891 BEAST_EXPECT(scoreTable);
894 for (
auto const& [n, score] : *scoreTable)
898 BEAST_EXPECT(score == 256);
902 BEAST_EXPECT(score == 0);
920 .hasToDisable =
false,
921 .hasToReEnable =
false,
922 .numLedgers = 256 + 1}};
933 BEAST_EXPECT(scoreTable);
936 for (
auto const& [_, score] : *scoreTable)
939 BEAST_EXPECT(score == 256);
967 auto [disableCandidates, reEnableCandidates] =
969 bool const rightDisable = disableCandidates.size() == numDisable;
970 bool const rightReEnable = reEnableCandidates.size() == numReEnable;
971 return rightDisable && rightReEnable;
998 .hasToDisable =
false,
999 .hasToReEnable =
false,
1037 auto scoreTable = goodScoreTable;
1045 auto scoreTable = goodScoreTable;
1063 auto scoreTable = goodScoreTable;
1075 NodeID const new1(0xbead);
1076 NodeID const new2(0xbeef);
1084 auto scoreTable = goodScoreTable;
1094 auto scoreTable = goodScoreTable;
1095 scoreTable[new1] = 0;
1096 scoreTable[new2] = 0;
1102 auto scoreTable = goodScoreTable;
1103 scoreTable[new1] = 0;
1104 scoreTable[new2] = 0;
1113 testcase(
"Find All Candidates Combination");
1157 for (
auto const& k : keys)
1160 unl.emplace(nodeIDs.
back());
1161 scoreTable[nodeIDs.
back()] = score;
1164 negUnl.insert(nodeIDs[i]);
1167 for (
auto us : unlSizes)
1169 for (
auto np : nUnlPercent)
1171 for (
auto score : scores)
1176 fillScoreTable(us, us * np / 100, score, unl, negUnl, scoreTable);
1177 BEAST_EXPECT(unl.
size() == us);
1178 BEAST_EXPECT(negUnl.
size() == us * np / 100);
1179 BEAST_EXPECT(scoreTable.
size() == us);
1187 toDisableExpect = us;
1194 toReEnableExpect = us * np / 100;
1201 toReEnableExpect = us;
1205 vote, unl, negUnl, scoreTable, toDisableExpect, toReEnableExpect));
1219 for (
auto const& k : keys)
1222 unl.emplace(nodeIDs.
back());
1226 for (
auto score : scores)
1228 scoreTable[nodeIDs[nIdx++]] = score;
1229 scoreTable[nodeIDs[nIdx++]] = score;
1231 for (; nIdx < unlSize;)
1233 scoreTable[nodeIDs[nIdx++]] = scores.back();
1236 if (nUnlPercent == 100)
1240 else if (nUnlPercent == 50)
1243 negUnl.insert(nodeIDs[i]);
1247 for (
auto us : unlSizes)
1249 for (
auto np : nUnlPercent)
1255 fillScoreTable(us, np, unl, negUnl, scoreTable);
1256 BEAST_EXPECT(unl.
size() == us);
1257 BEAST_EXPECT(negUnl.
size() == us * np / 100);
1258 BEAST_EXPECT(scoreTable.
size() == us);
1264 toDisableExpect = 4;
1268 toReEnableExpect = negUnl.
size() - 6;
1272 toReEnableExpect = negUnl.
size() - 12;
1275 vote, unl, negUnl, scoreTable, toDisableExpect, toReEnableExpect));
1359 testcase(
"Build Score Table Combination");
1368 {{{0, 0, 0}}, {{50, 50, 50}}, {{100, 100, 100}}, {{0, 50, 100}}}};
1370 for (
auto unlSize : unlSizes)
1376 {.numNodes = unlSize,
1378 .hasToDisable =
false,
1379 .hasToReEnable =
false,
1380 .numLedgers = 256 + 2}};
1401 bool const add50 = scorePattern[sp][k] == 50 && l->seq() % 2 == 0;
1402 bool const add100 = scorePattern[sp][k] == 100;
1403 bool const addMe = history.
unlNodeIDs[idx] == myId;
1404 return add50 || add100 || addMe;
1410 BEAST_EXPECT(scoreTable);
1416 return score == 256;
1417 if (scorePattern[sp][k] == 0)
1419 if (scorePattern[sp][k] == 50)
1420 return score == 256 / 2;
1421 if (scorePattern[sp][k] == 100)
1423 return score == 256;
1430 BEAST_EXPECT(checkScores((*scoreTable)[history.
unlNodeIDs[i]], 0));
1434 BEAST_EXPECT(checkScores((*scoreTable)[history.
unlNodeIDs[i]], 1));
1436 for (; i < unlSize; ++i)
1438 BEAST_EXPECT(checkScores((*scoreTable)[history.
unlNodeIDs[i]], 2));
1499 .hasToDisable =
false,
1500 .hasToReEnable =
false,
1520 .hasToDisable =
true,
1521 .hasToReEnable =
false,
1556 .hasToDisable =
false,
1557 .hasToReEnable =
true,
1578 .hasToDisable =
true,
1579 .hasToReEnable =
false,
1618 .hasToDisable =
true,
1619 .hasToReEnable =
true,
1655 .hasToDisable =
false,
1656 .hasToReEnable =
false,
1676 .hasToDisable =
false,
1677 .hasToReEnable =
false,
1697 .hasToDisable =
false,
1698 .hasToReEnable =
false,
1709 history.unlKeySet.erase(history.unlKeys[0]);
1710 history.unlKeySet.erase(history.unlKeys[1]);
1737 .hasToDisable =
false,
1738 .hasToReEnable =
false,
1749 auto extraKey1 = randomKeyPair(KeyType::Ed25519).first;
1750 auto extraKey2 = randomKeyPair(KeyType::Ed25519).first;
1751 history.unlKeySet.insert(extraKey1);
1752 history.unlKeySet.insert(extraKey2);
1753 hash_set<NodeID> nowTrusted;
1754 nowTrusted.insert(calcNodeID(extraKey1));
1755 nowTrusted.insert(calcNodeID(extraKey2));
1756 vote.newValidators(history.lastLedger()->seq(), nowTrusted);
1768 .hasToDisable =
false,
1769 .hasToReEnable =
false,
1780 auto extraKey1 = randomKeyPair(KeyType::Ed25519).first;
1781 auto extraKey2 = randomKeyPair(KeyType::Ed25519).first;
1782 history.unlKeySet.insert(extraKey1);
1783 history.unlKeySet.insert(extraKey2);
1784 hash_set<NodeID> nowTrusted;
1785 nowTrusted.insert(calcNodeID(extraKey1));
1786 nowTrusted.insert(calcNodeID(extraKey2));
1787 vote.newValidators(256, nowTrusted);
1810 env.
app().config().fees.toFees(),
1821 v.setFieldH256(sfLedgerHash, l->header().hash);
1822 v.setFieldU32(sfLedgerSequence, l->seq());
1823 v.setFlag(kVfFullValidation);
1834 for (
int i = 0; i < numNodes; ++i)
1842 nUnlKeys.
insert(keyPair.first);
1848 auto& local = *nUnlKeys.
begin();
1850 validators.load(local, cfgKeys, cfgPublishers);
1851 validators.updateTrusted(
1857 BEAST_EXPECT(validators.getTrustedMasterKeys().size() == numNodes);
1858 validators.setNegativeUNL(nUnlKeys);
1859 BEAST_EXPECT(validators.getNegativeUNL().size() == negUnlSize);
1862 BEAST_EXPECT(vals.
size() == numNodes);
1863 vals = validators.negativeUNLFilter(std::move(vals));
1864 BEAST_EXPECT(vals.
size() == numNodes - negUnlSize);
1895 bool const sameSize = l->negativeUNL().size() == size;
1896 bool const sameToDisable = (l->validatorToDisable() != std::nullopt) == hasToDisable;
1897 bool const sameToReEnable = (l->validatorToReEnable() != std::nullopt) == hasToReEnable;
1899 return sameSize && sameToDisable && sameToReEnable;
1922 if (!sle->isFieldPresent(sfDisabledValidators))
1925 auto const& nUnlData = sle->getFieldArray(sfDisabledValidators);
1926 if (nUnlData.size() != nUnlLedgerSeq.
size())
1929 for (
auto const& n : nUnlData)
1931 if (!n.isFieldPresent(sfFirstLedgerSequence) || !n.isFieldPresent(sfPublicKey))
1934 auto seq = n.getFieldU32(sfFirstLedgerSequence);
1935 auto d = n.getFieldVL(sfPublicKey);
1940 auto it = nUnlLedgerSeq.
find(pk);
1941 if (it == nUnlLedgerSeq.
end())
1943 if (it->second != seq)
1945 nUnlLedgerSeq.
erase(it);
1947 return nUnlLedgerSeq.
empty();
1954 for (
auto i = txSet->begin(); i != txSet->end(); ++i)
1968 for (
int i = 0; i < n; ++i)
1971 Slice const s(data.data(), ss);
1980 auto fill = [&](
auto& obj) {
1981 obj.setFieldU8(sfUNLModifyDisabling, disabling ? 1 : 0);
1982 obj.setFieldU32(sfLedgerSequence, seq);
1983 obj.setFieldVL(sfUNLModifyValidator, txKey);
1985 return STTx(ttUNL_MODIFY, fill);
TestcaseT testcase
Memberspace for declaring test cases.
virtual Config & config()=0
std::unordered_set< uint256, beast::Uhash<> > features
Manager to create NegativeUNL votes.
void newValidators(LedgerIndex seq, hash_set< NodeID > const &nowTrusted)
Notify NegativeUNLVote that new validators are added.
static constexpr size_t kNegativeUnlHighWaterMark
An unreliable validator must have more than negativeUNLHighWaterMark validations in the last flag led...
static constexpr size_t kNegativeUnlMinLocalValsToVote
The minimum number of validations of the local node for it to participate in the voting.
Candidates 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 NodeID choose(uint256 const &randomPadData, std::vector< NodeID > const &candidates)
Pick one candidate from a vector of candidates.
static constexpr size_t kNewValidatorDisableSkip
We don't want to disable new validators immediately after adding them.
void purgeNewValidators(LedgerIndex seq)
Purge validators that are not new anymore.
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...
static constexpr size_t kNegativeUnlLowWaterMark
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 addTx(LedgerIndex seq, PublicKey const &vp, NegativeUNLModify modify, std::shared_ptr< SHAMap > const &initialSet)
Add a ttUNL_MODIFY Tx to the transaction set.
Writable ledger view that accumulates state and tx changes.
void apply(TxsRawView &to) const
Apply changes.
Wrapper over STValidation for generic Validation code.
Rules controlling protocol behavior.
virtual NetworkOPs & getOPs()=0
virtual ValidatorList & getValidators()=0
virtual HashRouter & getHashRouter()=0
virtual Family & getNodeFamily()=0
virtual Overlay & getOverlay()=0
virtual TimeKeeper & getTimeKeeper()=0
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 run() override
Runs the suite.
void testFilterValidations()
void run() override
Runs the suite.
Test the private member functions of NegativeUNLVote.
void testBuildScoreTableSpecialCases()
void testPickOneCandidate()
static 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 run() override
Runs the suite.
void testFindAllCandidatesCombination()
void testFindAllCandidates()
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 testNegativeUNL()
Test filling and applying ttUNL_MODIFY Tx, as well as ledger update:
void run() override
Runs the suite.
A transaction testing environment.
ManualTimeKeeper & timeKeeper()
beast::Journal const journal
T emplace_back(T... args)
Keylet const & negativeUNL() noexcept
The (fixed) index of the object containing the ledger negativeUNL.
FeatureBitset testableAmendments()
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 ToDisable and/or ToReEnabl...
bool applyAndTestResult(jtx::Env &env, OpenView &view, STTx const &tx, bool pass)
Try to apply a ttUNL_MODIFY Tx, and test the apply result.
std::vector< PublicKey > createPublicKeys(std::size_t n)
Create fake public keys.
BEAST_DEFINE_TESTSUITE(AMMClawback, app, xrpl)
bool voteAndCheck(NetworkHistory &history, NodeID const &myId, std::size_t expect, PreVote const &pre=gDefaultPreVote)
Create a NegativeUNLVote object.
BEAST_DEFINE_TESTSUITE_MANUAL(AMMCalc, app, xrpl)
STTx createTx(bool disabling, LedgerIndex seq, PublicKey const &txKey)
Create ttUNL_MODIFY Tx.
std::size_t countTx(std::shared_ptr< SHAMap > const &txSet)
Count the number of Tx in a TxSet.
BEAST_DEFINE_TESTSUITE_PRIO(AccountDelete, app, xrpl, 2)
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::pair< PublicKey, SecretKey > randomKeyPair(KeyType type)
Create a key pair using secure random numbers.
PublicKey derivePublicKey(KeyType type, SecretKey const &sk)
Derive the public key from a secret key.
ApplyResult apply(ServiceRegistry ®istry, OpenView &view, STTx const &tx, ApplyFlags flags, beast::Journal journal)
Apply a transaction to an OpenView.
std::uint32_t LedgerIndex
A ledger index.
CreateGenesisT const kCreateGenesis
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
std::unordered_set< Value, Hash, Pred, Allocator > hash_set
std::optional< KeyType > publicKeyType(Slice const &slice)
Returns the type of public key.
NodeID calcNodeID(PublicKey const &)
Calculate the 160-bit node ID from a node public key.
SecretKey randomSecretKey()
Create a secret key using secure random numbers.
Validations< RCLValidationsAdaptor > RCLValidations
Alias for RCL-specific instantiation of generic Validations.
std::unordered_map< Key, Value, Hash, Pred, Allocator > hash_map
bool isTesSuccess(TER x) noexcept
std::enable_if_t< std::is_same_v< T, char >||std::is_same_v< T, unsigned char >, Slice > makeSlice(std::array< T, N > const &a)
BaseUInt< 160, detail::NodeIDTag > NodeID
NodeID is a 160-bit hash representing one node.
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< STValidation > createSTVal(std::shared_ptr< Ledger const > const &ledger, NodeID const &v)
Create a validation.
void walkHistoryAndAddValidations(NeedValidation &&needVal)
Walk the ledger history and create validation messages for the ledgers.
RCLValidations & validations
std::shared_ptr< Ledger const > lastLedger() const
std::vector< PublicKey > unlKeys
bool createLedgerHistory()
create ledger history and apply needed ttUNL_MODIFY tx at flag ledgers
std::vector< std::shared_ptr< Ledger > > LedgerHistory
NetworkHistory(beast::unit_test::Suite &suite, Parameter const &p)
hash_set< NodeID > unlNodeIdSet
hash_set< PublicKey > unlKeySet
std::vector< NodeID > unlNodeIDs