runtime.md 6.32 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Runtime

Types used within the runtime exclusively and pervasively.

## Host Configuration

The internal-to-runtime configuration of the parachain host. This is expected to be altered only by governance procedures.

```rust
struct HostConfiguration {
	/// The minimum frequency at which parachains can update their validation code.
	pub validation_upgrade_frequency: BlockNumber,
	/// The delay, in blocks, before a validation upgrade is applied.
	pub validation_upgrade_delay: BlockNumber,
15
16
17
	/// How long to keep code on-chain, in blocks. This should be sufficiently long that disputes
	/// have concluded.
	pub code_retention_period: BlockNumber,
18
19
20
21
22
23
24
25
26
	/// The maximum validation code size, in bytes.
	pub max_code_size: u32,
	/// The maximum head-data size, in bytes.
	pub max_head_data_size: u32,
	/// The amount of availability cores to dedicate to parathreads.
	pub parathread_cores: u32,
	/// The number of retries that a parathread author has to submit their block.
	pub parathread_retries: u32,
	/// How often parachain groups should be rotated across parachains.
27
	pub group_rotation_frequency: BlockNumber,
28
29
30
31
32
33
34
35
36
	/// The availability period, in blocks, for parachains. This is the amount of blocks
	/// after inclusion that validators have to make the block available and signal its availability to
	/// the chain. Must be at least 1.
	pub chain_availability_period: BlockNumber,
	/// The availability period, in blocks, for parathreads. Same as the `chain_availability_period`,
	/// but a differing timeout due to differing requirements. Must be at least 1.
	pub thread_availability_period: BlockNumber,
	/// The amount of blocks ahead to schedule parathreads.
	pub scheduling_lookahead: u32,
37
38
	/// The maximum number of validators to have per core. `None` means no maximum.
	pub max_validators_per_core: Option<u32>,
39
40
	/// The maximum number of validators to use for parachains, in total. `None` means no maximum.
	pub max_validators: Option<u32>,
41
42
	/// The amount of sessions to keep for disputes.
	pub dispute_period: SessionIndex,
43
44
45
46
47
48
	/// How long after dispute conclusion to accept statements.
	pub dispute_post_conclusion_acceptance_period: BlockNumber,
	/// The maximum number of dispute spam slots 
	pub dispute_max_spam_slots: u32,
	/// How long it takes for a dispute to conclude by time-out, if no supermajority is reached.
	pub dispute_conclusion_by_time_out_period: BlockNumber,
49
50
51
52
	/// The amount of consensus slots that must pass between submitting an assignment and
	/// submitting an approval vote before a validator is considered a no-show.
	/// Must be at least 1.
	pub no_show_slots: u32,
53
54
	/// The number of delay tranches in total.
	pub n_delay_tranches: u32,
55
56
57
58
59
60
61
	/// The width of the zeroth delay tranche for approval assignments. This many delay tranches
	/// beyond 0 are all consolidated to form a wide 0 tranche.
	pub zeroth_delay_tranche_width: u32,
	/// The number of validators needed to approve a block.
	pub needed_approvals: u32,
	/// The number of samples to do of the RelayVRFModulo approval assignment criterion.
	pub relay_vrf_modulo_samples: u32,
Fedor Sakharov's avatar
Fedor Sakharov committed
62
63
64
65
66
	/// Total number of individual messages allowed in the parachain -> relay-chain message queue.
	pub max_upward_queue_count: u32,
	/// Total size of messages allowed in the parachain -> relay-chain message queue before which
	/// no further messages may be added to it. If it exceeds this then the queue may contain only
	/// a single message.
67
68
69
70
71
	pub max_upward_queue_size: u32,
	/// The amount of weight we wish to devote to the processing the dispatchable upward messages
	/// stage.
	///
	/// NOTE that this is a soft limit and could be exceeded.
72
	pub ump_service_total_weight: Weight,
73
	/// The maximum size of an upward message that can be sent by a candidate.
74
	///
75
76
	/// This parameter affects the upper bound of size of `CandidateCommitments`.
	pub max_upward_message_size: u32,
77
	/// The maximum number of messages that a candidate can contain.
78
79
	///
	/// This parameter affects the upper bound of size of `CandidateCommitments`.
80
	pub max_upward_message_num_per_candidate: u32,
81
82
83
84
85
86
	/// The maximum size of a message that can be put in a downward message queue.
	///
	/// Since we require receiving at least one DMP message the obvious upper bound of the size is
	/// the PoV size. Of course, there is a lot of other different things that a parachain may
	/// decide to do with its PoV so this value in practice will be picked as a fraction of the PoV
	/// size.
Sergey Pepyakin's avatar
Sergey Pepyakin committed
87
	pub max_downward_message_size: u32,
88
89
90
91
92
93
94
	/// Number of sessions after which an HRMP open channel request expires.
	pub hrmp_open_request_ttl: u32,
	/// The deposit that the sender should provide for opening an HRMP channel.
	pub hrmp_sender_deposit: u32,
	/// The deposit that the recipient should provide for accepting opening an HRMP channel.
	pub hrmp_recipient_deposit: u32,
	/// The maximum number of messages allowed in an HRMP channel at once.
Sergey Pepyakin's avatar
Sergey Pepyakin committed
95
	pub hrmp_channel_max_capacity: u32,
96
	/// The maximum total size of messages in bytes allowed in an HRMP channel at once.
Sergey Pepyakin's avatar
Sergey Pepyakin committed
97
	pub hrmp_channel_max_total_size: u32,
Sergey Pepyakin's avatar
Sergey Pepyakin committed
98
99
100
101
	/// The maximum number of inbound HRMP channels a parachain is allowed to accept.
	pub hrmp_max_parachain_inbound_channels: u32,
	/// The maximum number of inbound HRMP channels a parathread is allowed to accept.
	pub hrmp_max_parathread_inbound_channels: u32,
102
	/// The maximum size of a message that could ever be put into an HRMP channel.
Sergey Pepyakin's avatar
Sergey Pepyakin committed
103
104
	///
	/// This parameter affects the upper bound of size of `CandidateCommitments`.
105
	pub hrmp_channel_max_message_size: u32,
106
107
108
109
	/// The maximum number of outbound HRMP channels a parachain is allowed to open.
	pub hrmp_max_parachain_outbound_channels: u32,
	/// The maximum number of outbound HRMP channels a parathread is allowed to open.
	pub hrmp_max_parathread_outbound_channels: u32,
Sergey Pepyakin's avatar
Sergey Pepyakin committed
110
111
112
113
	/// The maximum number of outbound HRMP messages can be sent by a candidate.
	///
	/// This parameter affects the upper bound of size of `CandidateCommitments`.
	pub hrmp_max_message_num_per_candidate: u32,
114
115
}
```
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132

## ParaInherentData

Inherent data passed to a runtime entry-point for the advancement of parachain consensus.

This contains 3 pieces of data:
1. [`Bitfields`](availability.md#signed-availability-bitfield) 
2. [`BackedCandidates`](backing.md#backed-candidate)
3. [`MultiDisputeStatementSet`](disputes.md#multidisputestatementset)

```rust
struct ParaInherentData {
	bitfields: Bitfields,
	backed_candidates: BackedCandidates,
	dispute_statements: MultiDisputeStatementSet,
}
```