From 929cde46c4acc9ca16f16ce26839cbb64afea957 Mon Sep 17 00:00:00 2001 From: Roman Krasiuk Date: Fri, 6 Jan 2023 16:39:54 +0200 Subject: [PATCH] unwind tracing (#750) --- crates/stages/src/stages/bodies.rs | 1 + crates/stages/src/stages/execution.rs | 2 ++ crates/stages/src/stages/headers.rs | 1 + crates/stages/src/stages/sender_recovery.rs | 1 + crates/stages/src/stages/total_difficulty.rs | 1 + 5 files changed, 6 insertions(+) diff --git a/crates/stages/src/stages/bodies.rs b/crates/stages/src/stages/bodies.rs index 9ea0e1b1f4..6caa1f5def 100644 --- a/crates/stages/src/stages/bodies.rs +++ b/crates/stages/src/stages/bodies.rs @@ -183,6 +183,7 @@ impl Stage for BodyStage, input: UnwindInput, ) -> Result { + info!(target: "sync::stages::bodies", to_block = input.unwind_to, "Unwinding"); // Cursors to unwind bodies, ommers, transactions and tx hash to number let mut body_cursor = tx.cursor_mut::()?; let mut ommers_cursor = tx.cursor_mut::()?; diff --git a/crates/stages/src/stages/execution.rs b/crates/stages/src/stages/execution.rs index 270e760858..7b7c3c9ba5 100644 --- a/crates/stages/src/stages/execution.rs +++ b/crates/stages/src/stages/execution.rs @@ -291,6 +291,8 @@ impl Stage for ExecutionStage { tx: &mut Transaction<'_, DB>, input: UnwindInput, ) -> Result { + info!(target: "sync::stages::execution", to_block = input.unwind_to, "Unwinding"); + // Acquire changeset cursors let mut account_changeset = tx.cursor_dup_mut::()?; let mut storage_changeset = tx.cursor_dup_mut::()?; diff --git a/crates/stages/src/stages/headers.rs b/crates/stages/src/stages/headers.rs index b6ac0afab9..3cd5e8def6 100644 --- a/crates/stages/src/stages/headers.rs +++ b/crates/stages/src/stages/headers.rs @@ -144,6 +144,7 @@ impl Result { // TODO: handle bad block + info!(target: "sync::stages::headers", to_block = input.unwind_to, "Unwinding"); tx.unwind_table_by_walker::( input.unwind_to + 1, )?; diff --git a/crates/stages/src/stages/sender_recovery.rs b/crates/stages/src/stages/sender_recovery.rs index 4923b4adad..113d6bc784 100644 --- a/crates/stages/src/stages/sender_recovery.rs +++ b/crates/stages/src/stages/sender_recovery.rs @@ -116,6 +116,7 @@ impl Stage for SenderRecoveryStage { tx: &mut Transaction<'_, DB>, input: UnwindInput, ) -> Result { + info!(target: "sync::stages::sender_recovery", to_block = input.unwind_to, "Unwinding"); // Lookup latest tx id that we should unwind to let latest_tx_id = tx.get_block_body_by_num(input.unwind_to)?.last_tx_index(); tx.unwind_table_by_num::(latest_tx_id)?; diff --git a/crates/stages/src/stages/total_difficulty.rs b/crates/stages/src/stages/total_difficulty.rs index c3cb067d54..3102f98755 100644 --- a/crates/stages/src/stages/total_difficulty.rs +++ b/crates/stages/src/stages/total_difficulty.rs @@ -77,6 +77,7 @@ impl Stage for TotalDifficultyStage { tx: &mut Transaction<'_, DB>, input: UnwindInput, ) -> Result { + info!(target: "sync::stages::total_difficulty", to_block = input.unwind_to, "Unwinding"); tx.unwind_table_by_num_hash::(input.unwind_to)?; Ok(UnwindOutput { stage_progress: input.unwind_to }) }