10 using namespace vrf_wrapper;
16 explicit InvalidVdfSortition(std::string
const& msg) : runtime_error(
"Invalid VdfSortition: " + msg) {}
21 uint64_t total_vote_count);
25 void computeVdfSolution(
const SortitionParams& config,
const bytes& msg,
const std::atomic_bool& cancelled);
28 uint64_t vote_count, uint64_t total_vote_count)
const;
33 vdf_sol_.second == other.
vdf_sol_.second;
37 virtual std::ostream&
print(std::ostream& strm)
const override {
39 strm <<
" Difficulty: " << getDifficulty() << std::endl;
40 strm <<
" Computation Time: " << vdf_computation_time_ << std::endl;
41 strm <<
" Sol1: " <<
dev::toHex(vdf_sol_.first) << std::endl;
42 strm <<
" Sol2: " <<
dev::toHex(vdf_sol_.second) << std::endl;
48 uint16_t getDifficulty()
const;
51 Json::Value getJson()
const;
55 "3d1055a514e17cce1290ccb5befb256b00b8aac664e39e754466fcd631004c9e23d16f23"
56 "9aee2a207e5173a7ee8f90ee9ab9b6a745d27c6e850e7ca7332388dfef7e5bbe6267d1f7"
57 "9f9330e44715b3f2066f903081836c1c83ca29126f8fdc5f5922bf3f9ddb4540171691ac"
58 "cc1ef6a34b2a804a18159c89c39b16edee2ede35");
59 bool verifyVrf(
const vrf_pk_t& pk,
const bytes& vrf_input, uint16_t vote_count)
const;
62 unsigned long vdf_computation_time_ = 0;
63 uint16_t difficulty_ = 0;
65 static const uint32_t kVotesProportion = 1000;
66 static const uint32_t kThresholdCorrection = 10;
Definition: sortition.hpp:13
auto getComputationTime() const
Definition: sortition.hpp:47
virtual std::ostream & print(std::ostream &strm) const override
Definition: sortition.hpp:37
friend std::ostream & operator<<(std::ostream &strm, VdfSortition const &vdf)
Definition: sortition.hpp:45
bool operator!=(VdfSortition const &other) const
Definition: sortition.hpp:35
bool operator==(VdfSortition const &other) const
Definition: sortition.hpp:31
std::pair< bytes, bytes > vdf_sol_
Definition: sortition.hpp:61
Definition: vrf_wrapper.hpp:25
virtual std::ostream & print(std::ostream &strm) const
Definition: vrf_wrapper.hpp:43
bool operator==(VrfSortitionBase const &other) const
Definition: vrf_wrapper.hpp:41
bool operator==(std::weak_ptr< NodeEntry > const &_weak, std::shared_ptr< NodeEntry > const &_shared)
Definition: NodeTable.cpp:32
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
std::string toHex(Iterator _it, Iterator _end, std::string const &_prefix)
Definition: CommonData.h:28
bytes asBytes(std::string const &_b)
Converts a string to a byte array containing the string's (byte) data.
Definition: CommonData.h:87
Definition: sortition.hpp:8
vdf_sortition::VdfSortition VdfSortition
Definition: dag_block.hpp:9
Definition: config.hpp:23
Definition: sortition.hpp:15
InvalidVdfSortition(std::string const &msg)
Definition: sortition.hpp:16