Like [`Self::reset`], but consults `checkpoint_reader` when reth-labeled blocks cannot be hydrated because their bodies have been pruned.
(
&mut self,
client: Arc<EngineClient_>,
config: Arc<RollupConfig>,
checkpoint_reader: &CheckpointReader,
)
| 411 | /// Like [`Self::reset`], but consults `checkpoint_reader` when reth-labeled blocks cannot be |
| 412 | /// hydrated because their bodies have been pruned. |
| 413 | pub async fn reset_with_checkpoint_reader<CheckpointReader>( |
| 414 | &mut self, |
| 415 | client: Arc<EngineClient_>, |
| 416 | config: Arc<RollupConfig>, |
| 417 | checkpoint_reader: &CheckpointReader, |
| 418 | ) -> Result<L2BlockInfo, EngineResetError> |
| 419 | where |
| 420 | CheckpointReader: ForkchoiceCheckpointReader + ?Sized, |
| 421 | { |
| 422 | // Clear any outstanding tasks to prepare for the reset. |
| 423 | self.clear(); |
| 424 | |
| 425 | let mut start = find_starting_forkchoice_with_checkpoint_reader( |
| 426 | &config, |
| 427 | client.as_ref(), |
| 428 | checkpoint_reader, |
| 429 | ) |
| 430 | .await?; |
| 431 | |
| 432 | // Retry to synchronize the engine until we succeeds or a critical error occurs. |
| 433 | while let Err(err) = SynchronizeTask::new( |
| 434 | Arc::clone(&client), |
| 435 | Arc::clone(&config), |
| 436 | EngineSyncStateUpdate { |
| 437 | unsafe_head: Some(start.un_safe), |
| 438 | local_safe_head: Some(start.safe), |
| 439 | safe_head: Some(start.safe), |
| 440 | finalized_head: Some(start.finalized), |
| 441 | }, |
| 442 | ) |
| 443 | .execute(&mut self.state) |
| 444 | .await |
| 445 | { |
| 446 | match err.severity() { |
| 447 | EngineTaskErrorSeverity::Temporary |
| 448 | | EngineTaskErrorSeverity::Flush |
| 449 | | EngineTaskErrorSeverity::Reset => { |
| 450 | warn!(target: "engine", ?err, "Forkchoice update failed during reset. Trying again..."); |
| 451 | start = find_starting_forkchoice_with_checkpoint_reader( |
| 452 | &config, |
| 453 | client.as_ref(), |
| 454 | checkpoint_reader, |
| 455 | ) |
| 456 | .await?; |
| 457 | } |
| 458 | EngineTaskErrorSeverity::Critical => { |
| 459 | return Err(EngineResetError::Forkchoice(err)); |
| 460 | } |
| 461 | } |
| 462 | } |
| 463 | |
| 464 | // Broadcast the updated state so watch-channel subscribers (e.g. sync-status RPC) |
| 465 | // see the new forkchoice immediately, without waiting for a task to pass through drain(). |
| 466 | self.state_sender.send_replace(self.state); |
| 467 | |
| 468 | Metrics::engine_reset_count().increment(1); |
| 469 | |
| 470 | Ok(start.safe) |