From 742002bc4b25742f64d4938b5a4fa4ae30c0550f Mon Sep 17 00:00:00 2001 From: Wen <113942165+wen-coding@users.noreply.github.com> Date: Tue, 5 Nov 2024 10:11:28 -0800 Subject: [PATCH 1/3] Add Prefix to log line so it's easier to search. --- wen-restart/src/heaviest_fork_aggregate.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wen-restart/src/heaviest_fork_aggregate.rs b/wen-restart/src/heaviest_fork_aggregate.rs index 710a6010292daf..ac1e95f9838579 100644 --- a/wen-restart/src/heaviest_fork_aggregate.rs +++ b/wen-restart/src/heaviest_fork_aggregate.rs @@ -163,7 +163,7 @@ impl HeaviestForkAggregate { pub(crate) fn print_block_stake_map(&self) { for ((slot, hash), stake) in self.block_stake_map.iter() { - info!("Slot: {}, Hash: {}, Stake: {}", slot, hash, stake,); + info!("Heaviest Fork Aggregated Slot: {}, Hash: {}, Stake: {}", slot, hash, stake,); } } } From ceecee28ec92edd2da66c7f0e20f1bcfddcf8400 Mon Sep 17 00:00:00 2001 From: Wen <113942165+wen-coding@users.noreply.github.com> Date: Tue, 5 Nov 2024 10:25:39 -0800 Subject: [PATCH 2/3] Make linter happy. --- wen-restart/src/heaviest_fork_aggregate.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wen-restart/src/heaviest_fork_aggregate.rs b/wen-restart/src/heaviest_fork_aggregate.rs index ac1e95f9838579..d2b0f98df3dbe9 100644 --- a/wen-restart/src/heaviest_fork_aggregate.rs +++ b/wen-restart/src/heaviest_fork_aggregate.rs @@ -163,7 +163,10 @@ impl HeaviestForkAggregate { pub(crate) fn print_block_stake_map(&self) { for ((slot, hash), stake) in self.block_stake_map.iter() { - info!("Heaviest Fork Aggregated Slot: {}, Hash: {}, Stake: {}", slot, hash, stake,); + info!( + "Heaviest Fork Aggregated Slot: {}, Hash: {}, Stake: {}", + slot, hash, stake, + ); } } } From be04f0a05f0dd574db7069ba6abcedb18b291d7c Mon Sep 17 00:00:00 2001 From: Wen <113942165+wen-coding@users.noreply.github.com> Date: Tue, 5 Nov 2024 10:47:18 -0800 Subject: [PATCH 3/3] Also print the percentage in both log lines. --- wen-restart/src/heaviest_fork_aggregate.rs | 8 ++++++-- wen-restart/src/wen_restart.rs | 8 +++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/wen-restart/src/heaviest_fork_aggregate.rs b/wen-restart/src/heaviest_fork_aggregate.rs index d2b0f98df3dbe9..0d62824a247963 100644 --- a/wen-restart/src/heaviest_fork_aggregate.rs +++ b/wen-restart/src/heaviest_fork_aggregate.rs @@ -162,10 +162,14 @@ impl HeaviestForkAggregate { } pub(crate) fn print_block_stake_map(&self) { + let total_stake = self.epoch_stakes.total_stake(); for ((slot, hash), stake) in self.block_stake_map.iter() { info!( - "Heaviest Fork Aggregated Slot: {}, Hash: {}, Stake: {}", - slot, hash, stake, + "Heaviest Fork Aggregated Slot: {}, Hash: {}, Stake: {}, Percent: {:.2}%", + slot, + hash, + stake, + *stake as f64 / total_stake as f64 * 100.0, ); } } diff --git a/wen-restart/src/wen_restart.rs b/wen-restart/src/wen_restart.rs index 9296ba8e82bd42..c643e1b62e240e 100644 --- a/wen-restart/src/wen_restart.rs +++ b/wen-restart/src/wen_restart.rs @@ -747,10 +747,12 @@ pub(crate) fn aggregate_restart_heaviest_fork( .unwrap() .total_active_stake = current_total_active_stake; } + let total_active_stake = heaviest_fork_aggregate.total_active_stake(); info!( - "Total active stake: {} Total stake {}", - heaviest_fork_aggregate.total_active_stake(), - total_stake + "Total active stake: {} Total stake {} Active percent: {:.2}%", + total_active_stake, + total_stake, + total_active_stake as f64 / total_stake as f64 * 100.0, ); write_wen_restart_records(wen_restart_path, progress)?; let elapsed = timestamp().saturating_sub(start);