@@ -18,9 +18,10 @@ type BlockRoot = Hash256;
18
18
#[ derive( Clone , Default ) ]
19
19
pub struct Timestamps {
20
20
pub observed : Option < Duration > ,
21
- pub all_blobs_observed : Option < Duration > ,
21
+ pub all_data_for_import_observed : Option < Duration > ,
22
22
pub consensus_verified : Option < Duration > ,
23
23
pub started_execution : Option < Duration > ,
24
+ pub available : Option < Duration > ,
24
25
pub executed : Option < Duration > ,
25
26
pub attestable : Option < Duration > ,
26
27
pub imported : Option < Duration > ,
@@ -32,15 +33,13 @@ pub struct Timestamps {
32
33
pub struct BlockDelays {
33
34
/// Time after start of slot we saw the block.
34
35
pub observed : Option < Duration > ,
35
- /// The time after the start of the slot we saw all blobs.
36
- pub all_blobs_observed : Option < Duration > ,
36
+ /// The time after the start of the slot we saw all blobs / data columns .
37
+ pub all_data_for_import_observed : Option < Duration > ,
37
38
/// The time it took to complete consensus verification of the block.
38
39
pub consensus_verification_time : Option < Duration > ,
39
40
/// The time it took to complete execution verification of the block.
40
41
pub execution_time : Option < Duration > ,
41
42
/// The delay from the start of the slot before the block became available
42
- ///
43
- /// Equal to max(`observed + execution_time`, `all_blobs_observed`).
44
43
pub available : Option < Duration > ,
45
44
/// Time after `available`.
46
45
pub attestable : Option < Duration > ,
@@ -59,34 +58,34 @@ impl BlockDelays {
59
58
let observed = times
60
59
. observed
61
60
. and_then ( |observed_time| observed_time. checked_sub ( slot_start_time) ) ;
62
- let all_blobs_observed = times
63
- . all_blobs_observed
64
- . and_then ( |all_blobs_observed| all_blobs_observed. checked_sub ( slot_start_time) ) ;
61
+ let all_data_for_import_observed =
62
+ times
63
+ . all_data_for_import_observed
64
+ . and_then ( |all_data_for_import_observed| {
65
+ all_data_for_import_observed. checked_sub ( slot_start_time)
66
+ } ) ;
65
67
let consensus_verification_time = times
66
68
. consensus_verified
67
69
. and_then ( |consensus_verified| consensus_verified. checked_sub ( times. observed ?) ) ;
68
70
let execution_time = times
69
71
. executed
70
72
. and_then ( |executed| executed. checked_sub ( times. started_execution ?) ) ;
71
- // Duration since UNIX epoch at which block became available.
72
- let available_time = times
73
- . executed
74
- . map ( |executed| std:: cmp:: max ( executed, times. all_blobs_observed . unwrap_or_default ( ) ) ) ;
75
73
// Duration from the start of the slot until the block became available.
76
- let available_delay =
77
- available_time. and_then ( |available_time| available_time. checked_sub ( slot_start_time) ) ;
74
+ let available_delay = times
75
+ . available
76
+ . and_then ( |available_time| available_time. checked_sub ( slot_start_time) ) ;
78
77
let attestable = times
79
78
. attestable
80
79
. and_then ( |attestable_time| attestable_time. checked_sub ( slot_start_time) ) ;
81
80
let imported = times
82
81
. imported
83
- . and_then ( |imported_time| imported_time. checked_sub ( available_time ?) ) ;
82
+ . and_then ( |imported_time| imported_time. checked_sub ( times . available ?) ) ;
84
83
let set_as_head = times
85
84
. set_as_head
86
85
. and_then ( |set_as_head_time| set_as_head_time. checked_sub ( times. imported ?) ) ;
87
86
BlockDelays {
88
87
observed,
89
- all_blobs_observed ,
88
+ all_data_for_import_observed ,
90
89
consensus_verification_time,
91
90
execution_time,
92
91
available : available_delay,
@@ -157,25 +156,25 @@ impl BlockTimesCache {
157
156
}
158
157
}
159
158
160
- pub fn set_time_blob_observed (
159
+ pub fn set_time_data_for_import_observed (
161
160
& mut self ,
162
161
block_root : BlockRoot ,
163
162
slot : Slot ,
164
163
timestamp : Duration ,
165
164
) {
166
- // Unlike other functions in this file, we update the blob observed time only if it is
167
- // *greater* than existing blob observation times. This allows us to know the observation
168
- // time of the last blob to arrive.
165
+ // Unlike other functions in this file, we update the data observed time only if it is
166
+ // *greater* than existing data observation times. This allows us to know the observation
167
+ // time of the last data to arrive.
169
168
let block_times = self
170
169
. cache
171
170
. entry ( block_root)
172
171
. or_insert_with ( || BlockTimesCacheValue :: new ( slot) ) ;
173
172
if block_times
174
173
. timestamps
175
- . all_blobs_observed
174
+ . all_data_for_import_observed
176
175
. map_or ( true , |prev| timestamp > prev)
177
176
{
178
- block_times. timestamps . all_blobs_observed = Some ( timestamp) ;
177
+ block_times. timestamps . all_data_for_import_observed = Some ( timestamp) ;
179
178
}
180
179
}
181
180
@@ -237,6 +236,15 @@ impl BlockTimesCache {
237
236
)
238
237
}
239
238
239
+ pub fn set_time_available ( & mut self , block_root : BlockRoot , slot : Slot , timestamp : Duration ) {
240
+ self . set_time_if_less (
241
+ block_root,
242
+ slot,
243
+ |timestamps| & mut timestamps. available ,
244
+ timestamp,
245
+ )
246
+ }
247
+
240
248
pub fn set_time_attestable ( & mut self , block_root : BlockRoot , slot : Slot , timestamp : Duration ) {
241
249
self . set_time_if_less (
242
250
block_root,
0 commit comments