TARAXA
DAG

Classes

class  taraxa::Dag
 Thread safe. Labelled graph. More...
 
class  taraxa::PivotTree
 
class  taraxa::vertex_label_writer< Property1 >
 
class  taraxa::edge_label_writer< Property >
 
class  taraxa::DagBlockProposer
 DagBlockProposer class proposes new DAG blocks using transactions retrieved from TransactionManager. More...
 
class  taraxa::DagManager
 DagManager class contains in memory representation of part of the DAG that is not yet finalized in a pbft block and validates DAG blocks. More...
 
struct  taraxa::SortitionParamsChange
 Changing vrf params for DAG blocks generation. More...
 
class  taraxa::SortitionParamsManager
 SortitionParamsManager class calculates DAG efficiency and makes VDF difficulty adjustments. More...
 

Functions

dev::bytes taraxa::encodeDAGBlocksBundleRlp (const std::vector< DagBlock > &blocks)
 Encodes pbft blocks into optimized blocks bundle rlp. More...
 
std::vector< DagBlocktaraxa::decodeDAGBlocksBundleRlp (const dev::RLP &blocks_bundle_rlp)
 Decodes pbft blocks from optimized blocks bundle rlp. More...
 
std::shared_ptr< DagBlocktaraxa::decodeDAGBlockBundleRlp (uint64_t index, const dev::RLP &blocks_bundle_rlp)
 Decodes single dag block from optimized blocks bundle rlp. More...
 

Variables

constexpr static size_t taraxa::kDAGBlocksBundleRlpSize {3}
 

Detailed Description


Class Documentation

◆ taraxa::Dag

class taraxa::Dag

Thread safe. Labelled graph.

Public Types

using vertex_property_t = boost::property< boost::vertex_index_t, blk_hash_t, boost::property< boost::vertex_index1_t, uint64_t > >
 
using edge_property_t = boost::property< boost::edge_index_t, uint64_t >
 
using adj_list_t = boost::adjacency_list< boost::setS, boost::hash_setS, boost::directedS, vertex_property_t, edge_property_t >
 
using graph_t = boost::labeled_graph< adj_list_t, blk_hash_t, boost::hash_mapS >
 
using vertex_t = boost::graph_traits< graph_t >::vertex_descriptor
 
using edge_t = boost::graph_traits< graph_t >::edge_descriptor
 
using vertex_iter_t = boost::graph_traits< graph_t >::vertex_iterator
 
using edge_iter_t = boost::graph_traits< graph_t >::edge_iterator
 
using vertex_adj_iter_t = boost::graph_traits< graph_t >::adjacency_iterator
 
using vertex_index_map_const_t = boost::property_map< graph_t, boost::vertex_index_t >::const_type
 
using vertex_index_map_t = boost::property_map< graph_t, boost::vertex_index_t >::type
 
using vertex_period_map_const_t = boost::property_map< graph_t, boost::vertex_index1_t >::const_type
 
using vertex_period_map_t = boost::property_map< graph_t, boost::vertex_index1_t >::type
 
using edge_index_map_const_t = boost::property_map< graph_t, boost::edge_index_t >::const_type
 
using edge_index_map_t = boost::property_map< graph_t, boost::edge_index_t >::type
 

Public Member Functions

 Dag (blk_hash_t const &dag_genesis_block_hash, addr_t node_addr)
 
virtual ~Dag ()=default
 
 Dag (const Dag &)=default
 
 Dag (Dag &&)=default
 
Dagoperator= (const Dag &)=default
 
Dagoperator= (Dag &&)=default
 
uint64_t getNumVertices () const
 
uint64_t getNumEdges () const
 
bool hasVertex (blk_hash_t const &v) const
 
bool addVEEs (blk_hash_t const &new_vertex, blk_hash_t const &pivot, std::vector< blk_hash_t > const &tips)
 
void getLeaves (std::vector< blk_hash_t > &tips) const
 
void drawGraph (std::string const &filename) const
 
bool computeOrder (const blk_hash_t &anchor, std::vector< blk_hash_t > &ordered_period_vertices, const std::map< uint64_t, std::unordered_set< blk_hash_t >> &non_finalized_blks)
 
void clear ()
 

Public Attributes

friend DagManager
 

Protected Member Functions

bool reachable (vertex_t const &from, vertex_t const &to) const
 
void collectLeafVertices (std::vector< vertex_t > &leaves) const
 

Protected Attributes

graph_t graph_
 

Member Typedef Documentation

◆ adj_list_t

using taraxa::Dag::adj_list_t = boost::adjacency_list<boost::setS, boost::hash_setS, boost::directedS, vertex_property_t, edge_property_t>

◆ edge_index_map_const_t

using taraxa::Dag::edge_index_map_const_t = boost::property_map<graph_t, boost::edge_index_t>::const_type

◆ edge_index_map_t

using taraxa::Dag::edge_index_map_t = boost::property_map<graph_t, boost::edge_index_t>::type

◆ edge_iter_t

using taraxa::Dag::edge_iter_t = boost::graph_traits<graph_t>::edge_iterator

◆ edge_property_t

using taraxa::Dag::edge_property_t = boost::property<boost::edge_index_t, uint64_t>

◆ edge_t

using taraxa::Dag::edge_t = boost::graph_traits<graph_t>::edge_descriptor

◆ graph_t

using taraxa::Dag::graph_t = boost::labeled_graph<adj_list_t, blk_hash_t, boost::hash_mapS>

◆ vertex_adj_iter_t

using taraxa::Dag::vertex_adj_iter_t = boost::graph_traits<graph_t>::adjacency_iterator

◆ vertex_index_map_const_t

using taraxa::Dag::vertex_index_map_const_t = boost::property_map<graph_t, boost::vertex_index_t>::const_type

◆ vertex_index_map_t

using taraxa::Dag::vertex_index_map_t = boost::property_map<graph_t, boost::vertex_index_t>::type

◆ vertex_iter_t

using taraxa::Dag::vertex_iter_t = boost::graph_traits<graph_t>::vertex_iterator

◆ vertex_period_map_const_t

using taraxa::Dag::vertex_period_map_const_t = boost::property_map<graph_t, boost::vertex_index1_t>::const_type

◆ vertex_period_map_t

using taraxa::Dag::vertex_period_map_t = boost::property_map<graph_t, boost::vertex_index1_t>::type

◆ vertex_property_t

using taraxa::Dag::vertex_property_t = boost::property<boost::vertex_index_t, blk_hash_t, boost::property<boost::vertex_index1_t, uint64_t> >

◆ vertex_t

using taraxa::Dag::vertex_t = boost::graph_traits<graph_t>::vertex_descriptor

Constructor & Destructor Documentation

◆ Dag() [1/3]

taraxa::Dag::Dag ( blk_hash_t const &  dag_genesis_block_hash,
addr_t  node_addr 
)
explicit

◆ ~Dag()

virtual taraxa::Dag::~Dag ( )
virtualdefault

◆ Dag() [2/3]

taraxa::Dag::Dag ( const Dag )
default

◆ Dag() [3/3]

taraxa::Dag::Dag ( Dag &&  )
default

Member Function Documentation

◆ addVEEs()

bool taraxa::Dag::addVEEs ( blk_hash_t const &  new_vertex,
blk_hash_t const &  pivot,
std::vector< blk_hash_t > const &  tips 
)

◆ clear()

void taraxa::Dag::clear ( )

◆ collectLeafVertices()

void taraxa::Dag::collectLeafVertices ( std::vector< vertex_t > &  leaves) const
protected

◆ computeOrder()

bool taraxa::Dag::computeOrder ( const blk_hash_t anchor,
std::vector< blk_hash_t > &  ordered_period_vertices,
const std::map< uint64_t, std::unordered_set< blk_hash_t >> &  non_finalized_blks 
)

◆ drawGraph()

void taraxa::Dag::drawGraph ( std::string const &  filename) const

◆ getLeaves()

void taraxa::Dag::getLeaves ( std::vector< blk_hash_t > &  tips) const

◆ getNumEdges()

uint64_t taraxa::Dag::getNumEdges ( ) const

◆ getNumVertices()

uint64_t taraxa::Dag::getNumVertices ( ) const

◆ hasVertex()

bool taraxa::Dag::hasVertex ( blk_hash_t const &  v) const

◆ operator=() [1/2]

Dag& taraxa::Dag::operator= ( const Dag )
default

◆ operator=() [2/2]

Dag& taraxa::Dag::operator= ( Dag &&  )
default

◆ reachable()

bool taraxa::Dag::reachable ( vertex_t const &  from,
vertex_t const &  to 
) const
protected

Member Data Documentation

◆ DagManager

friend taraxa::Dag::DagManager

◆ graph_

graph_t taraxa::Dag::graph_
protected

◆ taraxa::PivotTree

class taraxa::PivotTree

PivotTree is a special DAG, every vertex only has one out-edge, therefore, there is no convergent tree

Collaboration diagram for taraxa::PivotTree:

Public Types

using vertex_adj_iter_t = boost::graph_traits< graph_t >::adjacency_iterator
 
using vertex_index_map_const_t = boost::property_map< graph_t, boost::vertex_index_t >::const_type
 
using vertex_t = boost::graph_traits< graph_t >::vertex_descriptor
 
- Public Types inherited from taraxa::Dag
using vertex_property_t = boost::property< boost::vertex_index_t, blk_hash_t, boost::property< boost::vertex_index1_t, uint64_t > >
 
using edge_property_t = boost::property< boost::edge_index_t, uint64_t >
 
using adj_list_t = boost::adjacency_list< boost::setS, boost::hash_setS, boost::directedS, vertex_property_t, edge_property_t >
 
using graph_t = boost::labeled_graph< adj_list_t, blk_hash_t, boost::hash_mapS >
 
using vertex_t = boost::graph_traits< graph_t >::vertex_descriptor
 
using edge_t = boost::graph_traits< graph_t >::edge_descriptor
 
using vertex_iter_t = boost::graph_traits< graph_t >::vertex_iterator
 
using edge_iter_t = boost::graph_traits< graph_t >::edge_iterator
 
using vertex_adj_iter_t = boost::graph_traits< graph_t >::adjacency_iterator
 
using vertex_index_map_const_t = boost::property_map< graph_t, boost::vertex_index_t >::const_type
 
using vertex_index_map_t = boost::property_map< graph_t, boost::vertex_index_t >::type
 
using vertex_period_map_const_t = boost::property_map< graph_t, boost::vertex_index1_t >::const_type
 
using vertex_period_map_t = boost::property_map< graph_t, boost::vertex_index1_t >::type
 
using edge_index_map_const_t = boost::property_map< graph_t, boost::edge_index_t >::const_type
 
using edge_index_map_t = boost::property_map< graph_t, boost::edge_index_t >::type
 

Public Member Functions

 PivotTree (blk_hash_t const &dag_genesis_block_hash, addr_t node_addr)
 
virtual ~PivotTree ()=default
 
 PivotTree (const PivotTree &)=default
 
 PivotTree (PivotTree &&)=default
 
PivotTreeoperator= (const PivotTree &)=default
 
PivotTreeoperator= (PivotTree &&)=default
 
std::vector< blk_hash_tgetGhostPath (const blk_hash_t &vertex) const
 
- Public Member Functions inherited from taraxa::Dag
 Dag (blk_hash_t const &dag_genesis_block_hash, addr_t node_addr)
 
virtual ~Dag ()=default
 
 Dag (const Dag &)=default
 
 Dag (Dag &&)=default
 
Dagoperator= (const Dag &)=default
 
Dagoperator= (Dag &&)=default
 
uint64_t getNumVertices () const
 
uint64_t getNumEdges () const
 
bool hasVertex (blk_hash_t const &v) const
 
bool addVEEs (blk_hash_t const &new_vertex, blk_hash_t const &pivot, std::vector< blk_hash_t > const &tips)
 
void getLeaves (std::vector< blk_hash_t > &tips) const
 
void drawGraph (std::string const &filename) const
 
bool computeOrder (const blk_hash_t &anchor, std::vector< blk_hash_t > &ordered_period_vertices, const std::map< uint64_t, std::unordered_set< blk_hash_t >> &non_finalized_blks)
 
void clear ()
 

Public Attributes

friend DagManager
 
- Public Attributes inherited from taraxa::Dag
friend DagManager
 

Additional Inherited Members

- Protected Member Functions inherited from taraxa::Dag
bool reachable (vertex_t const &from, vertex_t const &to) const
 
void collectLeafVertices (std::vector< vertex_t > &leaves) const
 
- Protected Attributes inherited from taraxa::Dag
graph_t graph_
 

Member Typedef Documentation

◆ vertex_adj_iter_t

using taraxa::Dag::vertex_adj_iter_t = boost::graph_traits<graph_t>::adjacency_iterator

◆ vertex_index_map_const_t

using taraxa::Dag::vertex_index_map_const_t = boost::property_map<graph_t, boost::vertex_index_t>::const_type

◆ vertex_t

using taraxa::Dag::vertex_t = boost::graph_traits<graph_t>::vertex_descriptor

Constructor & Destructor Documentation

◆ PivotTree() [1/3]

taraxa::PivotTree::PivotTree ( blk_hash_t const &  dag_genesis_block_hash,
addr_t  node_addr 
)
inlineexplicit

◆ ~PivotTree()

virtual taraxa::PivotTree::~PivotTree ( )
virtualdefault

◆ PivotTree() [2/3]

taraxa::PivotTree::PivotTree ( const PivotTree )
default

◆ PivotTree() [3/3]

taraxa::PivotTree::PivotTree ( PivotTree &&  )
default

Member Function Documentation

◆ getGhostPath()

std::vector< blk_hash_t > taraxa::PivotTree::getGhostPath ( const blk_hash_t vertex) const

Iterative version Steps rounds

  1. post order traversal
  2. from leave, count weight and propagate up
  3. collect path

◆ operator=() [1/2]

PivotTree& taraxa::PivotTree::operator= ( const PivotTree )
default

◆ operator=() [2/2]

PivotTree& taraxa::PivotTree::operator= ( PivotTree &&  )
default

Member Data Documentation

◆ DagManager

friend taraxa::PivotTree::DagManager

◆ taraxa::vertex_label_writer

class taraxa::vertex_label_writer

template<class Property1>
class taraxa::vertex_label_writer< Property1 >

Public Member Functions

 vertex_label_writer (Property1 name)
 
template<class Vertex >
void operator() (std::ostream &out, const Vertex &v) const
 

Private Attributes

Property1 name
 

Constructor & Destructor Documentation

◆ vertex_label_writer()

template<class Property1 >
taraxa::vertex_label_writer< Property1 >::vertex_label_writer ( Property1  name)
inline

Member Function Documentation

◆ operator()()

template<class Property1 >
template<class Vertex >
void taraxa::vertex_label_writer< Property1 >::operator() ( std::ostream &  out,
const Vertex &  v 
) const
inline

Member Data Documentation

◆ name

template<class Property1 >
Property1 taraxa::vertex_label_writer< Property1 >::name
private

◆ taraxa::edge_label_writer

class taraxa::edge_label_writer

template<class Property>
class taraxa::edge_label_writer< Property >

Public Member Functions

 edge_label_writer (Property weight)
 
template<class Edge >
void operator() (std::ostream &out, const Edge &e) const
 

Private Attributes

Property weight
 

Constructor & Destructor Documentation

◆ edge_label_writer()

template<class Property >
taraxa::edge_label_writer< Property >::edge_label_writer ( Property  weight)
inlineexplicit

Member Function Documentation

◆ operator()()

template<class Property >
template<class Edge >
void taraxa::edge_label_writer< Property >::operator() ( std::ostream &  out,
const Edge &  e 
) const
inline

Member Data Documentation

◆ weight

template<class Property >
Property taraxa::edge_label_writer< Property >::weight
private

◆ taraxa::DagBlockProposer

class taraxa::DagBlockProposer

DagBlockProposer class proposes new DAG blocks using transactions retrieved from TransactionManager.

Class is running a proposer thread which will try to propose DAG blocks if eligible to propose. Dag block proposal consists of calculating VDF if required. VDF calculation is asynchronous and it is interrupted if another node on the network has produced a valid block at the same level. Proposal includes stale block proposal in case no block is produced on the network for extended period of time.

Collaboration diagram for taraxa::DagBlockProposer:

Public Member Functions

 DagBlockProposer (const FullNodeConfig &config, std::shared_ptr< DagManager > dag_mgr, std::shared_ptr< TransactionManager > trx_mgr, std::shared_ptr< final_chain::FinalChain > final_chain, std::shared_ptr< DbStorage > db, std::shared_ptr< KeyManager > key_manager)
 
 ~DagBlockProposer ()
 
 DagBlockProposer (const DagBlockProposer &)=delete
 
 DagBlockProposer (DagBlockProposer &&)=delete
 
DagBlockProposeroperator= (const DagBlockProposer &)=delete
 
DagBlockProposeroperator= (DagBlockProposer &&)=delete
 
void start ()
 Start the worker thread proposing new DAG blocks. More...
 
void stop ()
 Stop the worker thread. More...
 
bool proposeDagBlock ()
 Tries to propose new dag block. More...
 
void setNetwork (std::weak_ptr< Network > network)
 Sets network. More...
 
uint64_t getProposedBlocksCount () const
 
vec_blk_t selectDagBlockTips (const vec_blk_t &frontier_tips, uint64_t gas_limit) const
 Select tips for DagBlock proposal up to max allowed. More...
 

Private Member Functions

DagBlock createDagBlock (DagFrontier &&frontier, level_t level, const SharedTransactions &trxs, std::vector< uint64_t > &&estimations, VdfSortition &&vdf) const
 Creates a new block with provided data. More...
 
std::pair< SharedTransactions, std::vector< uint64_t > > getShardedTrxs (PbftPeriod proposal_period, uint64_t weight_limit) const
 Gets transactions to include in the block - sharding not supported yet. More...
 
level_t getProposeLevel (blk_hash_t const &pivot, vec_blk_t const &tips) const
 Gets current propose level for provided pivot and tips. More...
 
bool isValidDposProposer (PbftPeriod propose_period) const
 Checks if node is valid proposer for provided level. More...
 

Private Attributes

uint16_t max_num_tries_ {20}
 
uint16_t num_tries_ {0}
 
uint64_t last_propose_level_ {0}
 
util::ThreadPool executor_ {1}
 
std::atomic< uint64_t > proposed_blocks_count_ {0}
 
std::atomic< bool > stopped_ {true}
 
const DagBlockProposerConfig bp_config_
 
const uint16_t total_trx_shards_
 
uint16_t my_trx_shard_
 
std::shared_ptr< DagManagerdag_mgr_
 
std::shared_ptr< TransactionManagertrx_mgr_
 
std::shared_ptr< final_chain::FinalChainfinal_chain_
 
std::shared_ptr< KeyManagerkey_manager_
 
std::shared_ptr< DbStoragedb_
 
std::shared_ptr< std::thread > proposer_worker_
 
std::weak_ptr< Networknetwork_
 
const addr_t node_addr_
 
const secret_t node_sk_
 
const vrf_wrapper::vrf_sk_t vrf_sk_
 
const vrf_wrapper::vrf_pk_t vrf_pk_
 
const uint64_t kPbftGasLimit
 
const uint64_t kDagGasLimit
 
const HardforksConfig kHardforks
 
const uint64_t kValidatorMaxVote
 

Constructor & Destructor Documentation

◆ DagBlockProposer() [1/3]

taraxa::DagBlockProposer::DagBlockProposer ( const FullNodeConfig config,
std::shared_ptr< DagManager dag_mgr,
std::shared_ptr< TransactionManager trx_mgr,
std::shared_ptr< final_chain::FinalChain final_chain,
std::shared_ptr< DbStorage db,
std::shared_ptr< KeyManager key_manager 
)

◆ ~DagBlockProposer()

taraxa::DagBlockProposer::~DagBlockProposer ( )
inline

◆ DagBlockProposer() [2/3]

taraxa::DagBlockProposer::DagBlockProposer ( const DagBlockProposer )
delete

◆ DagBlockProposer() [3/3]

taraxa::DagBlockProposer::DagBlockProposer ( DagBlockProposer &&  )
delete

Member Function Documentation

◆ createDagBlock()

DagBlock taraxa::DagBlockProposer::createDagBlock ( DagFrontier &&  frontier,
level_t  level,
const SharedTransactions trxs,
std::vector< uint64_t > &&  estimations,
VdfSortition &&  vdf 
) const
private

Creates a new block with provided data.

Parameters
frontierfrontier to use for pivot and tips of the new block
levellevel of the new block
trxstransactions to be included in the block
estimationstransactions gas estimation
vdfvdf with correct difficulty calculation

◆ getProposedBlocksCount()

uint64_t taraxa::DagBlockProposer::getProposedBlocksCount ( ) const
inline
Returns
number of proposed dag blocks since the last start

◆ getProposeLevel()

level_t taraxa::DagBlockProposer::getProposeLevel ( blk_hash_t const &  pivot,
vec_blk_t const &  tips 
) const
private

Gets current propose level for provided pivot and tips.

Parameters
pivotpivot block hash
tipstips blocks hashes
Returns
level

◆ getShardedTrxs()

std::pair< SharedTransactions, std::vector< uint64_t > > taraxa::DagBlockProposer::getShardedTrxs ( PbftPeriod  proposal_period,
uint64_t  weight_limit 
) const
private

Gets transactions to include in the block - sharding not supported yet.

Parameters
proposal_periodproposal period
weight_limitweight limit
Returns
transactions and weight estimations

◆ isValidDposProposer()

bool taraxa::DagBlockProposer::isValidDposProposer ( PbftPeriod  propose_period) const
private

Checks if node is valid proposer for provided level.

Parameters
levellevel of the new block
Returns
true if eligible to propose

◆ operator=() [1/2]

DagBlockProposer& taraxa::DagBlockProposer::operator= ( const DagBlockProposer )
delete

◆ operator=() [2/2]

DagBlockProposer& taraxa::DagBlockProposer::operator= ( DagBlockProposer &&  )
delete

◆ proposeDagBlock()

bool taraxa::DagBlockProposer::proposeDagBlock ( )

Tries to propose new dag block.

Returns
true if successfully proposed, otherwise false

◆ selectDagBlockTips()

vec_blk_t taraxa::DagBlockProposer::selectDagBlockTips ( const vec_blk_t frontier_tips,
uint64_t  gas_limit 
) const

Select tips for DagBlock proposal up to max allowed.

Parameters
frontier_tips
gas_limitgas limit for the tips
Returns
tips

◆ setNetwork()

void taraxa::DagBlockProposer::setNetwork ( std::weak_ptr< Network network)

Sets network.

Parameters
network

◆ start()

void taraxa::DagBlockProposer::start ( )

Start the worker thread proposing new DAG blocks.

◆ stop()

void taraxa::DagBlockProposer::stop ( )

Stop the worker thread.

Member Data Documentation

◆ bp_config_

const DagBlockProposerConfig taraxa::DagBlockProposer::bp_config_
private

◆ dag_mgr_

std::shared_ptr<DagManager> taraxa::DagBlockProposer::dag_mgr_
private

◆ db_

std::shared_ptr<DbStorage> taraxa::DagBlockProposer::db_
private

◆ executor_

util::ThreadPool taraxa::DagBlockProposer::executor_ {1}
private

◆ final_chain_

std::shared_ptr<final_chain::FinalChain> taraxa::DagBlockProposer::final_chain_
private

◆ kDagGasLimit

const uint64_t taraxa::DagBlockProposer::kDagGasLimit
private

◆ key_manager_

std::shared_ptr<KeyManager> taraxa::DagBlockProposer::key_manager_
private

◆ kHardforks

const HardforksConfig taraxa::DagBlockProposer::kHardforks
private

◆ kPbftGasLimit

const uint64_t taraxa::DagBlockProposer::kPbftGasLimit
private

◆ kValidatorMaxVote

const uint64_t taraxa::DagBlockProposer::kValidatorMaxVote
private

◆ last_propose_level_

uint64_t taraxa::DagBlockProposer::last_propose_level_ {0}
private

◆ max_num_tries_

uint16_t taraxa::DagBlockProposer::max_num_tries_ {20}
private

◆ my_trx_shard_

uint16_t taraxa::DagBlockProposer::my_trx_shard_
private

◆ network_

std::weak_ptr<Network> taraxa::DagBlockProposer::network_
private

◆ node_addr_

const addr_t taraxa::DagBlockProposer::node_addr_
private

◆ node_sk_

const secret_t taraxa::DagBlockProposer::node_sk_
private

◆ num_tries_

uint16_t taraxa::DagBlockProposer::num_tries_ {0}
private

◆ proposed_blocks_count_

std::atomic<uint64_t> taraxa::DagBlockProposer::proposed_blocks_count_ {0}
private

◆ proposer_worker_

std::shared_ptr<std::thread> taraxa::DagBlockProposer::proposer_worker_
private

◆ stopped_

std::atomic<bool> taraxa::DagBlockProposer::stopped_ {true}
private

◆ total_trx_shards_

const uint16_t taraxa::DagBlockProposer::total_trx_shards_
private

◆ trx_mgr_

std::shared_ptr<TransactionManager> taraxa::DagBlockProposer::trx_mgr_
private

◆ vrf_pk_

const vrf_wrapper::vrf_pk_t taraxa::DagBlockProposer::vrf_pk_
private

◆ vrf_sk_

const vrf_wrapper::vrf_sk_t taraxa::DagBlockProposer::vrf_sk_
private

◆ taraxa::DagManager

class taraxa::DagManager

DagManager class contains in memory representation of part of the DAG that is not yet finalized in a pbft block and validates DAG blocks.

DagManager validates incoming dag blocks and provides ordering of non-finalized DAG block with getDagOrder method. Once a pbft block is finalized setDagBlockOrder is invoked which removes all the finalized DAG blocks from in memory DAG. DagManager class is thread safe in general with exception of function setDagBlockOrder. See details in function descriptions.

Collaboration diagram for taraxa::DagManager:

Public Types

enum class  VerifyBlockReturnType : uint32_t {
  Verified = 0 , MissingTransaction , AheadBlock , FailedVdfVerification ,
  FutureBlock , NotEligible , ExpiredBlock , IncorrectTransactionsEstimation ,
  BlockTooBig , FailedTipsVerification , MissingTip
}
 return type of verifyBlock More...
 

Public Member Functions

 DagManager (const FullNodeConfig &config, addr_t node_addr, std::shared_ptr< TransactionManager > trx_mgr, std::shared_ptr< PbftChain > pbft_chain, std::shared_ptr< final_chain::FinalChain > final_chain, std::shared_ptr< DbStorage > db, std::shared_ptr< KeyManager > key_manager)
 
 DagManager (const DagManager &)=delete
 
 DagManager (DagManager &&)=delete
 
DagManageroperator= (const DagManager &)=delete
 
DagManageroperator= (DagManager &&)=delete
 
std::shared_ptr< DagManagergetShared ()
 
void setNetwork (std::weak_ptr< Network > network)
 
bool isDagBlockKnown (const blk_hash_t &hash) const
 
std::shared_ptr< DagBlockgetDagBlock (const blk_hash_t &hash) const
 Gets dag block from either local memory cache or db. More...
 
std::pair< VerifyBlockReturnType, SharedTransactionsverifyBlock (const DagBlock &blk, const std::unordered_map< trx_hash_t, std::shared_ptr< Transaction >> &trxs={})
 Verifies new DAG block. More...
 
std::pair< bool, std::vector< blk_hash_t > > pivotAndTipsAvailable (DagBlock const &blk)
 Checks if block pivot and tips are in DAG. More...
 
std::pair< bool, std::vector< blk_hash_t > > addDagBlock (DagBlock &&blk, SharedTransactions &&trxs={}, bool proposed=false, bool save=true)
 adds verified DAG block in the DAG More...
 
vec_blk_t getDagBlockOrder (blk_hash_t const &anchor, PbftPeriod period)
 Retrieves DAG block order for specified anchor. Order should always be the same for the same anchor in the same period. More...
 
uint setDagBlockOrder (blk_hash_t const &anchor, PbftPeriod period, vec_blk_t const &dag_order)
 Sets the dag block order on finalizing PBFT block IMPORTANT: This method is invoked on finalizing a pbft block, it needs to be protected with mutex_ but the mutex is locked from pbft manager for the entire pbft finalization to make the finalization atomic. More...
 
std::optional< std::pair< blk_hash_t, std::vector< blk_hash_t > > > getLatestPivotAndTips () const
 
std::vector< blk_hash_tgetGhostPath (const blk_hash_t &source) const
 Retrieves ghost path which is ordered list of non finalized pivot blocks for a specific source block. More...
 
std::vector< blk_hash_tgetGhostPath () const
 Retrieves ghost path which is ordered list of non finalized pivot blocks for last anchor. More...
 
void drawTotalGraph (std::string const &str) const
 
void drawPivotGraph (std::string const &str) const
 
void drawGraph (std::string const &dotfile) const
 
std::pair< uint64_t, uint64_t > getNumVerticesInDag () const
 
std::pair< uint64_t, uint64_t > getNumEdgesInDag () const
 
level_t getMaxLevel () const
 
PbftPeriod getLatestPeriod () const
 
std::pair< blk_hash_t, blk_hash_tgetAnchors () const
 
uint32_t getDagExpiryLimit () const
 Retrieves Dag expiry limit. More...
 
const std::pair< PbftPeriod, std::map< uint64_t, std::unordered_set< blk_hash_t > > > getNonFinalizedBlocks () const
 
const std::tuple< PbftPeriod, std::vector< std::shared_ptr< DagBlock > >, SharedTransactionsgetNonFinalizedBlocksWithTransactions (const std::unordered_set< blk_hash_t > &known_hashes) const
 Retrieves current period together with non finalized blocks with the unique list of non finalized transactions from these blocks. More...
 
DagFrontier getDagFrontier ()
 
std::pair< size_t, size_t > getNonFinalizedBlocksSize () const
 
std::shared_mutex & getDagMutex ()
 Retrieves Dag Manager mutex, only to be used when finalizing pbft block. More...
 
SortitionParamsManagersortitionParamsManager ()
 Retrieves sortition manager. More...
 
const DagConfiggetDagConfig () const
 Retrieves Dag config. More...
 
uint64_t getDagExpiryLevel ()
 Retrieves Dag expiry level. More...
 
void clearLightNodeHistory (uint64_t light_node_history)
 Clears light node history. More...
 

Static Public Member Functions

static dev::bytes getVdfMessage (blk_hash_t const &hash, SharedTransactions const &trxs)
 Retrieves VDF message from block hash and transactions. More...
 
static dev::bytes getVdfMessage (blk_hash_t const &hash, std::vector< trx_hash_t > const &trx_hashes)
 Retrieves VDF message from block hash and transactions. More...
 

Public Attributes

util::Event< DagManager, DagBlock > const block_verified_ {}
 

Private Member Functions

void recoverDag ()
 
void addToDag (blk_hash_t const &hash, blk_hash_t const &pivot, std::vector< blk_hash_t > const &tips, uint64_t level, bool finalized=false)
 
bool validateBlockNotExpired (const std::shared_ptr< DagBlock > &dag_block, std::unordered_map< blk_hash_t, std::shared_ptr< DagBlock >> &expired_dag_blocks_to_remove)
 
void handleExpiredDagBlocksTransactions (const std::vector< trx_hash_t > &transactions_from_expired_dag_blocks) const
 
std::pair< blk_hash_t, std::vector< blk_hash_t > > getFrontier () const
 
void updateFrontier ()
 

Private Attributes

std::atomic< level_tmax_level_ = 0
 
std::shared_mutex mutex_
 
std::shared_mutex order_dag_blocks_mutex_
 
std::shared_ptr< PivotTreepivot_tree_
 
std::shared_ptr< Dagtotal_dag_
 
std::shared_ptr< TransactionManagertrx_mgr_
 
std::shared_ptr< PbftChainpbft_chain_
 
std::weak_ptr< Networknetwork_
 
std::shared_ptr< DbStoragedb_
 
std::shared_ptr< KeyManagerkey_manager_
 
blk_hash_t anchor_
 
blk_hash_t old_anchor_
 
PbftPeriod period_
 
std::map< uint64_t, std::unordered_set< blk_hash_t > > non_finalized_blks_
 
DagFrontier frontier_
 
SortitionParamsManager sortition_params_manager_
 
const DagConfigdag_config_
 
const std::shared_ptr< DagBlockgenesis_block_
 
const uint32_t max_levels_per_period_
 
const uint32_t dag_expiry_limit_
 
std::atomic_uint64_t dag_expiry_level_
 
const uint32_t cache_max_size_ = 10000
 
const uint32_t cache_delete_step_ = 100
 
ExpirationCacheMap< blk_hash_t, DagBlockseen_blocks_
 
std::shared_ptr< final_chain::FinalChainfinal_chain_
 
const uint64_t kPbftGasLimit
 
const HardforksConfig kHardforks
 
const uint64_t kValidatorMaxVote
 

Member Enumeration Documentation

◆ VerifyBlockReturnType

return type of verifyBlock

Enumerator
Verified 
MissingTransaction 
AheadBlock 
FailedVdfVerification 
FutureBlock 
NotEligible 
ExpiredBlock 
IncorrectTransactionsEstimation 
BlockTooBig 
FailedTipsVerification 
MissingTip 

Constructor & Destructor Documentation

◆ DagManager() [1/3]

taraxa::DagManager::DagManager ( const FullNodeConfig config,
addr_t  node_addr,
std::shared_ptr< TransactionManager trx_mgr,
std::shared_ptr< PbftChain pbft_chain,
std::shared_ptr< final_chain::FinalChain final_chain,
std::shared_ptr< DbStorage db,
std::shared_ptr< KeyManager key_manager 
)
explicit

◆ DagManager() [2/3]

taraxa::DagManager::DagManager ( const DagManager )
delete

◆ DagManager() [3/3]

taraxa::DagManager::DagManager ( DagManager &&  )
delete

Member Function Documentation

◆ addDagBlock()

std::pair< bool, std::vector< blk_hash_t > > taraxa::DagManager::addDagBlock ( DagBlock &&  blk,
SharedTransactions &&  trxs = {},
bool  proposed = false,
bool  save = true 
)

adds verified DAG block in the DAG

Parameters
trxsBlock transactions
proposedif this node proposed the block
saveif true save block and transactions to database
Returns
true if block added successfully, false with the hash of missing tips/pivot

◆ addToDag()

void taraxa::DagManager::addToDag ( blk_hash_t const &  hash,
blk_hash_t const &  pivot,
std::vector< blk_hash_t > const &  tips,
uint64_t  level,
bool  finalized = false 
)
private

◆ clearLightNodeHistory()

void taraxa::DagManager::clearLightNodeHistory ( uint64_t  light_node_history)

Clears light node history.

◆ drawGraph()

void taraxa::DagManager::drawGraph ( std::string const &  dotfile) const

◆ drawPivotGraph()

void taraxa::DagManager::drawPivotGraph ( std::string const &  str) const

◆ drawTotalGraph()

void taraxa::DagManager::drawTotalGraph ( std::string const &  str) const

◆ getAnchors()

std::pair<blk_hash_t, blk_hash_t> taraxa::DagManager::getAnchors ( ) const
inline

◆ getDagBlock()

std::shared_ptr< DagBlock > taraxa::DagManager::getDagBlock ( const blk_hash_t hash) const

Gets dag block from either local memory cache or db.

Parameters
hashBlock hash
Returns
Block or nullptr if block is not found

◆ getDagBlockOrder()

std::vector< blk_hash_t > taraxa::DagManager::getDagBlockOrder ( blk_hash_t const &  anchor,
PbftPeriod  period 
)

Retrieves DAG block order for specified anchor. Order should always be the same for the same anchor in the same period.

Parameters
anchoranchor block
periodperiod
Returns
ordered blocks

◆ getDagConfig()

const DagConfig& taraxa::DagManager::getDagConfig ( ) const
inline

Retrieves Dag config.

Returns
dag config

◆ getDagExpiryLevel()

uint64_t taraxa::DagManager::getDagExpiryLevel ( )
inline

Retrieves Dag expiry level.

Returns
level

◆ getDagExpiryLimit()

uint32_t taraxa::DagManager::getDagExpiryLimit ( ) const
inline

Retrieves Dag expiry limit.

Returns
limit

◆ getDagFrontier()

DagFrontier taraxa::DagManager::getDagFrontier ( )

◆ getDagMutex()

std::shared_mutex& taraxa::DagManager::getDagMutex ( )
inline

Retrieves Dag Manager mutex, only to be used when finalizing pbft block.

Returns
mutex

◆ getFrontier()

std::pair< blk_hash_t, std::vector< blk_hash_t > > taraxa::DagManager::getFrontier ( ) const
private

◆ getGhostPath() [1/2]

std::vector< blk_hash_t > taraxa::DagManager::getGhostPath ( ) const

Retrieves ghost path which is ordered list of non finalized pivot blocks for last anchor.

Returns
returned ordered blocks

◆ getGhostPath() [2/2]

std::vector< blk_hash_t > taraxa::DagManager::getGhostPath ( const blk_hash_t source) const

Retrieves ghost path which is ordered list of non finalized pivot blocks for a specific source block.

Parameters
sourcesource block
Returns
returned ordered blocks

◆ getLatestPeriod()

PbftPeriod taraxa::DagManager::getLatestPeriod ( ) const
inline

◆ getLatestPivotAndTips()

std::optional< std::pair< blk_hash_t, std::vector< blk_hash_t > > > taraxa::DagManager::getLatestPivotAndTips ( ) const

◆ getMaxLevel()

level_t taraxa::DagManager::getMaxLevel ( ) const
inline

◆ getNonFinalizedBlocks()

const std::pair< PbftPeriod, std::map< uint64_t, std::unordered_set< blk_hash_t > > > taraxa::DagManager::getNonFinalizedBlocks ( ) const

◆ getNonFinalizedBlocksSize()

std::pair< size_t, size_t > taraxa::DagManager::getNonFinalizedBlocksSize ( ) const
Returns
std::pair<size_t, size_t> -> first = number of levels, second = number of blocks

◆ getNonFinalizedBlocksWithTransactions()

const std::tuple< PbftPeriod, std::vector< std::shared_ptr< DagBlock > >, SharedTransactions > taraxa::DagManager::getNonFinalizedBlocksWithTransactions ( const std::unordered_set< blk_hash_t > &  known_hashes) const

Retrieves current period together with non finalized blocks with the unique list of non finalized transactions from these blocks.

Parameters
known_hashesexcludes known hashes from result
Returns
Period, blocks and transactions

◆ getNumEdgesInDag()

std::pair< uint64_t, uint64_t > taraxa::DagManager::getNumEdgesInDag ( ) const

◆ getNumVerticesInDag()

std::pair< uint64_t, uint64_t > taraxa::DagManager::getNumVerticesInDag ( ) const

◆ getShared()

std::shared_ptr< DagManager > taraxa::DagManager::getShared ( )

◆ getVdfMessage() [1/2]

dev::bytes taraxa::DagManager::getVdfMessage ( blk_hash_t const &  hash,
SharedTransactions const &  trxs 
)
static

Retrieves VDF message from block hash and transactions.

Returns
message

◆ getVdfMessage() [2/2]

dev::bytes taraxa::DagManager::getVdfMessage ( blk_hash_t const &  hash,
std::vector< trx_hash_t > const &  trx_hashes 
)
static

Retrieves VDF message from block hash and transactions.

Returns
message

◆ handleExpiredDagBlocksTransactions()

void taraxa::DagManager::handleExpiredDagBlocksTransactions ( const std::vector< trx_hash_t > &  transactions_from_expired_dag_blocks) const
private

◆ isDagBlockKnown()

bool taraxa::DagManager::isDagBlockKnown ( const blk_hash_t hash) const
Parameters
hash
Returns
true in case block was already seen or is part of dag structure

◆ operator=() [1/2]

DagManager& taraxa::DagManager::operator= ( const DagManager )
delete

◆ operator=() [2/2]

DagManager& taraxa::DagManager::operator= ( DagManager &&  )
delete

◆ pivotAndTipsAvailable()

std::pair< bool, std::vector< blk_hash_t > > taraxa::DagManager::pivotAndTipsAvailable ( DagBlock const &  blk)

Checks if block pivot and tips are in DAG.

Parameters
blkBlock to check
Returns
true if all pivot and tips are in the DAG, false if some is missing with the hash of missing tips/pivot

◆ recoverDag()

void taraxa::DagManager::recoverDag ( )
private

◆ setDagBlockOrder()

uint taraxa::DagManager::setDagBlockOrder ( blk_hash_t const &  anchor,
PbftPeriod  period,
vec_blk_t const &  dag_order 
)

Sets the dag block order on finalizing PBFT block IMPORTANT: This method is invoked on finalizing a pbft block, it needs to be protected with mutex_ but the mutex is locked from pbft manager for the entire pbft finalization to make the finalization atomic.

Parameters
anchorAnchor of the finalized pbft block
periodPeriod finalized
dag_orderDag order of the finalized pbft block
Returns
number of dag blocks finalized

◆ setNetwork()

void taraxa::DagManager::setNetwork ( std::weak_ptr< Network network)
inline

◆ sortitionParamsManager()

SortitionParamsManager& taraxa::DagManager::sortitionParamsManager ( )
inline

Retrieves sortition manager.

Returns
sortition manager

◆ updateFrontier()

void taraxa::DagManager::updateFrontier ( )
private

◆ validateBlockNotExpired()

bool taraxa::DagManager::validateBlockNotExpired ( const std::shared_ptr< DagBlock > &  dag_block,
std::unordered_map< blk_hash_t, std::shared_ptr< DagBlock >> &  expired_dag_blocks_to_remove 
)
private

◆ verifyBlock()

std::pair< DagManager::VerifyBlockReturnType, SharedTransactions > taraxa::DagManager::verifyBlock ( const DagBlock blk,
const std::unordered_map< trx_hash_t, std::shared_ptr< Transaction >> &  trxs = {} 
)

Verifies new DAG block.

Parameters
blkBlock to verify
transactionsOptional block transactions
Returns
verification result and all the transactions which are part of the block

Member Data Documentation

◆ anchor_

blk_hash_t taraxa::DagManager::anchor_
private

◆ block_verified_

util::Event<DagManager, DagBlock> const taraxa::DagManager::block_verified_ {}

◆ cache_delete_step_

const uint32_t taraxa::DagManager::cache_delete_step_ = 100
private

◆ cache_max_size_

const uint32_t taraxa::DagManager::cache_max_size_ = 10000
private

◆ dag_config_

const DagConfig& taraxa::DagManager::dag_config_
private

◆ dag_expiry_level_

std::atomic_uint64_t taraxa::DagManager::dag_expiry_level_
private
Initial value:
=
0

◆ dag_expiry_limit_

const uint32_t taraxa::DagManager::dag_expiry_limit_
private

◆ db_

std::shared_ptr<DbStorage> taraxa::DagManager::db_
private

◆ final_chain_

std::shared_ptr<final_chain::FinalChain> taraxa::DagManager::final_chain_
private

◆ frontier_

DagFrontier taraxa::DagManager::frontier_
private

◆ genesis_block_

const std::shared_ptr<DagBlock> taraxa::DagManager::genesis_block_
private

◆ key_manager_

std::shared_ptr<KeyManager> taraxa::DagManager::key_manager_
private

◆ kHardforks

const HardforksConfig taraxa::DagManager::kHardforks
private

◆ kPbftGasLimit

const uint64_t taraxa::DagManager::kPbftGasLimit
private

◆ kValidatorMaxVote

const uint64_t taraxa::DagManager::kValidatorMaxVote
private

◆ max_level_

std::atomic<level_t> taraxa::DagManager::max_level_ = 0
private

◆ max_levels_per_period_

const uint32_t taraxa::DagManager::max_levels_per_period_
private

◆ mutex_

std::shared_mutex taraxa::DagManager::mutex_
mutableprivate

◆ network_

std::weak_ptr<Network> taraxa::DagManager::network_
private

◆ non_finalized_blks_

std::map<uint64_t, std::unordered_set<blk_hash_t> > taraxa::DagManager::non_finalized_blks_
private

◆ old_anchor_

blk_hash_t taraxa::DagManager::old_anchor_
private

◆ order_dag_blocks_mutex_

std::shared_mutex taraxa::DagManager::order_dag_blocks_mutex_
mutableprivate

◆ pbft_chain_

std::shared_ptr<PbftChain> taraxa::DagManager::pbft_chain_
private

◆ period_

PbftPeriod taraxa::DagManager::period_
private

◆ pivot_tree_

std::shared_ptr<PivotTree> taraxa::DagManager::pivot_tree_
private

◆ seen_blocks_

ExpirationCacheMap<blk_hash_t, DagBlock> taraxa::DagManager::seen_blocks_
private

◆ sortition_params_manager_

SortitionParamsManager taraxa::DagManager::sortition_params_manager_
private

◆ total_dag_

std::shared_ptr<Dag> taraxa::DagManager::total_dag_
private

◆ trx_mgr_

std::shared_ptr<TransactionManager> taraxa::DagManager::trx_mgr_
private

◆ taraxa::SortitionParamsChange

struct taraxa::SortitionParamsChange

Changing vrf params for DAG blocks generation.

Collaboration diagram for taraxa::SortitionParamsChange:

Public Member Functions

 SortitionParamsChange ()=default
 
 SortitionParamsChange (PbftPeriod period, uint16_t efficiency, const VrfParams &vrf)
 
bytes rlp () const
 

Static Public Member Functions

static SortitionParamsChange from_rlp (const dev::RLP &rlp)
 

Public Attributes

PbftPeriod period = 0
 
VrfParams vrf_params
 
uint16_t interval_efficiency = 0
 

Constructor & Destructor Documentation

◆ SortitionParamsChange() [1/2]

taraxa::SortitionParamsChange::SortitionParamsChange ( )
default

◆ SortitionParamsChange() [2/2]

taraxa::SortitionParamsChange::SortitionParamsChange ( PbftPeriod  period,
uint16_t  efficiency,
const VrfParams vrf 
)

Member Function Documentation

◆ from_rlp()

SortitionParamsChange taraxa::SortitionParamsChange::from_rlp ( const dev::RLP rlp)
static

◆ rlp()

bytes taraxa::SortitionParamsChange::rlp ( ) const

Member Data Documentation

◆ interval_efficiency

uint16_t taraxa::SortitionParamsChange::interval_efficiency = 0

◆ period

PbftPeriod taraxa::SortitionParamsChange::period = 0

◆ vrf_params

VrfParams taraxa::SortitionParamsChange::vrf_params

◆ taraxa::SortitionParamsManager

class taraxa::SortitionParamsManager

SortitionParamsManager class calculates DAG efficiency and makes VDF difficulty adjustments.

On each new pbft block that is finalized DAG efficiency calculation is performed with calculateDagEfficiency. On config specified intervals a difficulty adjustment is performed using getNewUpperRange to keep the efficiency in the desired range.

Collaboration diagram for taraxa::SortitionParamsManager:

Public Member Functions

 SortitionParamsManager (const addr_t &node_addr, SortitionConfig sort_conf, std::shared_ptr< DbStorage > db)
 
SortitionParams getSortitionParams (std::optional< PbftPeriod > for_period={}) const
 
uint16_t calculateDagEfficiency (const PeriodData &block) const
 
void pbftBlockPushed (const PeriodData &block, Batch &batch, PbftPeriod non_empty_pbft_chain_size)
 
uint16_t averageDagEfficiency ()
 
const std::deque< SortitionParamsChange > & getParamsChanges () const
 

Protected Member Functions

SortitionParamsChange calculateChange (PbftPeriod period)
 
EfficienciesMap getEfficienciesToUpperRange (uint16_t efficiency, int32_t threshold) const
 
int32_t getNewUpperRange (uint16_t efficiency) const
 
void cleanup ()
 

Protected Attributes

SortitionConfig config_
 
std::shared_ptr< DbStoragedb_
 
std::deque< uint16_t > dag_efficiencies_
 
uint32_t ignored_efficiency_counter_ = 0
 
std::deque< SortitionParamsChangeparams_changes_
 

Constructor & Destructor Documentation

◆ SortitionParamsManager()

taraxa::SortitionParamsManager::SortitionParamsManager ( const addr_t node_addr,
SortitionConfig  sort_conf,
std::shared_ptr< DbStorage db 
)

Member Function Documentation

◆ averageDagEfficiency()

uint16_t taraxa::SortitionParamsManager::averageDagEfficiency ( )

Calculate average DAG efficiency from dag_efficiencies_. Used at the end of interval.

Returns
average DAG efficiency in current interval

◆ calculateChange()

SortitionParamsChange taraxa::SortitionParamsManager::calculateChange ( PbftPeriod  period)
protected

◆ calculateDagEfficiency()

uint16_t taraxa::SortitionParamsManager::calculateDagEfficiency ( const PeriodData block) const

Calculating DAG efficiency in passed PeriodData(PBFT) DAG efficiency is count of unique transactions over all DAG blocks in a PBFT block divided by the count over all DAG blocks in a PBFT block.

Parameters
blockPeriodData to calculate its efficiency
Returns
DAG efficiency

◆ cleanup()

void taraxa::SortitionParamsManager::cleanup ( )
protected

◆ getEfficienciesToUpperRange()

EfficienciesMap taraxa::SortitionParamsManager::getEfficienciesToUpperRange ( uint16_t  efficiency,
int32_t  threshold 
) const
protected

◆ getNewUpperRange()

int32_t taraxa::SortitionParamsManager::getNewUpperRange ( uint16_t  efficiency) const
protected

◆ getParamsChanges()

const std::deque<SortitionParamsChange>& taraxa::SortitionParamsManager::getParamsChanges ( ) const
inline

Get memory params changes, used only for unit tests

Returns
params changes

◆ getSortitionParams()

SortitionParams taraxa::SortitionParamsManager::getSortitionParams ( std::optional< PbftPeriod for_period = {}) const

◆ pbftBlockPushed()

void taraxa::SortitionParamsManager::pbftBlockPushed ( const PeriodData block,
Batch batch,
PbftPeriod  non_empty_pbft_chain_size 
)

Called from PbftManager.pushPbftBlock_() Calculates and stores needed data on every block. Every computation_interval blocks from config launches recalculate based on previous data

Parameters
blockPeriodData to process
batchDB batch in which all changes will be added
non_empty_pbft_chain_sizePBFT chain size excluding pbft blocks with null anchor

Member Data Documentation

◆ config_

SortitionConfig taraxa::SortitionParamsManager::config_
protected

◆ dag_efficiencies_

std::deque<uint16_t> taraxa::SortitionParamsManager::dag_efficiencies_
protected

◆ db_

std::shared_ptr<DbStorage> taraxa::SortitionParamsManager::db_
protected

◆ ignored_efficiency_counter_

uint32_t taraxa::SortitionParamsManager::ignored_efficiency_counter_ = 0
protected

◆ params_changes_

std::deque<SortitionParamsChange> taraxa::SortitionParamsManager::params_changes_
protected

Function Documentation

◆ decodeDAGBlockBundleRlp()

std::shared_ptr< DagBlock > taraxa::decodeDAGBlockBundleRlp ( uint64_t  index,
const dev::RLP blocks_bundle_rlp 
)

Decodes single dag block from optimized blocks bundle rlp.

Parameters
blocks_bundle_rlp
Returns
block

◆ decodeDAGBlocksBundleRlp()

std::vector< DagBlock > taraxa::decodeDAGBlocksBundleRlp ( const dev::RLP blocks_bundle_rlp)

Decodes pbft blocks from optimized blocks bundle rlp.

Parameters
blocks_bundle_rlp
Returns
blocks

◆ encodeDAGBlocksBundleRlp()

dev::bytes taraxa::encodeDAGBlocksBundleRlp ( const std::vector< DagBlock > &  blocks)

Encodes pbft blocks into optimized blocks bundle rlp.

Parameters
blocks
Returns
blocks bundle rlp bytes

Variable Documentation

◆ kDAGBlocksBundleRlpSize

constexpr static size_t taraxa::kDAGBlocksBundleRlpSize {3}
staticconstexpr