File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -236,20 +236,19 @@ impl SimulatorTask {
236236 // Get the current number of milliseconds into the slot.
237237 let timepoint_ms =
238238 self . slot_calculator ( ) . current_point_within_slot_ms ( ) . expect ( "host chain has started" ) ;
239- let slot_duration = Duration :: from_secs ( self . slot_calculator ( ) . slot_duration ( ) ) . as_millis ( ) ;
240- let elapsed_in_slot = Duration :: from_millis ( timepoint_ms ) ;
241- let query_cutoff_buffer = Duration :: from_millis ( self . config . block_query_cutoff_buffer ) ;
239+
240+ let slot_duration = self . slot_calculator ( ) . slot_duration ( ) * 1000 ; // convert to milliseconds
241+ let query_cutoff_buffer = self . config . block_query_cutoff_buffer ;
242242
243243 // To find the remaining slot time, subtract the timepoint from the slot duration.
244244 // Then subtract the block query cutoff buffer from the slot duration to account for
245245 // the sequencer stopping signing.
246- let remaining = slot_duration
247- . saturating_sub ( elapsed_in_slot. as_millis ( ) )
248- . saturating_sub ( query_cutoff_buffer. as_millis ( ) ) ;
246+ let remaining =
247+ slot_duration. saturating_sub ( timepoint_ms) . saturating_sub ( query_cutoff_buffer) ;
249248
250249 // The deadline is then calculated by adding the remaining time from this instant.
251250 // NB: Downcast is okay because u64 will work for 500 million+ years.
252- let deadline = Instant :: now ( ) + Duration :: from_millis ( remaining as u64 ) ;
251+ let deadline = Instant :: now ( ) + Duration :: from_millis ( remaining) ;
253252 deadline. max ( Instant :: now ( ) )
254253 }
255254}
You can’t perform that action at this time.
0 commit comments