5 #include <boost/multiprecision/mpfr.hpp>
52 strm <<
" [Vrf Pbft Msg] " << std::endl;
53 strm <<
" period: " << pbft_msg.
period_ << std::endl;
54 strm <<
" round: " << pbft_msg.
round_ << std::endl;
55 strm <<
" step: " << pbft_msg.
step_ << std::endl;
132 uint64_t
calculateWeight(uint64_t stake, uint64_t dpos_total_votes_count, uint64_t threshold,
136 strm <<
"[VRF sortition] " << std::endl;
137 strm <<
" proof: " << vrf_sortition.
proof_ << std::endl;
138 strm <<
" output: " << vrf_sortition.
output_ << std::endl;
139 strm << vrf_sortition.
pbft_msg_ << std::endl;
Definition: vrf_wrapper.hpp:25
vrf_output_t output_
Definition: vrf_wrapper.hpp:74
bool operator==(VrfSortitionBase const &other) const
Definition: vrf_wrapper.hpp:41
vrf_proof_t proof_
Definition: vrf_wrapper.hpp:73
bool verify(const vrf_pk_t &pk, const bytes &msg, uint16_t vote_count=1, bool strict=true) const
Definition: vrf_wrapper.cpp:55
bool verify(const vrf_pk_t &pk, bool strict=true) const
Verify VRF sortition.
Definition: vrf_sortition.hpp:102
PbftPeriod period_
Definition: vrf_sortition.hpp:59
VrfPbftMsg pbft_msg_
Definition: vrf_sortition.hpp:143
VrfPbftSortition(vrf_sk_t const &sk, const VrfPbftMsg &pbft_msg)
Definition: vrf_sortition.hpp:85
PbftRound round_
Definition: vrf_sortition.hpp:60
bytes getRlpBytes() const
Get bytes of RLP stream.
Definition: vrf_sortition.cpp:41
friend std::ostream & operator<<(std::ostream &strm, const VrfPbftSortition &vrf_sortition)
Definition: vrf_sortition.hpp:135
PbftVoteTypes getType() const
Get v type based on vote step.
Definition: vrf_sortition.cpp:17
std::string toString() const
Combine vote type, PBFT period, round and step to a string.
Definition: vrf_sortition.cpp:33
PbftStep step_
Definition: vrf_sortition.hpp:61
bool operator==(VrfPbftMsg const &other) const
Definition: vrf_sortition.cpp:37
friend std::ostream & operator<<(std::ostream &strm, VrfPbftMsg const &pbft_msg)
Definition: vrf_sortition.hpp:51
uint64_t calculateWeight(uint64_t stake, uint64_t dpos_total_votes_count, uint64_t threshold, const public_t &address) const
Calculate vote weight.
Definition: vrf_sortition.cpp:85
dev::bytes getRlpBytes() const
Get bytes of RLP stream.
Definition: vrf_sortition.cpp:55
static uint256_t max256bits
Definition: vrf_sortition.hpp:110
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.
Definition: vrf_sortition.cpp:67
static auto kMax256bFP
Definition: vrf_sortition.hpp:111
VrfPbftSortition()=default
bool operator==(VrfPbftSortition const &other) const
Definition: vrf_sortition.hpp:106
VrfPbftMsg class uses PBFT period, round and step to generate a message for doing VRF sortition.
Definition: vrf_sortition.hpp:26
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
dev::h256 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.
Definition: vrf_sortition.cpp:93
std::vector<::byte > bytes
Definition: Common.h:46
bytes rlp(_T _t)
Export a single item in RLP format, returning a byte array.
Definition: RLP.h:665
dev::FixedHash< crypto_vrf_PUBLICKEYBYTES > vrf_pk_t
Definition: vrf_wrapper.hpp:11
dev::FixedHash< crypto_vrf_PROOFBYTES > vrf_proof_t
Definition: vrf_wrapper.hpp:13
dev::FixedHash< crypto_vrf_SECRETKEYBYTES > vrf_sk_t
Definition: vrf_wrapper.hpp:12
dev::FixedHash< crypto_vrf_OUTPUTBYTES > vrf_output_t
Definition: vrf_wrapper.hpp:14
uint32_t PbftStep
Definition: types.hpp:26
uint32_t PbftRound
Definition: types.hpp:25
EthBlockNumber PbftPeriod
Definition: types.hpp:24
boost::multiprecision::uint256_t uint256_t
Definition: types.hpp:29