Kagome
Polkadot Runtime Engine in C++17
authority.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_AUTHORITY_HPP
7 #define KAGOME_AUTHORITY_HPP
8 
9 #include <cstdint>
10 #include <functional>
11 
12 #include "consensus/constants.hpp"
13 #include "primitives/common.hpp"
15 #include "scale/tie.hpp"
16 
17 namespace kagome::primitives {
18 
19  using AuthorityWeight = uint64_t;
20  using AuthoritySetId = uint64_t;
21  using AuthorityListSize = uint64_t;
22 
23  struct AuthorityId {
24  SCALE_TIE(1);
25 
27  };
28 
29  inline bool operator<(const AuthorityId &lhs, const AuthorityId &rhs) {
30  return lhs.id < rhs.id;
31  }
32 
36  using AuthorityIndex = uint32_t;
37 
41  struct Authority {
42  SCALE_TIE(2);
43 
45  AuthorityWeight weight{};
46  };
47 
51  using AuthorityList =
53 
54  /*
55  * List of authorities with an identifier
56  */
57  struct AuthoritySet {
58  SCALE_TIE(2);
59 
60  AuthoritySet() = default;
61 
63  : id{id}, authorities{authorities} {}
64 
67 
68  auto begin() {
69  return authorities.begin();
70  }
71 
72  auto end() {
73  return authorities.end();
74  }
75 
76  auto begin() const {
77  return authorities.cbegin();
78  }
79 
80  auto end() const {
81  return authorities.cend();
82  }
83  };
84 
85 } // namespace kagome::primitives
86 
87 #endif // KAGOME_AUTHORITY_HPP
bool operator<(const AuthorityId &lhs, const AuthorityId &rhs)
Definition: authority.hpp:29
uint32_t AuthorityIndex
Definition: authority.hpp:36
uint64_t AuthorityWeight
Definition: authority.hpp:19
AuthoritySet(AuthoritySetId id, AuthorityList authorities)
Definition: authority.hpp:62
uint64_t AuthoritySetId
Definition: authority.hpp:20
uint64_t AuthorityListSize
Definition: authority.hpp:21