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

Namespaces

 ametsuchi
 
 cache
 
 consensus
 
 main
 
 model
 
 network
 
 ordering
 
 protocol
 
 schedulers
 
 set
 
 simulator
 
 synchronizer
 
 time
 
 torii
 
 validation
 

Classes

class  BatchHashEquality
 
class  blob_t
 
struct  combine_latest_until_first_completed
 
class  Completer
 
class  DefaultCompleter
 
struct  delay
 
class  FairMstProcessor
 
class  GossipPropagationStrategy
 
struct  GossipPropagationStrategyParams
 
struct  is_any
 
struct  is_any< T, First >
 
struct  is_any< T, First, Rest... >
 
struct  keypair_t
 
class  KeysManager
 
class  KeysManagerImpl
 
struct  LedgerState
 
class  MstProcessor
 
class  MstState
 
class  MstStorage
 
class  MstStorageStateImpl
 
class  MstTimeProvider
 
class  MstTimeProviderImpl
 
class  PendingTransactionStorage
 
class  PendingTransactionStorageImpl
 
class  PendingTransactionStorageInit
 
class  PropagationStrategy
 
class  PropagationStrategyStub
 
struct  StateUpdateResult
 
struct  timeout
 
struct  TopBlockInfo
 

Typedefs

using OldCommit = rxcpp::observable< model::Block >
 
using PropagationData = PropagationStrategy::PropagationData
 
using OptPeer = GossipPropagationStrategy::OptPeer
 
using PeerProviderFactory = GossipPropagationStrategy::PeerProviderFactory
 
using BatchPtr = std::shared_ptr< shared_model::interface::TransactionBatch >
 
using ConstPeer = const shared_model::interface::Peer
 
using TimeType = shared_model::interface::types::TimestampType
 
using TxResponse = std::shared_ptr< shared_model::interface::TransactionResponse >
 
template<typename T >
using ConstRefT = const T &
 
using ConstRefBatch = ConstRefT< BatchPtr >
 
using ConstRefPeer = ConstRefT< shared_model::interface::Peer >
 
using ConstRefTime = ConstRefT< TimeType >
 
using ConstRefState = ConstRefT< MstState >
 
using DataType = BatchPtr
 
using CompleterType = std::shared_ptr< const Completer >
 
using BadFormatException = std::invalid_argument
 
using byte_t = uint8_t
 
template<size_t size>
using hash_t = blob_t< size >
 
using hash224_t = hash_t< 224/8 >
 
using hash256_t = hash_t< 256/8 >
 
using hash384_t = hash_t< 384/8 >
 
using hash512_t = hash_t< 512/8 >
 
using sig_t = blob_t< 64 >
 
using pubkey_t = blob_t< 32 >
 
using privkey_t = blob_t< 32 >
 
using ts64_t = uint64_t
 
using ts32_t = uint32_t
 

Functions

template<typename T >
hash256_t hash (const T &pb)
 
hash256_t hash (const model::Transaction &tx)
 
hash256_t hash (const model::Block &block)
 
hash256_t hash (const model::Query &query)
 
bool mergeSignaturesInBatch (DataType &target, const DataType &donor)
 
template<typename T , typename Transform >
auto operator| (T &&t, Transform &&f) -> std::enable_if_t< not std::is_same< decltype(std::forward< Transform >(f)(*std::forward< T >(t))), void >::value, decltype(std::forward< Transform >(f)(*std::forward< T >(t)))>
 
std::vector< uint8_t > stringToBytes (const std::string &source)
 
std::string bytesToString (const std::vector< uint8_t > &source)
 
template<size_t size>
boost::optional< blob_t< size > > stringToBlob (const std::string &string)
 
template<size_t size>
boost::optional< blob_t< size > > hexstringToArray (const std::string &string)
 
template<class Coordination , class Selector , class Observable , class... ObservableN, class Enabled = rxcpp::util::enable_if_all_true_type_t< rxcpp::is_coordination<Coordination>, rxcpp::operators::detail:: is_combine_latest_selector<Selector, Observable, ObservableN...>, rxcpp::all_observables<Observable, ObservableN...>>, class ResolvedSelector = rxcpp::util::decay_t<Selector>, class combine_latest = combine_latest_until_first_completed< Coordination, ResolvedSelector, rxcpp::util::decay_t<Observable>, rxcpp::util::decay_t<ObservableN>...>, class Value = rxcpp::util::value_type_t<combine_latest>, class Result = rxcpp::observable<Value, combine_latest>>
static Result makeCombineLatestUntilFirstCompleted (Observable &&o, Coordination &&cn, Selector &&s, ObservableN &&... on)
 
template<typename T , typename Selector , typename Coordination , class ResolvedSelector = rxcpp::util::decay_t<Selector>, class Duration = decltype(std::declval<ResolvedSelector>()( (std::declval<std::decay_t<T>>()))), class Enabled = rxcpp::util::enable_if_all_true_type_t< rxcpp::is_coordination<Coordination>, rxcpp::util::is_duration<Duration>>, class Delay = delay<T, ResolvedSelector, rxcpp::util::decay_t<Coordination>>>
static auto makeDelay (Selector &&s, Coordination &&cn)
 
void remove_dir_contents (const std::string &dir, const logger::LoggerPtr &log)
 
iroha::expected::Result< std::string, std::string > readFile (const std::string &path)
 
std::string bytestringToHexstring (const std::string &str)
 
boost::optional< std::string > hexstringToBytestring (const std::string &str)
 
template<typename C >
auto makeOptionalGet (C map)
 
template<typename T , typename... Args>
auto makeMethodInvoke (T &object, Args &&... args)
 
template<typename V , typename B >
auto assignObjectField (B object, V B::*member)
 
template<template< typename C > class P, typename V , typename B >
auto assignObjectField (P< B > object, V B::*member)
 
template<typename Hasher , typename Collection , typename TargetType = typename Collection::value_type>
auto merge_unique (Collection left, Collection right)
 
template<typename Set , typename Merge >
Set set_union (const Set &left, const Set &right, Merge &&merge)
 
template<typename Set >
Set set_difference (const Set &left, const Set &right)
 
template<typename T , typename Selector , typename Coordination , class ResolvedSelector = rxcpp::util::decay_t<Selector>, class Duration = decltype( std::declval<ResolvedSelector>()((std::declval<std::decay_t<T>>()))), class Enabled = rxcpp::util::enable_if_all_true_type_t< rxcpp::is_coordination<Coordination>, rxcpp::util::is_duration<Duration>>, class Timeout = timeout<T, ResolvedSelector, rxcpp::util::decay_t<Coordination>>>
static auto makeTimeout (Selector &&s, Coordination &&cn)
 
template<typename T >
static std::string encrypt (const T &key, const std::string &pass_phrase)
 
sig_t sign (const uint8_t *msg, size_t msgsize, const pubkey_t &pub, const privkey_t &priv)
 
sig_t sign (const std::string &msg, const pubkey_t &pub, const privkey_t &priv)
 
bool verify (const uint8_t *msg, size_t msgsize, const pubkey_t &pub, const sig_t &sig)
 
bool verify (const std::string &msg, const pubkey_t &pub, const sig_t &sig)
 
blob_t< 32 > create_seed ()
 
blob_t< 32 > create_seed (std::string passphrase)
 
keypair_t create_keypair (blob_t< 32 > seed)
 
keypair_t create_keypair ()
 
void sha3_256 (uint8_t *output, const uint8_t *input, size_t in_size)
 
void sha3_512 (uint8_t *output, const uint8_t *input, size_t in_size)
 
hash256_t sha3_256 (const uint8_t *input, size_t in_size)
 
hash512_t sha3_512 (const uint8_t *input, size_t in_size)
 
hash256_t sha3_256 (const std::string &msg)
 
hash512_t sha3_512 (const std::string &msg)
 
hash512_t sha3_512 (const std::vector< uint8_t > &msg)
 
hash256_t sha3_256 (const std::vector< uint8_t > &msg)
 

Variables

static const model::converters::PbTransactionFactory tx_factory
 
static const model::converters::PbBlockFactory block_factory
 
static const model::converters::PbQueryFactory query_factory (std::make_shared< logger::LoggerSpdlog >("QueryFactory", std::make_shared< logger::LoggerConfig >(logger::LoggerConfig{ logger::kDefaultLogLevel, logger::getDefaultLogPatterns()})))
 
const char * kGitPrettyVersion = GIT_REPO_PRETTY_VER
 A string describing current git repository version in a human-readable way. More...
 
static constexpr auto decrypt = encrypt<Blob::Bytes>
 

Detailed Description

Copyright Soramitsu Co., Ltd. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Copyright Soramitsu Co., Ltd. All Rights Reserved. Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. SPDX-License-Identifier: Apache-2.0

Copyright Soramitsu Co., Ltd. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 This source file contains common methods related to files

Typedef Documentation

◆ BadFormatException

using iroha::BadFormatException = typedef std::invalid_argument

◆ BatchPtr

◆ byte_t

using iroha::byte_t = typedef uint8_t

◆ CompleterType

using iroha::CompleterType = typedef std::shared_ptr<const Completer>

◆ ConstPeer

◆ ConstRefBatch

◆ ConstRefPeer

◆ ConstRefState

◆ ConstRefT

template<typename T >
using iroha::ConstRefT = typedef const T &

◆ ConstRefTime

◆ DataType

using iroha::DataType = typedef BatchPtr

◆ hash224_t

using iroha::hash224_t = typedef hash_t<224 / 8>

◆ hash256_t

using iroha::hash256_t = typedef hash_t<256 / 8>

◆ hash384_t

using iroha::hash384_t = typedef hash_t<384 / 8>

◆ hash512_t

using iroha::hash512_t = typedef hash_t<512 / 8>

◆ hash_t

template<size_t size>
using iroha::hash_t = typedef blob_t<size>

◆ OldCommit

using iroha::OldCommit = typedef rxcpp::observable<model::Block>

◆ OptPeer

◆ PeerProviderFactory

◆ privkey_t

using iroha::privkey_t = typedef blob_t<32>

◆ PropagationData

◆ pubkey_t

using iroha::pubkey_t = typedef blob_t<32>

◆ sig_t

using iroha::sig_t = typedef blob_t<64>

◆ TimeType

◆ ts32_t

using iroha::ts32_t = typedef uint32_t

◆ ts64_t

using iroha::ts64_t = typedef uint64_t

◆ TxResponse

Function Documentation

◆ assignObjectField() [1/2]

template<typename V , typename B >
auto iroha::assignObjectField ( object,
V B::*  member 
)

Assign the value to the object member

Template Parameters
V- object member type
B- object type
Parameters
object- object value for member assignment
member- pointer to member in block
Returns
object with deserialized member on success, nullopt otherwise
Here is the caller graph for this function:

◆ assignObjectField() [2/2]

template<template< typename C > class P, typename V , typename B >
auto iroha::assignObjectField ( P< B >  object,
V B::*  member 
)

Assign the value to the object member. Block is wrapped in monad

Template Parameters
P- monadic type
V- object member type
B- object type
Parameters
object- object value for member assignment
member- pointer to member in object
Returns
object with deserialized member on success, nullopt otherwise

◆ bytesToString()

std::string iroha::bytesToString ( const std::vector< uint8_t > &  source)
inline

blob vector to string

Parameters
source- vector for conversion
Returns
result string
Here is the caller graph for this function:

◆ bytestringToHexstring()

std::string iroha::bytestringToHexstring ( const std::string &  str)
inline

Convert string of raw bytes to printable hex string

Parameters
str- raw bytes string to convert
Returns
- converted hex string
Here is the caller graph for this function:

◆ create_keypair() [1/2]

keypair_t iroha::create_keypair ( blob_t< 32 >  seed)

Create keypair

Create new keypair

Parameters
seed
Returns
Here is the caller graph for this function:

◆ create_keypair() [2/2]

keypair_t iroha::create_keypair ( )

Create new keypair with a default seed (by create_seed())

Returns
Here is the call graph for this function:

◆ create_seed() [1/2]

blob_t< 32 > iroha::create_seed ( )

Generate seed

Generate random seed reading from /dev/urandom

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_seed() [2/2]

blob_t< 32 > iroha::create_seed ( std::string  passphrase)

Generate 32 bytes seed based on a passphrase

Parameters
passphrase
Returns

Generate random seed as sha3_256(passphrase)

Parameters
passphrase
Returns
Here is the call graph for this function:

◆ encrypt()

template<typename T >
static std::string iroha::encrypt ( const T &  key,
const std::string &  pass_phrase 
)
static

Function for the key encryption via XOR

Template Parameters
isa key type
Parameters
privkeyis a private key
pass_phraseis a key for encryption
Returns
encrypted string
Here is the caller graph for this function:

◆ hash() [1/4]

hash256_t iroha::hash ( const model::Transaction tx)
Here is the call graph for this function:

◆ hash() [2/4]

hash256_t iroha::hash ( const model::Block block)
Here is the call graph for this function:

◆ hash() [3/4]

hash256_t iroha::hash ( const model::Query query)
Here is the call graph for this function:

◆ hash() [4/4]

template<typename T >
hash256_t iroha::hash ( const T &  pb)

Calculate hash from protobuf model object

Template Parameters
T- protobuf model type
Parameters
pb- protobuf model object
Returns
hash of object payload
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hexstringToArray()

template<size_t size>
boost::optional<blob_t<size> > iroha::hexstringToArray ( const std::string &  string)

Convert hexstring to array of given size

Template Parameters
size- output array size
Parameters
string- input string for transform
Returns
array of given size if size matches, nullopt otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hexstringToBytestring()

boost::optional<std::string> iroha::hexstringToBytestring ( const std::string &  str)
inline

Convert printable hex string to string of raw bytes

Parameters
str- hex string to convert
Returns
- raw bytes converted string or boost::noneif provided string was not a correct hex string
Here is the caller graph for this function:

◆ makeCombineLatestUntilFirstCompleted()

template<class Coordination , class Selector , class Observable , class... ObservableN, class Enabled = rxcpp::util::enable_if_all_true_type_t< rxcpp::is_coordination<Coordination>, rxcpp::operators::detail:: is_combine_latest_selector<Selector, Observable, ObservableN...>, rxcpp::all_observables<Observable, ObservableN...>>, class ResolvedSelector = rxcpp::util::decay_t<Selector>, class combine_latest = combine_latest_until_first_completed< Coordination, ResolvedSelector, rxcpp::util::decay_t<Observable>, rxcpp::util::decay_t<ObservableN>...>, class Value = rxcpp::util::value_type_t<combine_latest>, class Result = rxcpp::observable<Value, combine_latest>>
static Result iroha::makeCombineLatestUntilFirstCompleted ( Observable &&  o,
Coordination &&  cn,
Selector &&  s,
ObservableN &&...  on 
)
static
Here is the caller graph for this function:

◆ makeDelay()

template<typename T , typename Selector , typename Coordination , class ResolvedSelector = rxcpp::util::decay_t<Selector>, class Duration = decltype(std::declval<ResolvedSelector>()( (std::declval<std::decay_t<T>>()))), class Enabled = rxcpp::util::enable_if_all_true_type_t< rxcpp::is_coordination<Coordination>, rxcpp::util::is_duration<Duration>>, class Delay = delay<T, ResolvedSelector, rxcpp::util::decay_t<Coordination>>>
static auto iroha::makeDelay ( Selector &&  s,
Coordination &&  cn 
)
static

◆ makeMethodInvoke()

template<typename T , typename... Args>
auto iroha::makeMethodInvoke ( T &  object,
Args &&...  args 
)

Return function which invokes class method by pointer to member with provided arguments

class A { int f(int, double); }

A a; int i = makeMethodInvoke(a, 1, 1.0);

Template Parameters
T- provided class type
Args- provided arguments types
Parameters
object- class object
args- function arguments
Returns
described function
Here is the caller graph for this function:

◆ makeOptionalGet()

template<typename C >
auto iroha::makeOptionalGet ( map)

Create map get function for value retrieval by key

Template Parameters
K- map key type
V- map value type
Parameters
map- map for value retrieval
Returns
function which takes key, returns value if key exists, nullopt otherwise
Here is the caller graph for this function:

◆ makeTimeout()

template<typename T , typename Selector , typename Coordination , class ResolvedSelector = rxcpp::util::decay_t<Selector>, class Duration = decltype( std::declval<ResolvedSelector>()((std::declval<std::decay_t<T>>()))), class Enabled = rxcpp::util::enable_if_all_true_type_t< rxcpp::is_coordination<Coordination>, rxcpp::util::is_duration<Duration>>, class Timeout = timeout<T, ResolvedSelector, rxcpp::util::decay_t<Coordination>>>
static auto iroha::makeTimeout ( Selector &&  s,
Coordination &&  cn 
)
static

◆ merge_unique()

template<typename Hasher , typename Collection , typename TargetType = typename Collection::value_type>
auto iroha::merge_unique ( Collection  left,
Collection  right 
)

Merge collections with unique elements

Template Parameters
Collection- type of collection
TargetType- type of elements in collection
Hasher- class for hashing TargetType objects
Parameters
left- first collection
right- second collection
Returns
collection with type Collection, that contain unique union of elements

◆ mergeSignaturesInBatch()

bool iroha::mergeSignaturesInBatch ( DataType target,
const DataType donor 
)

Merge signatures in batches

Parameters
target- batch for inserting
donor- batch with transactions to copy signatures from
Returns
return if at least one new signature was inserted

◆ operator|()

template<typename T , typename Transform >
auto iroha::operator| ( T &&  t,
Transform &&  f 
) -> std::enable_if_t< not std::is_same< decltype(std::forward<Transform>(f)(*std::forward<T>(t))), void>::value, decltype(std::forward<Transform>(f)(*std::forward<T>(t)))>

Bind operator. If argument has value, dereferences argument and calls given function, which should return wrapped value operator| is used since it has to be binary and left-associative Non-void returning specialization

boost::optional<int> f(); boost::optional<double> g(int);

boost::optional<double> d = f() | g;

std::forward should be used in any reference of arguments because operator bool, operator*, and operator() of arguments can have different implementation with ref-qualifiers

Trailing return type checks that result of applying function to unwrapped value results in non-void type

Template Parameters
T- monadic type
Transform- transform function type
Parameters
t- monadic value
f- function, which takes dereferenced value, and returns wrapped value
Returns
monadic value, which can be of another type

Bind operator. If argument has value, dereferences argument and calls given function, which should return wrapped value operator| is used since it has to be binary and left-associative Void specialization

boost::optional<int> f(); void g(int);

f() | g;

std::forward should be used in any reference of arguments because operator bool, operator*, and operator() of arguments can have different implementation with ref-qualifiers

Trailing return type checks that result of applying function to unwrapped value results in void type

Template Parameters
T- monadic type
Transform- transform function type
Parameters
t- monadic value
f- function, which takes dereferenced value, and returns wrapped value

◆ readFile()

iroha::expected::Result< std::string, std::string > iroha::readFile ( const std::string &  path)

Read file, and either return its contents as a string or return the error as a string

Parameters
path- path to the file
Here is the caller graph for this function:

◆ remove_dir_contents()

void iroha::remove_dir_contents ( const std::string &  dir,
const logger::LoggerPtr log 
)

Remove all files and directories inside a folder. Keeps the target folder.

Parameters
dir- target folder
log- a log for local messages
Here is the caller graph for this function:

◆ set_difference()

template<typename Set >
Set iroha::set_difference ( const Set &  left,
const Set &  right 
)

Provide difference operation on set

Template Parameters
Set- type of set
Returns
difference of sets.

◆ set_union()

template<typename Set , typename Merge >
Set iroha::set_union ( const Set &  left,
const Set &  right,
Merge &&  merge 
)

Provide merge of sets based on mering same elements

Template Parameters
Set- type of set
Merge- type of merge predicate
Parameters
left- first set
right- second set
merge- merge predicate
Returns
new set, that contains union of elements, where same elements merged inside

◆ sha3_256() [1/4]

void iroha::sha3_256 ( uint8_t *  output,
const uint8_t *  input,
size_t  in_size 
)
Here is the caller graph for this function:

◆ sha3_256() [2/4]

hash256_t iroha::sha3_256 ( const uint8_t *  input,
size_t  in_size 
)
Here is the call graph for this function:

◆ sha3_256() [3/4]

hash256_t iroha::sha3_256 ( const std::string &  msg)
Here is the call graph for this function:

◆ sha3_256() [4/4]

hash256_t iroha::sha3_256 ( const std::vector< uint8_t > &  msg)
Here is the call graph for this function:

◆ sha3_512() [1/4]

void iroha::sha3_512 ( uint8_t *  output,
const uint8_t *  input,
size_t  in_size 
)
Here is the caller graph for this function:

◆ sha3_512() [2/4]

hash512_t iroha::sha3_512 ( const uint8_t *  input,
size_t  in_size 
)
Here is the call graph for this function:

◆ sha3_512() [3/4]

hash512_t iroha::sha3_512 ( const std::string &  msg)
Here is the call graph for this function:

◆ sha3_512() [4/4]

hash512_t iroha::sha3_512 ( const std::vector< uint8_t > &  msg)
Here is the call graph for this function:

◆ sign() [1/2]

sig_t iroha::sign ( const uint8_t *  msg,
size_t  msgsize,
const pubkey_t pub,
const privkey_t priv 
)

Sign the message

Sign message with ed25519 crypto algorithm

Parameters
msg
msgsize
pub
priv
Returns
Here is the caller graph for this function:

◆ sign() [2/2]

sig_t iroha::sign ( const std::string &  msg,
const pubkey_t pub,
const privkey_t priv 
)
Here is the call graph for this function:

◆ stringToBlob()

template<size_t size>
boost::optional<blob_t<size> > iroha::stringToBlob ( const std::string &  string)

Create blob_t from string of specified size

Template Parameters
size- size of blob_t, expected size of string
Parameters
s- string to convert
Returns
blob, if conversion was successful, otherwise nullopt

◆ stringToBytes()

std::vector<uint8_t> iroha::stringToBytes ( const std::string &  source)
inline

Convert string to blob vector

Parameters
source- string for conversion
Returns
vector<blob>

◆ verify() [1/2]

bool iroha::verify ( const uint8_t *  msg,
size_t  msgsize,
const pubkey_t pub,
const sig_t sig 
)

Verify signature

Verify signature of ed25519 crypto algorithm

Parameters
msg
msgsize
pub
sig
Returns
true if signature is valid, false otherwise
Here is the caller graph for this function:

◆ verify() [2/2]

bool iroha::verify ( const std::string &  msg,
const pubkey_t pub,
const sig_t sig 
)
Here is the call graph for this function:

Variable Documentation

◆ block_factory

const model::converters::PbBlockFactory iroha::block_factory
static

◆ decrypt

constexpr auto iroha::decrypt = encrypt<Blob::Bytes>
static

Function for XOR decryption

◆ kGitPrettyVersion

const char * iroha::kGitPrettyVersion = GIT_REPO_PRETTY_VER

A string describing current git repository version in a human-readable way.

◆ query_factory

const model::converters::PbQueryFactory iroha::query_factory(std::make_shared< logger::LoggerSpdlog >( "QueryFactory", std::make_shared< logger::LoggerConfig >(logger::LoggerConfig{ logger::kDefaultLogLevel, logger::getDefaultLogPatterns()})))
static

◆ tx_factory

const model::converters::PbTransactionFactory iroha::tx_factory
static