TARAXA
taraxa::DagBlock Class Reference

DagBlock class is a DAG block class which main data is a list of transaction hashes included in the block and hashes of pivot and tips blocks it points to. More...

#include <dag_block.hpp>

Collaboration diagram for taraxa::DagBlock:

Public Member Functions

 DagBlock ()=default
 
 DagBlock (blk_hash_t pivot, level_t level, vec_blk_t tips, vec_trx_t trxs, uint64_t est, sig_t signature, blk_hash_t hash, addr_t sender)
 
 DagBlock (blk_hash_t pivot, level_t level, vec_blk_t tips, vec_trx_t trxs, sig_t signature, blk_hash_t hash, addr_t sender)
 
 DagBlock (blk_hash_t const &pivot, level_t level, vec_blk_t tips, vec_trx_t trxs, secret_t const &sk)
 
 DagBlock (blk_hash_t const &pivot, level_t level, vec_blk_t tips, vec_trx_t trxs, uint64_t est, VdfSortition vdf, secret_t const &sk)
 
 DagBlock (Json::Value const &doc)
 
 DagBlock (string const &json)
 
 DagBlock (dev::RLP const &_rlp)
 
 DagBlock (dev::RLP const &_rlp, vec_trx_t &&trxs)
 
 DagBlock (dev::bytes const &_rlp)
 
bool operator== (DagBlock const &other) const
 
auto const & getPivot () const
 
auto getLevel () const
 
auto getTimestamp () const
 
auto const & getTips () const
 
auto const & getTrxs () const
 
auto const & getGasEstimation () const
 
auto const & getSig () const
 
blk_hash_t const & getHash () const
 
uint16_t getDifficulty () const
 
addr_t const & getSender () const
 
Json::Value getJson (bool with_derived_fields=true) const
 
std::string getJsonStr () const
 
bool verifySig () const
 
void verifyVdf (const SortitionParams &vdf_config, const h256 &proposal_period_hash, const vrf_wrapper::vrf_pk_t &pk, uint64_t vote_count, uint64_t total_vote_count) const
 
bytes rlp (bool include_sig, bool include_trxs=true) const
 
dev::RLPStream streamRLP (bool include_sig, bool include_trxs=true) const
 Returns dag block data rlp stream. More...
 

Static Public Member Functions

static level_t extract_dag_level_from_rlp (const dev::RLP &rlp)
 Extracts dag level from rlp representation. More...
 
static sig_t extract_signature_from_rlp (const dev::RLP &rlp)
 Extracts signature from rlp representation. More...
 

Private Member Functions

blk_hash_t sha3 (bool include_sig) const
 

Private Attributes

blk_hash_t pivot_
 
level_t level_ = 0
 
vec_blk_t tips_
 
vec_trx_t trxs_
 
uint64_t gas_estimation_
 
sig_t sig_
 
u256 block_weight_
 
blk_hash_t hash_
 
util::DefaultConstructCopyableMovable< std::mutex > hash_mu_
 
uint64_t timestamp_ = 0
 
vdf_sortition::VdfSortition vdf_
 
addr_t cached_sender_
 
util::DefaultConstructCopyableMovable< std::mutex > cached_sender_mu_
 

Static Private Attributes

static const size_t kLevelPosInRlp {1}
 
static const size_t kSigPosInRlp {6}
 

Friends

std::ostream & operator<< (std::ostream &str, DagBlock const &u)
 

Detailed Description

DagBlock class is a DAG block class which main data is a list of transaction hashes included in the block and hashes of pivot and tips blocks it points to.

Constructor & Destructor Documentation

◆ DagBlock() [1/10]

taraxa::DagBlock::DagBlock ( )
default

◆ DagBlock() [2/10]

taraxa::DagBlock::DagBlock ( blk_hash_t  pivot,
level_t  level,
vec_blk_t  tips,
vec_trx_t  trxs,
uint64_t  est,
sig_t  signature,
blk_hash_t  hash,
addr_t  sender 
)

◆ DagBlock() [3/10]

taraxa::DagBlock::DagBlock ( blk_hash_t  pivot,
level_t  level,
vec_blk_t  tips,
vec_trx_t  trxs,
sig_t  signature,
blk_hash_t  hash,
addr_t  sender 
)

◆ DagBlock() [4/10]

taraxa::DagBlock::DagBlock ( blk_hash_t const &  pivot,
level_t  level,
vec_blk_t  tips,
vec_trx_t  trxs,
secret_t const &  sk 
)

◆ DagBlock() [5/10]

taraxa::DagBlock::DagBlock ( blk_hash_t const &  pivot,
level_t  level,
vec_blk_t  tips,
vec_trx_t  trxs,
uint64_t  est,
VdfSortition  vdf,
secret_t const &  sk 
)

◆ DagBlock() [6/10]

taraxa::DagBlock::DagBlock ( Json::Value const &  doc)
explicit

◆ DagBlock() [7/10]

taraxa::DagBlock::DagBlock ( string const &  json)
explicit

◆ DagBlock() [8/10]

taraxa::DagBlock::DagBlock ( dev::RLP const &  _rlp)
explicit

◆ DagBlock() [9/10]

taraxa::DagBlock::DagBlock ( dev::RLP const &  _rlp,
vec_trx_t &&  trxs 
)
explicit

◆ DagBlock() [10/10]

taraxa::DagBlock::DagBlock ( dev::bytes const &  _rlp)
inlineexplicit

Member Function Documentation

◆ extract_dag_level_from_rlp()

level_t taraxa::DagBlock::extract_dag_level_from_rlp ( const dev::RLP rlp)
static

Extracts dag level from rlp representation.

Parameters
rlp
Returns

◆ extract_signature_from_rlp()

sig_t taraxa::DagBlock::extract_signature_from_rlp ( const dev::RLP rlp)
static

Extracts signature from rlp representation.

Parameters
rlp
Returns
signature

◆ getDifficulty()

uint16_t taraxa::DagBlock::getDifficulty ( ) const
inline

◆ getGasEstimation()

auto const& taraxa::DagBlock::getGasEstimation ( ) const
inline

◆ getHash()

blk_hash_t const & taraxa::DagBlock::getHash ( ) const

◆ getJson()

Json::Value taraxa::DagBlock::getJson ( bool  with_derived_fields = true) const

◆ getJsonStr()

std::string taraxa::DagBlock::getJsonStr ( ) const

◆ getLevel()

auto taraxa::DagBlock::getLevel ( ) const
inline

◆ getPivot()

auto const& taraxa::DagBlock::getPivot ( ) const
inline

◆ getSender()

addr_t const & taraxa::DagBlock::getSender ( ) const

◆ getSig()

auto const& taraxa::DagBlock::getSig ( ) const
inline

◆ getTimestamp()

auto taraxa::DagBlock::getTimestamp ( ) const
inline

◆ getTips()

auto const& taraxa::DagBlock::getTips ( ) const
inline

◆ getTrxs()

auto const& taraxa::DagBlock::getTrxs ( ) const
inline

◆ operator==()

bool taraxa::DagBlock::operator== ( DagBlock const &  other) const
inline

◆ rlp()

bytes taraxa::DagBlock::rlp ( bool  include_sig,
bool  include_trxs = true 
) const

◆ sha3()

blk_hash_t taraxa::DagBlock::sha3 ( bool  include_sig) const
private

◆ streamRLP()

dev::RLPStream taraxa::DagBlock::streamRLP ( bool  include_sig,
bool  include_trxs = true 
) const

Returns dag block data rlp stream.

Parameters
include_sig
Returns
dev::RLPStream

◆ verifySig()

bool taraxa::DagBlock::verifySig ( ) const

◆ verifyVdf()

void taraxa::DagBlock::verifyVdf ( const SortitionParams vdf_config,
const h256 proposal_period_hash,
const vrf_wrapper::vrf_pk_t pk,
uint64_t  vote_count,
uint64_t  total_vote_count 
) const

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  str,
DagBlock const &  u 
)
friend

Member Data Documentation

◆ block_weight_

u256 taraxa::DagBlock::block_weight_
private

◆ cached_sender_

addr_t taraxa::DagBlock::cached_sender_
mutableprivate

◆ cached_sender_mu_

util::DefaultConstructCopyableMovable<std::mutex> taraxa::DagBlock::cached_sender_mu_
mutableprivate

◆ gas_estimation_

uint64_t taraxa::DagBlock::gas_estimation_
private

◆ hash_

blk_hash_t taraxa::DagBlock::hash_
mutableprivate

◆ hash_mu_

util::DefaultConstructCopyableMovable<std::mutex> taraxa::DagBlock::hash_mu_
mutableprivate

◆ kLevelPosInRlp

const size_t taraxa::DagBlock::kLevelPosInRlp {1}
staticprivate

◆ kSigPosInRlp

const size_t taraxa::DagBlock::kSigPosInRlp {6}
staticprivate

◆ level_

level_t taraxa::DagBlock::level_ = 0
private

◆ pivot_

blk_hash_t taraxa::DagBlock::pivot_
private

◆ sig_

sig_t taraxa::DagBlock::sig_
private

◆ timestamp_

uint64_t taraxa::DagBlock::timestamp_ = 0
private

◆ tips_

vec_blk_t taraxa::DagBlock::tips_
private

◆ trxs_

vec_trx_t taraxa::DagBlock::trxs_
private

◆ vdf_

vdf_sortition::VdfSortition taraxa::DagBlock::vdf_
private

The documentation for this class was generated from the following files: