|
TARAXA
|
Namespaces | |
| namespace | taraxa::network |
| namespace | taraxa::network::tarcap |
Classes | |
| class | taraxa::VoteManager |
| VoteManager class manage votes for PBFT consensus. More... | |
| class | taraxa::PbftVote |
| PbftVote class is a vote class that includes vote hash, vote on PBFT block hash, vote signature, VRF sortition, voter public key, voter address, and vote weight. More... | |
| class | taraxa::PillarVote |
| PillarVote class. More... | |
| class | taraxa::Vote |
| Vote class is a vote class that includes vote hash, vote on PBFT block hash, vote signature, VRF sortition, voter public key, voter address, and vote weight. More... | |
| struct | taraxa::OptimizedPbftVotesBundle |
| struct | taraxa::OptimizedPillarVotesBundle |
| class | taraxa::VrfPbftMsg |
| VrfPbftMsg class uses PBFT period, round and step to generate a message for doing VRF sortition. More... | |
| class | taraxa::VrfPbftSortition |
| VrfPbftSortition class used for doing VRF sortition to place a vote or to propose a new PBFT block. More... | |
Enumerations | |
| enum class | taraxa::PbftVoteTypes : uint8_t { taraxa::PbftVoteTypes::invalid_vote = 0 , taraxa::PbftVoteTypes::propose_vote , taraxa::PbftVoteTypes::soft_vote , taraxa::PbftVoteTypes::cert_vote , taraxa::PbftVoteTypes::next_vote } |
Functions | |
| dev::bytes | taraxa::encodePbftVotesBundleRlp (const std::vector< std::shared_ptr< PbftVote > > &votes) |
| Encodes pbft votes into optimized votes bundle rlp. | |
| std::vector< std::shared_ptr< PbftVote > > | taraxa::decodePbftVotesBundleRlp (const dev::RLP &votes_bundle_rlp) |
| Decodes pbft votes from optimized votes bundle rlp. | |
| dev::bytes | taraxa::encodePillarVotesBundleRlp (const std::vector< std::shared_ptr< PillarVote > > &votes) |
| Encodes pillar votes into optimized votes bundle rlp. | |
| std::vector< std::shared_ptr< PillarVote > > | taraxa::decodePillarVotesBundleRlp (const dev::RLP &votes_bundle_rlp) |
| Decodes pillar votes from optimized votes bundle rlp. | |
| dev::h256 | taraxa::getVoterIndexHash (const vrf_wrapper::vrf_output_t &vrf, const public_t &address, uint64_t index=0) |
| Get a hash number of combining VRF output, voter address, and vote weight index. | |
Variables | |
| static constexpr size_t | taraxa::kPbftVotesBundleRlpSize {5} |
| static constexpr size_t | taraxa::kPillarVotesBundleRlpSize {3} |
| class taraxa::VoteManager |
VoteManager class manage votes for PBFT consensus.

Public Member Functions | |
| VoteManager (const FullNodeConfig &config, std::shared_ptr< DbStorage > db, std::shared_ptr< PbftChain > pbft_chain, std::shared_ptr< final_chain::FinalChain > final_chain, std::shared_ptr< KeyManager > key_manager, std::shared_ptr< SlashingManager > slashing_manager) | |
| ~VoteManager ()=default | |
| VoteManager (const VoteManager &)=delete | |
| VoteManager (VoteManager &&)=delete | |
| VoteManager & | operator= (const VoteManager &)=delete |
| VoteManager & | operator= (VoteManager &&)=delete |
| void | setNetwork (std::weak_ptr< Network > network) |
| Set network as a weak pointer. | |
| bool | addVerifiedVote (const std::shared_ptr< PbftVote > &vote) |
| Add a vote to the verified votes map. | |
| bool | voteInVerifiedMap (std::shared_ptr< PbftVote > const &vote) const |
| Check if the vote has been in the verified votes map. | |
| std::pair< bool, std::shared_ptr< PbftVote > > | isUniqueVote (const std::shared_ptr< PbftVote > &vote) const |
| std::vector< std::shared_ptr< PbftVote > > | getVerifiedVotes () const |
| Get all verified votes. | |
| uint64_t | getVerifiedVotesSize () const |
| Get the total size of all verified votes. | |
| void | cleanupVotesByPeriod (PbftPeriod pbft_period) |
| Cleanup votes for specified PBFT period. | |
| std::vector< std::shared_ptr< PbftVote > > | getProposalVotes (PbftPeriod period, PbftRound round) const |
| Get all verified votes in proposal vote type for the current PBFT round. | |
| std::optional< PbftRound > | determineNewRound (PbftPeriod current_pbft_period, PbftRound current_pbft_round) |
| Check if there are enough next voting type votes to set PBFT to a forward round within period. | |
| void | resetRewardVotes (PbftPeriod period, PbftRound round, PbftStep step, const blk_hash_t &block_hash, Batch &batch) |
| Replace current reward votes with new period, round & block hash based on vote. | |
| std::pair< bool, std::vector< std::shared_ptr< PbftVote > > > | checkRewardVotes (const std::shared_ptr< PbftBlock > &pbft_block, bool copy_votes) |
| Check reward votes for specified pbft block. | |
| std::vector< std::shared_ptr< PbftVote > > | getRewardVotes () |
| Get reward votes with the round during which was the previous block pushed. | |
| PbftPeriod | getRewardVotesPbftBlockPeriod () |
| Get current reward votes pbft block period. | |
| void | saveOwnVerifiedVote (const std::shared_ptr< PbftVote > &vote) |
| Saves own verified vote into memory and db. | |
| std::vector< std::shared_ptr< PbftVote > > | getOwnVerifiedVotes () |
| void | clearOwnVerifiedVotes (Batch &write_batch) |
| Clear own verified votes. | |
| std::shared_ptr< PbftVote > | generateVoteWithWeight (const blk_hash_t &blockhash, PbftVoteTypes vote_type, PbftPeriod period, PbftRound round, PbftStep step, const WalletConfig &wallet) |
| Place a vote, save it in the verified votes queue, and gossip to peers. | |
| std::shared_ptr< PbftVote > | generateVote (const blk_hash_t &blockhash, PbftVoteTypes type, PbftPeriod period, PbftRound round, PbftStep step, const WalletConfig &wallet) |
| Generate a vote. | |
| std::pair< bool, std::string > | validateVote (const std::shared_ptr< PbftVote > &vote, bool strict=true) const |
| Validates vote. | |
| std::optional< uint64_t > | getPbftTwoTPlusOne (PbftPeriod pbft_period, PbftVoteTypes vote_type) const |
| Get 2t+1. 2t+1 is 2/3 of PBFT sortition threshold and plus 1 for a specific period. | |
| bool | voteAlreadyValidated (const vote_hash_t &vote_hash) const |
| bool | genAndValidateVrfSortition (PbftPeriod pbft_period, PbftRound pbft_round, const WalletConfig &wallet) const |
| Generates vrf sortition and calculates its weight. | |
| std::optional< blk_hash_t > | getTwoTPlusOneVotedBlock (PbftPeriod period, PbftRound round, TwoTPlusOneVotedBlockType type) const |
| Get 2t+1 voted block for specific period, round and type, e.g. soft/cert/next voted block. | |
| std::vector< std::shared_ptr< PbftVote > > | getTwoTPlusOneVotedBlockVotes (PbftPeriod period, PbftRound round, TwoTPlusOneVotedBlockType type) const |
| StepVotes | getStepVotes (PbftPeriod period, PbftRound round, PbftStep step) const |
| void | setCurrentPbftPeriodAndRound (PbftPeriod pbft_period, PbftRound pbft_round) |
| Sets current pbft period & round. It also checks if we dont already have 2t+1 vote bundles(pf any type) for the provided period & round and if so, it saves these bundles into db. | |
| PbftStep | getNetworkTplusOneNextVotingStep (PbftPeriod period, PbftRound round) const |
| Returns greatest step (in specified period & round), for which there is at least t+1 voting power from all nodes. | |
Private Member Functions | |
| bool | isValidRewardVote (const std::shared_ptr< PbftVote > &vote) const |
| uint64_t | getPbftSortitionThreshold (uint64_t total_dpos_votes_count, PbftVoteTypes vote_type) const |
| Get PBFT sortition threshold for specific period. | |
Private Attributes | |
| const PbftConfig & | kPbftConfig |
| std::shared_ptr< DbStorage > | db_ |
| std::shared_ptr< PbftChain > | pbft_chain_ |
| std::shared_ptr< final_chain::FinalChain > | final_chain_ |
| std::shared_ptr< KeyManager > | key_manager_ |
| std::weak_ptr< Network > | network_ |
| std::shared_ptr< SlashingManager > | slashing_manager_ |
| std::atomic< PbftPeriod > | current_pbft_period_ {0} |
| std::atomic< PbftRound > | current_pbft_round_ {0} |
| VerifiedVotes | verified_votes_ |
| blk_hash_t | reward_votes_block_hash_ |
| PbftRound | reward_votes_period_ |
| PbftRound | reward_votes_round_ |
| std::vector< vote_hash_t > | extra_reward_votes_ |
| std::shared_mutex | reward_votes_info_mutex_ |
| std::vector< std::shared_ptr< PbftVote > > | own_verified_votes_ |
| std::unordered_map< PbftVoteTypes, std::pair< PbftPeriod, uint64_t > > | current_two_t_plus_one_ |
| std::shared_mutex | current_two_t_plus_one_mutex_ |
| ExpirationCache< vote_hash_t > | already_validated_votes_ |
| taraxa::VoteManager::VoteManager | ( | const FullNodeConfig & | config, |
| std::shared_ptr< DbStorage > | db, | ||
| std::shared_ptr< PbftChain > | pbft_chain, | ||
| std::shared_ptr< final_chain::FinalChain > | final_chain, | ||
| std::shared_ptr< KeyManager > | key_manager, | ||
| std::shared_ptr< SlashingManager > | slashing_manager | ||
| ) |
|
default |
|
delete |
|
delete |
| bool taraxa::VoteManager::addVerifiedVote | ( | const std::shared_ptr< PbftVote > & | vote | ) |
Add a vote to the verified votes map.
| vote | vote |
| std::pair< bool, std::vector< std::shared_ptr< PbftVote > > > taraxa::VoteManager::checkRewardVotes | ( | const std::shared_ptr< PbftBlock > & | pbft_block, |
| bool | copy_votes | ||
| ) |
Check reward votes for specified pbft block.
| pbft_block | |
| copy_votes | - if set to true, votes are copied and returned, otherwise votes are just checked if present |
| void taraxa::VoteManager::cleanupVotesByPeriod | ( | PbftPeriod | pbft_period | ) |
Cleanup votes for specified PBFT period.
| pbft_period | current PBFT period |
| void taraxa::VoteManager::clearOwnVerifiedVotes | ( | Batch & | write_batch | ) |
Clear own verified votes.
| write_batch |
| std::optional< PbftRound > taraxa::VoteManager::determineNewRound | ( | PbftPeriod | current_pbft_period, |
| PbftRound | current_pbft_round | ||
| ) |
Check if there are enough next voting type votes to set PBFT to a forward round within period.
| current_pbft_period | current pbft period |
| current_pbft_round | current pbft round |
| bool taraxa::VoteManager::genAndValidateVrfSortition | ( | PbftPeriod | pbft_period, |
| PbftRound | pbft_round, | ||
| const WalletConfig & | wallet | ||
| ) | const |
Generates vrf sortition and calculates its weight.
| wallet |
| std::shared_ptr< PbftVote > taraxa::VoteManager::generateVote | ( | const blk_hash_t & | blockhash, |
| PbftVoteTypes | type, | ||
| PbftPeriod | period, | ||
| PbftRound | round, | ||
| PbftStep | step, | ||
| const WalletConfig & | wallet | ||
| ) |
Generate a vote.
| blockhash | vote on PBFT block hash |
| type | vote type |
| period | PBFT period |
| round | PBFT round |
| step | PBFT step |
| wallet |
| std::shared_ptr< PbftVote > taraxa::VoteManager::generateVoteWithWeight | ( | const blk_hash_t & | blockhash, |
| PbftVoteTypes | vote_type, | ||
| PbftPeriod | period, | ||
| PbftRound | round, | ||
| PbftStep | step, | ||
| const WalletConfig & | wallet | ||
| ) |
Place a vote, save it in the verified votes queue, and gossip to peers.
| blockhash | vote on PBFT block hash |
| vote_type | vote type |
| period | PBFT period |
| round | PBFT round |
| step | PBFT step |
| step | PBFT step |
| wallet |
| PbftStep taraxa::VoteManager::getNetworkTplusOneNextVotingStep | ( | PbftPeriod | period, |
| PbftRound | round | ||
| ) | const |
Returns greatest step (in specified period & round), for which there is at least t+1 voting power from all nodes.
| period | |
| round |
| std::vector< std::shared_ptr< PbftVote > > taraxa::VoteManager::getOwnVerifiedVotes | ( | ) |
|
private |
Get PBFT sortition threshold for specific period.
| total_dpos_votes_count | total votes count |
| vote_type | vote type |
| std::optional< uint64_t > taraxa::VoteManager::getPbftTwoTPlusOne | ( | PbftPeriod | pbft_period, |
| PbftVoteTypes | vote_type | ||
| ) | const |
Get 2t+1. 2t+1 is 2/3 of PBFT sortition threshold and plus 1 for a specific period.
| pbft_period | pbft period |
| vote_type | vote type, for which we get 2t+1 |
| std::vector< std::shared_ptr< PbftVote > > taraxa::VoteManager::getProposalVotes | ( | PbftPeriod | period, |
| PbftRound | round | ||
| ) | const |
Get all verified votes in proposal vote type for the current PBFT round.
| period | new PBFT period (period == chain_size + 1) |
| round | current PBFT round |
| std::vector< std::shared_ptr< PbftVote > > taraxa::VoteManager::getRewardVotes | ( | ) |
Get reward votes with the round during which was the previous block pushed.
| PbftPeriod taraxa::VoteManager::getRewardVotesPbftBlockPeriod | ( | ) |
Get current reward votes pbft block period.
| StepVotes taraxa::VoteManager::getStepVotes | ( | PbftPeriod | period, |
| PbftRound | round, | ||
| PbftStep | step | ||
| ) | const |
Get all step votes for specific period, round and step
| period | |
| round | |
| step |
| std::optional< blk_hash_t > taraxa::VoteManager::getTwoTPlusOneVotedBlock | ( | PbftPeriod | period, |
| PbftRound | round, | ||
| TwoTPlusOneVotedBlockType | type | ||
| ) | const |
Get 2t+1 voted block for specific period, round and type, e.g. soft/cert/next voted block.
| period | |
| round | |
| votes_type |
| std::vector< std::shared_ptr< PbftVote > > taraxa::VoteManager::getTwoTPlusOneVotedBlockVotes | ( | PbftPeriod | period, |
| PbftRound | round, | ||
| TwoTPlusOneVotedBlockType | type | ||
| ) | const |
Get 2t+1 voted block votes for specific period, round and type, e.g. soft/cert/next voted block
| period | |
| round | |
| type |
| std::vector< std::shared_ptr< PbftVote > > taraxa::VoteManager::getVerifiedVotes | ( | ) | const |
Get all verified votes.
| uint64_t taraxa::VoteManager::getVerifiedVotesSize | ( | ) | const |
Get the total size of all verified votes.
| std::pair< bool, std::shared_ptr< PbftVote > > taraxa::VoteManager::isUniqueVote | ( | const std::shared_ptr< PbftVote > & | vote | ) | const |
| vote |
|
private |
| vote |
|
delete |
|
delete |
| void taraxa::VoteManager::resetRewardVotes | ( | PbftPeriod | period, |
| PbftRound | round, | ||
| PbftStep | step, | ||
| const blk_hash_t & | block_hash, | ||
| Batch & | batch | ||
| ) |
Replace current reward votes with new period, round & block hash based on vote.
| period | |
| round | |
| step | |
| block_hash | |
| batch |
| void taraxa::VoteManager::saveOwnVerifiedVote | ( | const std::shared_ptr< PbftVote > & | vote | ) |
Saves own verified vote into memory and db.
| vote |
| void taraxa::VoteManager::setCurrentPbftPeriodAndRound | ( | PbftPeriod | pbft_period, |
| PbftRound | pbft_round | ||
| ) |
Sets current pbft period & round. It also checks if we dont already have 2t+1 vote bundles(pf any type) for the provided period & round and if so, it saves these bundles into db.
| pbft_period | |
| pbft_round |
| void taraxa::VoteManager::setNetwork | ( | std::weak_ptr< Network > | network | ) |
Set network as a weak pointer.
| network | a weak pointer |
| std::pair< bool, std::string > taraxa::VoteManager::validateVote | ( | const std::shared_ptr< PbftVote > & | vote, |
| bool | strict = true |
||
| ) | const |
Validates vote.
| vote | to be validated |
| strict | strict validation |
| bool taraxa::VoteManager::voteAlreadyValidated | ( | const vote_hash_t & | vote_hash | ) | const |
| vote_hash |
| bool taraxa::VoteManager::voteInVerifiedMap | ( | std::shared_ptr< PbftVote > const & | vote | ) | const |
Check if the vote has been in the verified votes map.
| vote | vote |
|
mutableprivate |
|
private |
|
private |
|
mutableprivate |
|
mutableprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
mutableprivate |
|
private |
|
private |
|
private |
|
private |
| class taraxa::PbftVote |
PbftVote class is a vote class that includes vote hash, vote on PBFT block hash, vote signature, VRF sortition, voter public key, voter address, and vote weight.

Public Types | |
| using | vrf_pk_t = vrf_wrapper::vrf_pk_t |
Public Member Functions | |
| PbftVote ()=default | |
| PbftVote (secret_t const &node_sk, VrfPbftSortition vrf_sortition, blk_hash_t const &block_hash) | |
| PbftVote (const blk_hash_t &block_hash, PbftPeriod period, PbftRound round, PbftStep step, dev::RLP const &rlp) | |
| PbftVote (dev::RLP const &rlp) | |
| PbftVote (bytes const &rlp) | |
| bool | operator== (const PbftVote &other) const |
| bool | verifyVrfSortition (const vrf_pk_t &pk, bool strict) const |
| Verify VRF sortition. | |
| const VrfPbftSortition & | getVrfSortition () const |
| Get VRF sortition. | |
| const vrf_wrapper::vrf_proof_t & | getSortitionProof () const |
| Get VRF sortition proof. | |
| const vrf_wrapper::vrf_output_t & | getCredential () const |
| Get VRF sortition output. | |
| PbftVoteTypes | getType () const |
| Get vote type. | |
| PbftPeriod | getPeriod () const |
| Get vote PBFT period. | |
| PbftRound | getRound () const |
| Get vote PBFT round. | |
| PbftStep | getStep () const |
| Get vote PBFT step. | |
| bytes | rlp (bool inc_sig=true, bool inc_weight=false) const |
| Recursive Length Prefix. | |
| bytes | optimizedRlp () const |
| Optimized Recursive Length Prefix. | |
| uint64_t | calculateWeight (uint64_t stake, double dpos_total_votes_count, double threshold) const |
| Calculate vote weight. | |
| std::optional< uint64_t > | getWeight () const |
| Get vote weight. | |
| Json::Value | toJSON () const |
| Get vote in JSON representation. | |
Public Member Functions inherited from taraxa::Vote | |
| Vote ()=default | |
| Vote (const blk_hash_t &block_hash) | |
| virtual | ~Vote ()=default |
| void | signVote (const secret_t &node_sk) |
| Sign the vote. | |
| const vote_hash_t & | getHash () const |
| Get vote hash. | |
| const public_t & | getVoter () const |
| Get voter public key. | |
| const addr_t & | getVoterAddr () const |
| Get voter address. | |
| const sig_t & | getVoteSignature () const |
| Get vote signature. | |
| const blk_hash_t & | getBlockHash () const |
| Get PBFT block hash that votes on. | |
| bool | verifyVote () const |
| Verify vote. | |
Private Member Functions | |
| vote_hash_t | sha3 (bool inc_sig) const override |
| Secure Hash Algorithm 3. | |
Private Attributes | |
| VrfPbftSortition | vrf_sortition_ |
| std::optional< uint64_t > | weight_ |
Friends | |
| std::ostream & | operator<< (std::ostream &strm, PbftVote const &vote) |
Additional Inherited Members | |
Protected Attributes inherited from taraxa::Vote | |
| blk_hash_t | block_hash_ |
| sig_t | vote_signature_ |
| vote_hash_t | vote_hash_ |
| public_t | cached_voter_ |
| addr_t | cached_voter_addr_ |
|
default |
| taraxa::PbftVote::PbftVote | ( | secret_t const & | node_sk, |
| VrfPbftSortition | vrf_sortition, | ||
| blk_hash_t const & | block_hash | ||
| ) |
|
explicit |
|
explicit |
|
explicit |
| uint64_t taraxa::PbftVote::calculateWeight | ( | uint64_t | stake, |
| double | dpos_total_votes_count, | ||
| double | threshold | ||
| ) | const |
Calculate vote weight.
| stake | voter DPOS eligible votes count |
| dpos_total_votes_count | total DPOS votes count |
| threshold | PBFT sortition threshold that is minimum of between PBFT committee size and total DPOS votes count |
| const vrf_wrapper::vrf_output_t & taraxa::PbftVote::getCredential | ( | ) | const |
Get VRF sortition output.
| PbftPeriod taraxa::PbftVote::getPeriod | ( | ) | const |
Get vote PBFT period.
| PbftRound taraxa::PbftVote::getRound | ( | ) | const |
Get vote PBFT round.
| const vrf_wrapper::vrf_proof_t & taraxa::PbftVote::getSortitionProof | ( | ) | const |
Get VRF sortition proof.
| PbftStep taraxa::PbftVote::getStep | ( | ) | const |
Get vote PBFT step.
| PbftVoteTypes taraxa::PbftVote::getType | ( | ) | const |
Get vote type.
| const VrfPbftSortition & taraxa::PbftVote::getVrfSortition | ( | ) | const |
Get VRF sortition.
| std::optional< uint64_t > taraxa::PbftVote::getWeight | ( | ) | const |
Get vote weight.
| bool taraxa::PbftVote::operator== | ( | const PbftVote & | other | ) | const |
| bytes taraxa::PbftVote::optimizedRlp | ( | ) | const |
Optimized Recursive Length Prefix.
| void taraxa::PbftVote::rlp | ( | bool | inc_sig = true, |
| bool | inc_weight = false |
||
| ) | const |
Recursive Length Prefix.
| inc_sig | if include vote signature |
| inc_weight | if include vote weight |
|
overrideprivatevirtual |
Secure Hash Algorithm 3.
| inc_sig | if include vote signature |
Implements taraxa::Vote.
| Json::Value taraxa::PbftVote::toJSON | ( | ) | const |
Get vote in JSON representation.
| bool taraxa::PbftVote::verifyVrfSortition | ( | const vrf_pk_t & | pk, |
| bool | strict | ||
| ) | const |
Verify VRF sortition.
|
friend |
|
private |
|
mutableprivate |
| class taraxa::PillarVote |
PillarVote class.

Public Member Functions | |
| PillarVote ()=default | |
| PillarVote (const secret_t &node_sk, PbftPeriod period, const blk_hash_t &block_hash) | |
| PillarVote (PbftPeriod period, const blk_hash_t &block_hash, sig_t &&signature) | |
| PillarVote (const dev::RLP &rlp) | |
| PillarVote (const bytes &rlp) | |
| PbftPeriod | getPeriod () const |
| bytes | rlp () const |
| Recursive Length Prefix. | |
| bytes | encodeSolidity (bool inc_sig=true) const |
Public Member Functions inherited from taraxa::Vote | |
| Vote ()=default | |
| Vote (const blk_hash_t &block_hash) | |
| virtual | ~Vote ()=default |
| void | signVote (const secret_t &node_sk) |
| Sign the vote. | |
| const vote_hash_t & | getHash () const |
| Get vote hash. | |
| const public_t & | getVoter () const |
| Get voter public key. | |
| const addr_t & | getVoterAddr () const |
| Get voter address. | |
| const sig_t & | getVoteSignature () const |
| Get vote signature. | |
| const blk_hash_t & | getBlockHash () const |
| Get PBFT block hash that votes on. | |
| bool | verifyVote () const |
| Verify vote. | |
Static Public Member Functions | |
| static PillarVote | decodeSolidity (const bytes &enc) |
| Decodes solidity encoded representation of pillar vote. | |
Static Public Attributes | |
| static constexpr size_t | kNoSigRlpSize {2} |
| static constexpr size_t | kStandardRlpSize {3} |
Private Member Functions | |
| vote_hash_t | sha3 (bool inc_sig) const override |
| Secure Hash Algorithm 3. | |
Private Attributes | |
| PbftPeriod | period_ |
Additional Inherited Members | |
Protected Attributes inherited from taraxa::Vote | |
| blk_hash_t | block_hash_ |
| sig_t | vote_signature_ |
| vote_hash_t | vote_hash_ |
| public_t | cached_voter_ |
| addr_t | cached_voter_addr_ |
|
default |
| taraxa::PillarVote::PillarVote | ( | const secret_t & | node_sk, |
| PbftPeriod | period, | ||
| const blk_hash_t & | block_hash | ||
| ) |
| taraxa::PillarVote::PillarVote | ( | PbftPeriod | period, |
| const blk_hash_t & | block_hash, | ||
| sig_t && | signature | ||
| ) |
|
explicit |
|
explicit |
|
static |
| bytes taraxa::PillarVote::encodeSolidity | ( | bool | inc_sig = true | ) | const |
| PbftPeriod taraxa::PillarVote::getPeriod | ( | ) | const |
| bytes taraxa::PillarVote::rlp | ( | ) | const |
Recursive Length Prefix.
|
overrideprivatevirtual |
Secure Hash Algorithm 3.
| inc_sig | if include vote signature |
Implements taraxa::Vote.
|
staticconstexpr |
|
staticconstexpr |
|
private |
| class taraxa::Vote |
Vote class is a vote class that includes vote hash, vote on PBFT block hash, vote signature, VRF sortition, voter public key, voter address, and vote weight.

Public Member Functions | |
| Vote ()=default | |
| Vote (const blk_hash_t &block_hash) | |
| virtual | ~Vote ()=default |
| void | signVote (const secret_t &node_sk) |
| Sign the vote. | |
| const vote_hash_t & | getHash () const |
| Get vote hash. | |
| const public_t & | getVoter () const |
| Get voter public key. | |
| const addr_t & | getVoterAddr () const |
| Get voter address. | |
| const sig_t & | getVoteSignature () const |
| Get vote signature. | |
| const blk_hash_t & | getBlockHash () const |
| Get PBFT block hash that votes on. | |
| bool | verifyVote () const |
| Verify vote. | |
| virtual vote_hash_t | sha3 (bool inc_sig) const =0 |
| Secure Hash Algorithm 3. | |
Protected Attributes | |
| blk_hash_t | block_hash_ |
| sig_t | vote_signature_ |
| vote_hash_t | vote_hash_ |
| public_t | cached_voter_ |
| addr_t | cached_voter_addr_ |
|
default |
| taraxa::Vote::Vote | ( | const blk_hash_t & | block_hash | ) |
|
virtualdefault |
| const blk_hash_t & taraxa::Vote::getBlockHash | ( | ) | const |
Get PBFT block hash that votes on.
| const vote_hash_t & taraxa::Vote::getHash | ( | ) | const |
Get vote hash.
| const public_t & taraxa::Vote::getVoter | ( | ) | const |
Get voter public key.
| const addr_t & taraxa::Vote::getVoterAddr | ( | ) | const |
Get voter address.
| const sig_t & taraxa::Vote::getVoteSignature | ( | ) | const |
Get vote signature.
|
pure virtual |
Secure Hash Algorithm 3.
| inc_sig | if include vote signature |
Implemented in taraxa::PbftVote, and taraxa::PillarVote.
| void taraxa::Vote::signVote | ( | const secret_t & | node_sk | ) |
Sign the vote.
| node_sk |
| bool taraxa::Vote::verifyVote | ( | ) | const |
Verify vote.
|
protected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |
|
protected |
| struct taraxa::OptimizedPbftVotesBundle |
| Class Members | ||
|---|---|---|
| vector< shared_ptr< PbftVote > > | votes | |
| struct taraxa::OptimizedPillarVotesBundle |
| Class Members | ||
|---|---|---|
| vector< shared_ptr< PillarVote > > | pillar_votes | |
| class taraxa::VrfPbftMsg |
VrfPbftMsg class uses PBFT period, round and step to generate a message for doing VRF sortition.
Public Member Functions | |
| VrfPbftMsg ()=default | |
| VrfPbftMsg (PbftVoteTypes type, PbftPeriod period, PbftRound round, PbftStep step) | |
| PbftVoteTypes | getType () const |
| Get v type based on vote step. | |
| std::string | toString () const |
| Combine vote type, PBFT period, round and step to a string. | |
| bytes | getRlpBytes () const |
| Get bytes of RLP stream. | |
| bool | operator== (VrfPbftMsg const &other) const |
Public Attributes | |
| PbftPeriod | period_ |
| PbftRound | round_ |
| PbftStep | step_ |
Friends | |
| std::ostream & | operator<< (std::ostream &strm, VrfPbftMsg const &pbft_msg) |
|
default |
| taraxa::VrfPbftMsg::VrfPbftMsg | ( | PbftVoteTypes | type, |
| PbftPeriod | period, | ||
| PbftRound | round, | ||
| PbftStep | step | ||
| ) |
| bytes taraxa::VrfPbftMsg::getRlpBytes | ( | ) | const |
Get bytes of RLP stream.
| PbftVoteTypes taraxa::VrfPbftMsg::getType | ( | ) | const |
Get v type based on vote step.
| bool taraxa::VrfPbftMsg::operator== | ( | VrfPbftMsg const & | other | ) | const |
| std::string taraxa::VrfPbftMsg::toString | ( | ) | const |
Combine vote type, PBFT period, round and step to a string.
|
friend |
| PbftPeriod taraxa::VrfPbftMsg::period_ |
| PbftRound taraxa::VrfPbftMsg::round_ |
| PbftStep taraxa::VrfPbftMsg::step_ |
| class taraxa::VrfPbftSortition |
VrfPbftSortition class used for doing VRF sortition to place a vote or to propose a new PBFT block.

Public Member Functions | |
| VrfPbftSortition ()=default | |
| VrfPbftSortition (vrf_sk_t const &sk, const VrfPbftMsg &pbft_msg) | |
| VrfPbftSortition (dev::bytes const &rlp) | |
| dev::bytes | getRlpBytes () const |
| Get bytes of RLP stream. | |
| bool | verify (const vrf_pk_t &pk, bool strict=true) const |
| Verify VRF sortition. | |
| bool | operator== (VrfPbftSortition const &other) const |
| uint64_t | calculateWeight (uint64_t stake, uint64_t dpos_total_votes_count, uint64_t threshold, const public_t &address) const |
| Calculate vote weight. | |
Public Member Functions inherited from taraxa::vrf_wrapper::VrfSortitionBase | |
| VrfSortitionBase ()=default | |
| VrfSortitionBase (vrf_sk_t const &sk, bytes const &msg, uint16_t vote_count=1) | |
| bool | verify (const vrf_pk_t &pk, const bytes &msg, uint16_t vote_count=1, bool strict=true) const |
| bool | operator== (VrfSortitionBase const &other) const |
| virtual std::ostream & | print (std::ostream &strm) const |
Static Public Member Functions | |
| static uint64_t | getBinominalDistribution (uint64_t stake, double dpos_total_votes_count, double threshold, const uint256_t &hash) |
| Calculate a vote weight in binominal distribution. | |
Static Public Member Functions inherited from taraxa::vrf_wrapper::VrfSortitionBase | |
| static dev::bytes | makeVrfInput (taraxa::level_t level, const dev::h256 &period_hash) |
Public Attributes | |
| VrfPbftMsg | pbft_msg_ |
Public Attributes inherited from taraxa::vrf_wrapper::VrfSortitionBase | |
| vrf_proof_t | proof_ |
| vrf_output_t | output_ |
| uint16_t | threshold_ |
Static Public Attributes | |
| static uint256_t | max256bits = std::numeric_limits<uint256_t>::max() |
| static auto | kMax256bFP = max256bits.convert_to<boost::multiprecision::mpfr_float>() |
Private Types | |
| using | vrf_sk_t = vrf_wrapper::vrf_sk_t |
| using | vrf_pk_t = vrf_wrapper::vrf_pk_t |
| using | vrf_proof_t = vrf_wrapper::vrf_proof_t |
| using | vrf_output_t = vrf_wrapper::vrf_output_t |
Friends | |
| std::ostream & | operator<< (std::ostream &strm, const VrfPbftSortition &vrf_sortition) |
|
private |
|
private |
|
private |
|
private |
|
default |
|
inline |
|
explicit |
| uint64_t taraxa::VrfPbftSortition::calculateWeight | ( | uint64_t | stake, |
| uint64_t | dpos_total_votes_count, | ||
| uint64_t | threshold, | ||
| const public_t & | address | ||
| ) | const |
Calculate vote weight.
| stake | voter DPOS eligible votes count |
| dpos_total_votes_count | total DPOS votes count |
| threshold | PBFT sortition threshold that is minimum of between PBFT committee size and total DPOS votes count |
| address | voter public key |
|
static |
Calculate a vote weight in binominal distribution.
| stake | voter DPOS eligible votes count |
| dpos_total_votes_count | total DPOS votes count |
| threshold | PBFT sortition threshold that is minimum of between PBFT committee size and total DPOS votes count |
| hash | a hash number of combining VRF output, voter address, and vote weight index |
| bytes taraxa::VrfPbftSortition::getRlpBytes | ( | ) | const |
Get bytes of RLP stream.
|
inline |
|
inline |
Verify VRF sortition.
| strict | strict validation |
|
friend |
|
inlinestatic |
| VrfPbftMsg taraxa::VrfPbftSortition::pbft_msg_ |
|
strong |
| std::vector< std::shared_ptr< PbftVote > > taraxa::decodePbftVotesBundleRlp | ( | const dev::RLP & | votes_bundle_rlp | ) |
Decodes pbft votes from optimized votes bundle rlp.
| votes_bundle_rlp |
| std::vector< std::shared_ptr< PillarVote > > taraxa::decodePillarVotesBundleRlp | ( | const dev::RLP & | votes_bundle_rlp | ) |
Decodes pillar votes from optimized votes bundle rlp.
| votes_bundle_rlp |
| dev::bytes taraxa::encodePbftVotesBundleRlp | ( | const std::vector< std::shared_ptr< PbftVote > > & | votes | ) |
Encodes pbft votes into optimized votes bundle rlp.
| votes |
| dev::bytes taraxa::encodePillarVotesBundleRlp | ( | const std::vector< std::shared_ptr< PillarVote > > & | votes | ) |
Encodes pillar votes into optimized votes bundle rlp.
| votes |
| dev::h256 taraxa::getVoterIndexHash | ( | const vrf_wrapper::vrf_output_t & | vrf, |
| const public_t & | address, | ||
| uint64_t | index = 0 |
||
| ) |
Get a hash number of combining VRF output, voter address, and vote weight index.
| vrf | VRF output |
| address | voter address |
| index | vote weight index |
|
staticconstexpr |
|
staticconstexpr |