Kagome
Polkadot Runtime Engine in C++17
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
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
"
14
#include "
primitives/session_key.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
26
GenericSessionKey
id
;
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
44
AuthorityId
id
;
45
AuthorityWeight
weight{};
46
};
47
51
using
AuthorityList
=
52
common::SLVector<Authority, consensus::kMaxValidatorsNumber>
;
53
54
/*
55
* List of authorities with an identifier
56
*/
57
struct
AuthoritySet
{
58
SCALE_TIE
(2);
59
60
AuthoritySet
() =
default
;
61
62
AuthoritySet
(
AuthoritySetId
id
,
AuthorityList
authorities)
63
: id{
id
}, authorities{authorities} {}
64
65
AuthoritySetId
id
{};
66
AuthorityList
authorities
;
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
kagome::primitives::AuthorityId
Definition:
authority.hpp:23
common.hpp
kagome::primitives::operator<
bool operator<(const AuthorityId &lhs, const AuthorityId &rhs)
Definition:
authority.hpp:29
kagome::primitives::AuthorityIndex
uint32_t AuthorityIndex
Definition:
authority.hpp:36
kagome::primitives::AuthoritySet::end
auto end()
Definition:
authority.hpp:72
kagome::common::Blob< 32 >
kagome::primitives::Authority
Definition:
authority.hpp:41
kagome::primitives::AuthorityWeight
uint64_t AuthorityWeight
Definition:
authority.hpp:19
kagome::primitives::AuthoritySet::begin
auto begin() const
Definition:
authority.hpp:76
kagome::primitives::AuthoritySet::AuthoritySet
AuthoritySet(AuthoritySetId id, AuthorityList authorities)
Definition:
authority.hpp:62
session_key.hpp
kagome::primitives
Definition:
author_api.hpp:19
kagome::primitives::AuthorityId::SCALE_TIE
SCALE_TIE(1)
kagome::common::SizeLimitedContainer
Definition:
size_limited_containers.hpp:35
kagome::primitives::AuthoritySet::begin
auto begin()
Definition:
authority.hpp:68
kagome::primitives::AuthoritySetId
uint64_t AuthoritySetId
Definition:
authority.hpp:20
kagome::primitives::AuthorityListSize
uint64_t AuthorityListSize
Definition:
authority.hpp:21
kagome::primitives::AuthorityId::id
GenericSessionKey id
Definition:
authority.hpp:26
constants.hpp
kagome::primitives::Authority::id
AuthorityId id
Definition:
authority.hpp:44
kagome::primitives::AuthoritySet
Definition:
authority.hpp:57
kagome::primitives::AuthoritySet::end
auto end() const
Definition:
authority.hpp:80
kagome::primitives::AuthoritySet::authorities
AuthorityList authorities
Definition:
authority.hpp:66
tie.hpp
core
primitives
authority.hpp
Generated by
1.8.11