Kagome
Polkadot Runtime Engine in C++17
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
runtime_dispatch_info.hpp
Go to the documentation of this file.
1
6
#ifndef KAGOME_RUNTIME_DISPATCH_INFO_HPP
7
#define KAGOME_RUNTIME_DISPATCH_INFO_HPP
8
9
namespace
kagome::primitives
{
10
14
struct
RuntimeDispatchInfo
{
15
using
Weight
= uint64_t;
16
using
Balance
= uint32_t;
17
18
Weight
weight
;
19
20
enum class
DispatchClass
{
21
Normal
,
22
Operational
,
23
/* A mandatory dispatch. These kinds of dispatch are always included
24
* regardless of their weight, therefore it is critical that they are
25
* separately validated to ensure that a malicious validator cannot craft
26
* a valid but impossibly heavy block. Usually this just means ensuring
27
* that the extrinsic can only be included once and that it is always very
28
* light.
29
*
30
* Do *NOT* use it for extrinsics that can be heavy.
31
*
32
* The only real use case for this is inherent extrinsics that are
33
* required to execute in a block for the block to be valid, and it solves
34
* the issue in the case that the block initialization is sufficiently
35
* heavy to mean that those inherents do not fit into the block.
36
* Essentially, we assume that in these exceptional circumstances, it is
37
* better to allow an overweight block to be created than to not allow any
38
* block at all to be created.
39
*/
40
Mandatory
41
}
dispatch_class
;
42
47
Balance
partial_fee
;
48
};
49
50
template
<
class
Stream
,
51
typename
= std::enable_if_t<Stream::is_encoder_stream>>
52
Stream
&
operator<<
(
Stream
&s,
const
RuntimeDispatchInfo
&v) {
53
return
s << v.
weight
<< v.
dispatch_class
<< v.
partial_fee
;
54
}
55
56
template
<
class
Stream
,
57
typename
= std::enable_if_t<Stream::is_decoder_stream>>
58
Stream
&
operator>>
(
Stream
&s,
RuntimeDispatchInfo
&v) {
59
uint8_t
dispatch_class
;
60
s >> v.
weight
>> dispatch_class >> v.
partial_fee
;
61
v.
dispatch_class
=
62
static_cast<
RuntimeDispatchInfo::DispatchClass
>
(
dispatch_class
);
63
return
s;
64
}
65
66
}
// namespace kagome::primitives
67
68
#endif // KAGOME_RUNTIME_DISPATCH_INFO_HPP
kagome::primitives::RuntimeDispatchInfo::DispatchClass::Mandatory
kagome::primitives::RuntimeDispatchInfo::DispatchClass::Normal
kagome::primitives::operator>>
Stream & operator>>(Stream &s, ArithmeticError &v)
Definition:
arithmetic_error.hpp:34
kagome::primitives::RuntimeDispatchInfo::Weight
uint64_t Weight
Definition:
runtime_dispatch_info.hpp:15
kagome::primitives
Definition:
author_api.hpp:19
kagome::primitives::RuntimeDispatchInfo::Balance
uint32_t Balance
Definition:
runtime_dispatch_info.hpp:16
kagome::primitives::RuntimeDispatchInfo::dispatch_class
enum kagome::primitives::RuntimeDispatchInfo::DispatchClass dispatch_class
kagome::primitives::RuntimeDispatchInfo::DispatchClass::Operational
kagome::primitives::RuntimeDispatchInfo::partial_fee
Balance partial_fee
Definition:
runtime_dispatch_info.hpp:47
kagome::primitives::operator<<
Stream & operator<<(Stream &s, const ArithmeticError &v)
Definition:
arithmetic_error.hpp:26
kagome::network::Stream
libp2p::connection::Stream Stream
Definition:
protocol_base_impl.hpp:23
kagome::primitives::RuntimeDispatchInfo
Definition:
runtime_dispatch_info.hpp:14
kagome::primitives::RuntimeDispatchInfo::weight
Weight weight
Definition:
runtime_dispatch_info.hpp:18
kagome::primitives::RuntimeDispatchInfo::DispatchClass
DispatchClass
Definition:
runtime_dispatch_info.hpp:20
core
primitives
runtime_dispatch_info.hpp
Generated by
1.8.11