3 #include <json/value.h>
89 bytes rlp(
bool inc_sig =
true,
bool inc_weight =
false)
const;
106 uint64_t
calculateWeight(uint64_t stake,
double dpos_total_votes_count,
double threshold)
const;
112 std::optional<uint64_t>
getWeight()
const;
115 strm <<
"[Vote] " << std::endl;
116 strm <<
" vote_hash: " << vote.
vote_hash_ << std::endl;
117 strm <<
" voter: " << vote.
getVoter() << std::endl;
119 strm <<
" blockhash: " << vote.
block_hash_ << std::endl;
120 if (vote.
weight_) strm <<
" weight: " << vote.
weight_.value() << std::endl;
129 Json::Value
toJSON()
const;
bytes rlp(bool inc_sig=true, bool inc_weight=false) const
Recursive Length Prefix.
Definition: pbft_vote.cpp:56
VrfPbftSortition vrf_sortition_
Definition: pbft_vote.hpp:139
bool verifyVrfSortition(const vrf_pk_t &pk, bool strict) const
Verify VRF sortition.
Definition: pbft_vote.cpp:101
bytes optimizedRlp() const
Optimized Recursive Length Prefix.
Definition: pbft_vote.cpp:80
vote_hash_t sha3(bool inc_sig) const override
Secure Hash Algorithm 3.
Definition: pbft_vote.cpp:125
Json::Value toJSON() const
Get vote in JSON representation.
Definition: pbft_vote.cpp:88
std::optional< uint64_t > weight_
Definition: pbft_vote.hpp:140
friend std::ostream & operator<<(std::ostream &strm, PbftVote const &vote)
Definition: pbft_vote.hpp:114
PbftStep getStep() const
Get vote PBFT step.
Definition: pbft_vote.cpp:123
const VrfPbftSortition & getVrfSortition() const
Get VRF sortition.
Definition: pbft_vote.cpp:103
const public_t & getVoter() const
Get voter public key.
Definition: vote.cpp:20
std::optional< uint64_t > getWeight() const
Get vote weight.
Definition: pbft_vote.cpp:113
uint64_t calculateWeight(uint64_t stake, double dpos_total_votes_count, double threshold) const
Calculate vote weight.
Definition: pbft_vote.cpp:107
PbftVoteTypes getType() const
Get vote type.
Definition: pbft_vote.cpp:117
PbftPeriod getPeriod() const
Get vote PBFT period.
Definition: pbft_vote.cpp:119
PbftRound getRound() const
Get vote PBFT round.
Definition: pbft_vote.cpp:121
bool operator==(const PbftVote &other) const
Definition: pbft_vote.cpp:54
const vrf_wrapper::vrf_proof_t & getSortitionProof() const
Get VRF sortition proof.
Definition: pbft_vote.cpp:105
vote_hash_t vote_hash_
Definition: vote.hpp:74
blk_hash_t block_hash_
Definition: vote.hpp:71
sig_t vote_signature_
Definition: vote.hpp:72
const vrf_wrapper::vrf_output_t & getCredential() const
Get VRF sortition output.
Definition: pbft_vote.cpp:115
PbftVote class is a vote class that includes vote hash, vote on PBFT block hash, vote signature,...
Definition: pbft_vote.hpp:19
Vote class is a vote class that includes vote hash, vote on PBFT block hash, vote signature,...
Definition: vote.hpp:15
VrfPbftSortition class used for doing VRF sortition to place a vote or to propose a new PBFT block.
Definition: vrf_sortition.hpp:76
PbftVoteTypes
Definition: vrf_sortition.hpp:21
std::vector<::byte > bytes
Definition: Common.h:46
dev::FixedHash< crypto_vrf_PUBLICKEYBYTES > vrf_pk_t
Definition: vrf_wrapper.hpp:11
uint32_t PbftStep
Definition: types.hpp:26
uint32_t PbftRound
Definition: types.hpp:25
EthBlockNumber PbftPeriod
Definition: types.hpp:24