rippled
Namespaces | Classes | Typedefs | Functions
ripple::test::csf Namespace Reference

Namespaces

 detail
 

Classes

struct  AcceptLedger
 Peer accepted consensus results. More...
 
class  BasicNetwork
 Peer to peer network simulator. More...
 
class  BasicSink
 Sink that prepends simulation time to messages. More...
 
struct  CloseLedger
 Peer closed the open ledger. More...
 
struct  CollectByNode
 Maintain an instance of a Collector per peer. More...
 
class  CollectorRef
 Holds a type-erased reference to an arbitray collector. More...
 
class  CollectorRefs
 A container of CollectorRefs. More...
 
class  Collectors
 Group of collectors. More...
 
class  ConstantDistribution
 Constant "distribution" that always returns the same value. More...
 
class  Digraph
 Directed graph. More...
 
struct  FullyValidateLedger
 Peer fully validated a new ledger. More...
 
class  HeartbeatTimer
 Gives heartbeat of simulation to signal simulation progression. More...
 
class  Histogram
 Basic histogram. More...
 
struct  JumpCollector
 Saves information about Jumps for closed and fully validated ledgers. More...
 
class  Ledger
 A ledger is a set of observed transactions and a sequence number identifying the ledger. More...
 
struct  LedgerCollector
 Tracks the accepted -> validated evolution of ledgers. More...
 
struct  LedgerHistoryHelper
 Helper for writing unit tests with controlled ledger histories. More...
 
class  LedgerOracle
 Oracle maintaining unique ledgers for a simulation. More...
 
struct  NullCollector
 Collector which ignores all events. More...
 
struct  Peer
 A single peer in the simulation. More...
 
class  PeerGroup
 A group of simulation Peers. More...
 
class  PowerLawDistribution
 Power-law distribution with PDF. More...
 
struct  Rate
 Represents rate as a count/duration. More...
 
struct  Receive
 A value received from another peer as part of flooding. More...
 
struct  Relay
 A value relayed to another peer as part of flooding. More...
 
class  Scheduler
 Simulated discrete-event scheduler. More...
 
class  Selector
 Invocable that returns random samples from a range according to a discrete distribution. More...
 
struct  Share
 A value to be flooded to all other peers starting from this peer. More...
 
class  Sim
 
struct  SimDurationCollector
 Tracks the overall duration of a simulation. More...
 
struct  StartRound
 Peer starts a new consensus round. More...
 
struct  StreamCollector
 Write out stream of ledger activity. More...
 
class  Submitter
 Submits transactions to a specified peer. More...
 
struct  SubmitTx
 A transaction submitted to a peer. More...
 
class  TrustGraph
 Trust graph. More...
 
class  Tx
 A single transaction. More...
 
struct  TxCollector
 Tracks the submission -> accepted -> validated evolution of transactions. More...
 
class  TxSet
 TxSet is a set of transactions to consider including in the ledger. More...
 
class  Validation
 Validation of a specific ledger by a specific Peer. More...
 
class  Validations_test
 
struct  WrongPrevLedger
 Peer detected a wrong prior ledger during consensus. More...
 

Typedefs

using Proposal = ConsensusProposal< PeerID, Ledger::ID, TxSet::ID >
 Proposal is a position taken in the consensus process and is represented directly from the generic types. More...
 
using RealClock = std::chrono::system_clock
 
using RealDuration = RealClock::duration
 
using RealTime = RealClock::time_point
 
using SimClock = beast::manual_clock< std::chrono::steady_clock >
 
using SimDuration = typename SimClock::duration
 
using SimTime = typename SimClock::time_point
 
using TxSetType = boost::container::flat_set< Tx >
 
using PeerID = tagged_integer< std::uint32_t, PeerIDTag >
 
using PeerKey = std::pair< PeerID, std::uint32_t >
 The current key of a peer. More...
 

Functions

 BEAST_DEFINE_TESTSUITE (Validations, consensus, ripple)
 
template<class... Cs>
Collectors< Cs... > makeCollectors (Cs &... cs)
 Create an instance of Collectors<Cs...> More...
 
Ledger::Seq mismatch (Ledger const &a, Ledger const &b)
 
template<class RandomNumberDistribution , class Generator >
std::vector< PeerGrouprandomRankedGroups (PeerGroup &peers, std::vector< double > const &ranks, int numGroups, RandomNumberDistribution sizeDist, Generator &g)
 Randomly generate peer groups according to ranks. More...
 
template<class RandomNumberDistribution , class Generator >
void randomRankedTrust (PeerGroup &peers, std::vector< double > const &ranks, int numGroups, RandomNumberDistribution sizeDist, Generator &g)
 Generate random trust groups based on peer rankings. More...
 
template<class RandomNumberDistribution , class Generator >
void randomRankedConnect (PeerGroup &peers, std::vector< double > const &ranks, int numGroups, RandomNumberDistribution sizeDist, Generator &g, SimDuration delay)
 Generate random network groups based on peer rankings. More...
 
template<class T , class G >
std::vector< T > random_weighted_shuffle (std::vector< T > v, std::vector< double > w, G &g)
 Return a randomly shuffled copy of vector based on weights w. More...
 
template<class RandomNumberDistribution , class Generator >
std::vector< typename RandomNumberDistribution::result_type > sample (std::size_t size, RandomNumberDistribution dist, Generator &g)
 Generate a vector of random samples. More...
 
template<typename Iter , typename Generator >
Selector< Iter, Generator > makeSelector (Iter first, Iter last, std::vector< double > const &w, Generator &g)
 
template<class Distribution , class Generator , class Selector >
Submitter< Distribution, Generator, SelectormakeSubmitter (Distribution dist, SimTime start, SimTime end, Selector &sel, Scheduler &s, Generator &g)
 
std::ostreamoperator<< (std::ostream &o, const Tx &t)
 
template<class T >
std::ostreamoperator<< (std::ostream &o, boost::container::flat_set< T > const &ts)
 
std::string to_string (TxSetType const &txs)
 
template<class Hasher >
void hash_append (Hasher &h, Tx const &tx)
 

Typedef Documentation

◆ Proposal

Proposal is a position taken in the consensus process and is represented directly from the generic types.

Definition at line 33 of file Proposal.h.

◆ RealClock

Definition at line 30 of file SimTime.h.

◆ RealDuration

using ripple::test::csf::RealDuration = typedef RealClock::duration

Definition at line 31 of file SimTime.h.

◆ RealTime

using ripple::test::csf::RealTime = typedef RealClock::time_point

Definition at line 32 of file SimTime.h.

◆ SimClock

Definition at line 34 of file SimTime.h.

◆ SimDuration

Definition at line 35 of file SimTime.h.

◆ SimTime

Definition at line 36 of file SimTime.h.

◆ TxSetType

using ripple::test::csf::TxSetType = typedef boost::container::flat_set<Tx>

All sets of Tx are represented as a flat_set for performance.

Definition at line 73 of file Tx.h.

◆ PeerID

Definition at line 35 of file Validation.h.

◆ PeerKey

The current key of a peer.

Eventually, the second entry in the pair can be used to model ephemeral keys. Right now, the convention is to have the second entry 0 as the master key.

Definition at line 43 of file Validation.h.

Function Documentation

◆ BEAST_DEFINE_TESTSUITE()

ripple::test::csf::BEAST_DEFINE_TESTSUITE ( Validations  ,
consensus  ,
ripple   
)

◆ makeCollectors()

template<class... Cs>
Collectors<Cs...> ripple::test::csf::makeCollectors ( Cs &...  cs)

Create an instance of Collectors<Cs...>

Definition at line 96 of file collectors.h.

◆ mismatch()

Ledger::Seq ripple::test::csf::mismatch ( Ledger const &  a,
Ledger const &  b 
)

Definition at line 58 of file ledgers.cpp.

◆ randomRankedGroups()

template<class RandomNumberDistribution , class Generator >
std::vector<PeerGroup> ripple::test::csf::randomRankedGroups ( PeerGroup peers,
std::vector< double > const &  ranks,
int  numGroups,
RandomNumberDistribution  sizeDist,
Generator &  g 
)

Randomly generate peer groups according to ranks.

Generates random peer groups based on a provided ranking of peers. This mimics a process of randomly generating UNLs, where more "important" peers are more likely to appear in a UNL.

numGroups subgroups are generated by randomly sampling without without replacement from peers according to the ranks.

Parameters
peersThe group of peers
ranksThe relative importance of each peer, must match the size of peers. Higher relative rank means more likely to be sampled.
numGroupsThe number of peer link groups to generate
sizeDistThe distribution that determines the size of a link group
gThe uniform random bit generator

Definition at line 299 of file PeerGroup.h.

◆ randomRankedTrust()

template<class RandomNumberDistribution , class Generator >
void ripple::test::csf::randomRankedTrust ( PeerGroup peers,
std::vector< double > const &  ranks,
int  numGroups,
RandomNumberDistribution  sizeDist,
Generator &  g 
)

Generate random trust groups based on peer rankings.

See also
randomRankedGroups for descriptions of the arguments

Definition at line 326 of file PeerGroup.h.

◆ randomRankedConnect()

template<class RandomNumberDistribution , class Generator >
void ripple::test::csf::randomRankedConnect ( PeerGroup peers,
std::vector< double > const &  ranks,
int  numGroups,
RandomNumberDistribution  sizeDist,
Generator &  g,
SimDuration  delay 
)

Generate random network groups based on peer rankings.

See also
randomRankedGroups for descriptions of the arguments

Definition at line 350 of file PeerGroup.h.

◆ random_weighted_shuffle()

template<class T , class G >
std::vector<T> ripple::test::csf::random_weighted_shuffle ( std::vector< T >  v,
std::vector< double >  w,
G &  g 
)

Return a randomly shuffled copy of vector based on weights w.

Parameters
vThe set of values
wThe set of weights of each value
gA pseudo-random number generator
Returns
A vector with entries randomly sampled without replacement from the original vector based on the provided weights. I.e. res[0] comes from sample v[i] with weight w[i]/sum_k w[k]

Definition at line 41 of file test/csf/random.h.

◆ sample()

template<class RandomNumberDistribution , class Generator >
std::vector<typename RandomNumberDistribution::result_type> ripple::test::csf::sample ( std::size_t  size,
RandomNumberDistribution  dist,
Generator &  g 
)

Generate a vector of random samples.

Parameters
sizethe size of the sample
distthe distribution to sample
gthe pseudo-random number generator
Returns
vector of samples

Definition at line 66 of file test/csf/random.h.

◆ makeSelector()

template<typename Iter , typename Generator >
Selector<Iter, Generator> ripple::test::csf::makeSelector ( Iter  first,
Iter  last,
std::vector< double > const &  w,
Generator &  g 
)

Definition at line 118 of file test/csf/random.h.

◆ makeSubmitter()

template<class Distribution , class Generator , class Selector >
Submitter<Distribution, Generator, Selector> ripple::test::csf::makeSubmitter ( Distribution  dist,
SimTime  start,
SimTime  end,
Selector sel,
Scheduler s,
Generator &  g 
)

Definition at line 114 of file submitters.h.

◆ operator<<() [1/2]

std::ostream& ripple::test::csf::operator<< ( std::ostream o,
const Tx t 
)

Definition at line 185 of file Tx.h.

◆ operator<<() [2/2]

template<class T >
std::ostream& ripple::test::csf::operator<< ( std::ostream o,
boost::container::flat_set< T > const &  ts 
)

Definition at line 192 of file Tx.h.

◆ to_string()

std::string ripple::test::csf::to_string ( TxSetType const &  txs)

Definition at line 209 of file Tx.h.

◆ hash_append()

template<class Hasher >
void ripple::test::csf::hash_append ( Hasher &  h,
Tx const &  tx 
)

Definition at line 218 of file Tx.h.