hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
iroha::consensus::yac Namespace Reference

Namespaces

 detail
 

Classes

class  BufferedCleanupStrategy
 
class  CleanupStrategy
 
class  ClusterOrdering
 
struct  CommitMessage
 
class  CryptoProviderImpl
 
class  HashGate
 
class  NetworkImpl
 
class  PbConverters
 
class  PeerOrdererImpl
 
struct  RejectMessage
 
class  SupermajorityChecker
 
class  SupermajorityCheckerBft
 An implementation of BFT supermajority checker. More...
 
class  SupermajorityCheckerCft
 An implementation of CFT supermajority checker. More...
 
class  Timer
 
class  TimerImpl
 
struct  VoteMessage
 
class  Yac
 
class  YacBlockStorage
 
class  YacCryptoProvider
 
class  YacGate
 
class  YacGateImpl
 
class  YacHash
 
class  YacHashProvider
 
class  YacHashProviderImpl
 
class  YacInit
 
class  YacNetwork
 
class  YacNetworkNotifications
 
class  YacPeerOrderer
 
class  YacProposalStorage
 
class  YacVoteStorage
 

Typedefs

using Answer = boost::variant< CommitMessage, RejectMessage >
 
using ProposalHash = std::string
 
using BlockHash = std::string
 
using PeersNumberType = size_t
 Type for number of peers in round. More...
 

Enumerations

enum  ConsistencyModel { ConsistencyModel::kBft, ConsistencyModel::kCft }
 
enum  ProposalState { ProposalState::kNotSentNotProcessed, ProposalState::kSentNotProcessed, ProposalState::kSentProcessed }
 

Functions

std::unique_ptr< SupermajorityCheckergetSupermajorityChecker (ConsistencyModel c)
 Get a SupermajorityChecker for the given consistency model. More...
 
bool checkKfPlus1Supermajority (PeersNumberType number, PeersNumberType all, unsigned int k)
 
bool checkKfPlus1Tolerance (PeersNumberType number, PeersNumberType all, unsigned int k)
 
template<typename T >
static std::string cryptoError (const T &votes)
 
template<typename T , typename P >
void removeMatching (std::vector< T > &target, const P &predicate)
 
template<typename CollectionType , typename ElementType >
bool contains (const CollectionType &haystack, const ElementType &needle)
 
bool sameKeys (const std::vector< VoteMessage > &votes)
 
boost::optional< RoundgetKey (const std::vector< VoteMessage > &votes)
 
boost::optional< YacHashgetHash (const std::vector< VoteMessage > &votes)
 

Typedef Documentation

using iroha::consensus::yac::Answer = typedef boost::variant<CommitMessage, RejectMessage>

Contains proof of supermajority for all purposes;

using iroha::consensus::yac::BlockHash = typedef std::string

Type for number of peers in round.

using iroha::consensus::yac::ProposalHash = typedef std::string

Enumeration Type Documentation

Enumerator
kBft 

BFT consistency.

kCft 

CFT consistency.

Proposal outcome states for multicast propagation strategy

Outcome is either CommitMessage, which guarantees that supermajority of votes for the proposal-block hashes is collected, or RejectMessage, which states that supermajority of votes for a block hash cannot be achieved

kNotSentNotProcessed - outcome was not propagated in the network AND it was not passed to pipeline. Initial state after receiving an outcome from storage. Outcome with votes is propagated to the network in this state.

kSentNotProcessed - outcome was propagated in the network AND it was not passed to pipeline. State can be set in two cases:

  1. Outcome is received from the network. Some node has already achieved an outcome and has propagated it to the network, so the first state is skipped.
  2. Outcome was propagated to the network Outcome is passed to pipeline in this state.

kSentProcessed - outcome was propagated in the network AND it was passed to pipeline. Set after passing proposal to pipeline. This state is final. Receiving a network message in this state results in direct propagation of outcome to message sender.

Enumerator
kNotSentNotProcessed 
kSentNotProcessed 
kSentProcessed 

Function Documentation

bool iroha::consensus::yac::checkKfPlus1Supermajority ( PeersNumberType  number,
PeersNumberType  all,
unsigned int  k 
)
inline

A generic implementation of N = K * f + 1 model checkers. N is the amount of peers in the network, f is the number of tolerated faulty peers, and K is a free parameter. Supermajority is achieved when at least N - f peers agree. For the networks of arbitrary peers amount Na the tolerated number of faulty peers is (Na - 1) % K. Check supermajority condition.

Parameters
number- the number of peers agreed on the state
all- the total number of peers in the network
k- the free parameter of the model
Returns
whether supermajority is achieved by the agreed peers

Here is the caller graph for this function:

bool iroha::consensus::yac::checkKfPlus1Tolerance ( PeersNumberType  number,
PeersNumberType  all,
unsigned int  k 
)
inline

Check tolerance condition.

Parameters
number- the number of possibly faulty peers
all- the total number of peers in the network
k- the free parameter of the model
Returns
whether the given number of possibly faulty peers is tolerated by the network.

Here is the caller graph for this function:

template<typename CollectionType , typename ElementType >
bool iroha::consensus::yac::contains ( const CollectionType &  haystack,
const ElementType &  needle 
)

Here is the call graph for this function:

template<typename T >
static std::string iroha::consensus::yac::cryptoError ( const T &  votes)
static

Here is the call graph for this function:

Here is the caller graph for this function:

boost::optional< YacHash > iroha::consensus::yac::getHash ( const std::vector< VoteMessage > &  votes)

Get common hash from collection

Parameters
votes- collection with votes
Returns
hash, if collection elements have same hash, otherwise boost::none

Here is the call graph for this function:

Here is the caller graph for this function:

boost::optional< Round > iroha::consensus::yac::getKey ( const std::vector< VoteMessage > &  votes)

Provide key common for whole collection

Parameters
votes- collection with votes
Returns
vote round, if collection shared the same round, otherwise boost::none

Here is the call graph for this function:

std::unique_ptr< SupermajorityChecker > iroha::consensus::yac::getSupermajorityChecker ( ConsistencyModel  c)

Get a SupermajorityChecker for the given consistency model.

Here is the caller graph for this function:

template<typename T , typename P >
void iroha::consensus::yac::removeMatching ( std::vector< T > &  target,
const P &  predicate 
)

Here is the caller graph for this function:

bool iroha::consensus::yac::sameKeys ( const std::vector< VoteMessage > &  votes)

Check that all votes in collection have the same key

Parameters
votes- collection of votes
Returns
true, if rounds of those votes are the same

Here is the caller graph for this function: