@@ -65,6 +65,9 @@ type RulesRLP struct {
65
65
// Graph options
66
66
Dag DagRules
67
67
68
+ // Emitter options
69
+ Emitter EmitterRules
70
+
68
71
// Epochs options
69
72
Epochs EpochsRules
70
73
@@ -115,6 +118,44 @@ type DagRules struct {
115
118
MaxExtraData uint32
116
119
}
117
120
121
+ // EmitterRules contains options for the emitter of Lachesis events.
122
+ type EmitterRules struct {
123
+ // Interval defines the length of the period
124
+ // between events produced by the emitter in milliseconds.
125
+ // If set to zero, a heuristic is used producing irregular
126
+ // intervals.
127
+ //
128
+ // The Interval is used to control the rate of event
129
+ // production by the emitter. It thus indirectly controls
130
+ // the rate of blocks production on the network, by providing
131
+ // a lower bound. The actual block production rate is also
132
+ // influenced by the number of validators, their weighting,
133
+ // and the inter-connection of events. However, the Interval
134
+ // should provide an effective mean to control the block
135
+ // production rate.
136
+ Interval inter.Timestamp
137
+
138
+ // StallThreshold defines a maximum time the confirmation of
139
+ // new events may be delayed before the emitter considers the
140
+ // network stalled.
141
+ //
142
+ // The emitter has two modes: normal and stalled. In normal
143
+ // mode, the emitter produces events at a regular interval, as
144
+ // defined by the Interval option. In stalled mode, the emitter
145
+ // produces events at a much lower rate, to avoid building up
146
+ // a backlog of events. The StallThreshold defines the upper
147
+ // limit of delay seen for new confirmed events before the emitter
148
+ // switches to stalled mode.
149
+ //
150
+ // This option is disabled if Interval is set to 0.
151
+ StallThreshold inter.Timestamp
152
+
153
+ // StallInterval defines the length of the period between
154
+ // events produced by the emitter in milliseconds when the
155
+ // network is stalled.
156
+ StalledInterval inter.Timestamp
157
+ }
158
+
118
159
// BlocksMissed is information about missed blocks from a staker
119
160
type BlocksMissed struct {
120
161
BlocksNum idx.Block
@@ -250,6 +291,7 @@ func MainNetRules() Rules {
250
291
Name : "main" ,
251
292
NetworkID : MainNetworkID ,
252
293
Dag : DefaultDagRules (),
294
+ Emitter : DefaultEmitterRules (),
253
295
Epochs : DefaultEpochsRules (),
254
296
Economy : DefaultEconomyRules (),
255
297
Blocks : BlocksRules {
@@ -264,6 +306,7 @@ func FakeNetRules() Rules {
264
306
Name : "fake" ,
265
307
NetworkID : FakeNetworkID ,
266
308
Dag : DefaultDagRules (),
309
+ Emitter : DefaultEmitterRules (),
267
310
Epochs : FakeNetEpochsRules (),
268
311
Economy : FakeEconomyRules (),
269
312
Blocks : BlocksRules {
@@ -308,6 +351,14 @@ func DefaultDagRules() DagRules {
308
351
}
309
352
}
310
353
354
+ func DefaultEmitterRules () EmitterRules {
355
+ return EmitterRules {
356
+ Interval : inter .Timestamp (600 * time .Millisecond ),
357
+ StallThreshold : inter .Timestamp (30 * time .Second ),
358
+ StalledInterval : inter .Timestamp (60 * time .Second ),
359
+ }
360
+ }
361
+
311
362
func DefaultEpochsRules () EpochsRules {
312
363
return EpochsRules {
313
364
MaxEpochGas : 1500000000 ,
0 commit comments