From db8f30bc0b9f64fcc40ac6c494d0550f6035830d Mon Sep 17 00:00:00 2001 From: anonymousGiga Date: Fri, 24 Nov 2023 11:54:45 +0800 Subject: [PATCH] fix: fix for cachedb size --- Cargo.lock | 10 +++++----- crates/stages/src/stages/execution.rs | 19 ++++++++++--------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d4bb4b200698..f6aa172d9c26 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6230,7 +6230,7 @@ dependencies = [ [[package]] name = "revm" version = "3.3.0" -source = "git+https://github.com/megaeth-labs/revm?branch=andy/debug/performance-dashboard#59ecff8d7bd98028ea04323dc8273393725be739" +source = "git+https://github.com/megaeth-labs/revm?branch=andy/debug/performance-dashboard#d6af4df40fcaa9eb4721ddf980cb3da373b3200d" dependencies = [ "auto_impl", "revm-interpreter", @@ -6242,7 +6242,7 @@ dependencies = [ [[package]] name = "revm-interpreter" version = "1.1.2" -source = "git+https://github.com/megaeth-labs/revm?branch=andy/debug/performance-dashboard#59ecff8d7bd98028ea04323dc8273393725be739" +source = "git+https://github.com/megaeth-labs/revm?branch=andy/debug/performance-dashboard#d6af4df40fcaa9eb4721ddf980cb3da373b3200d" dependencies = [ "derive_more", "enumn", @@ -6254,7 +6254,7 @@ dependencies = [ [[package]] name = "revm-precompile" version = "2.0.3" -source = "git+https://github.com/megaeth-labs/revm?branch=andy/debug/performance-dashboard#59ecff8d7bd98028ea04323dc8273393725be739" +source = "git+https://github.com/megaeth-labs/revm?branch=andy/debug/performance-dashboard#d6af4df40fcaa9eb4721ddf980cb3da373b3200d" dependencies = [ "k256", "num", @@ -6270,7 +6270,7 @@ dependencies = [ [[package]] name = "revm-primitives" version = "1.1.2" -source = "git+https://github.com/megaeth-labs/revm?branch=andy/debug/performance-dashboard#59ecff8d7bd98028ea04323dc8273393725be739" +source = "git+https://github.com/megaeth-labs/revm?branch=andy/debug/performance-dashboard#d6af4df40fcaa9eb4721ddf980cb3da373b3200d" dependencies = [ "arbitrary", "auto_impl", @@ -6294,7 +6294,7 @@ dependencies = [ [[package]] name = "revm-utils" version = "0.1.0" -source = "git+https://github.com/megaeth-labs/revm?branch=andy/debug/performance-dashboard#59ecff8d7bd98028ea04323dc8273393725be739" +source = "git+https://github.com/megaeth-labs/revm?branch=andy/debug/performance-dashboard#d6af4df40fcaa9eb4721ddf980cb3da373b3200d" dependencies = [ "ctor 0.2.5", "serde", diff --git a/crates/stages/src/stages/execution.rs b/crates/stages/src/stages/execution.rs index 938f90f62730..60f879ee29c5 100644 --- a/crates/stages/src/stages/execution.rs +++ b/crates/stages/src/stages/execution.rs @@ -223,16 +223,11 @@ impl ExecutionStage { #[cfg(feature = "enable_execution_duration_record")] duration_record.add_process_state_duration(); - #[cfg(feature = "enable_cache_record")] + #[cfg(all(feature = "enable_test_max_th", feature = "enable_cache_record"))] { - let cachedb_size = executor.get_cachedb_size(); - if let Some(metrics_tx) = &mut self.metrics_tx { - let _ = metrics_tx - .send(MetricEvent::CacheDbSizeInfo { block_number, cachedb_size }); - } - - #[cfg(feature = "enable_test_max_th")] - { + // TODO: Need modify later. + if block_number == 500_000 { + let cachedb_size = executor.get_cachedb_size(); println!( "block_number: {:?}, start_block: {:?}, state.size_hint: {:?}, cache_size: {:?}", block_number, @@ -258,8 +253,14 @@ impl ExecutionStage { #[cfg(feature = "enable_cache_record")] { + let cachedb_size = executor.get_cachedb_size(); let cachedb_record = executor.get_cachedb_record(); if let Some(metrics_tx) = &mut self.metrics_tx { + // This block_number should be delete latter. + let block_number = 0; + let _ = + metrics_tx.send(MetricEvent::CacheDbSizeInfo { block_number, cachedb_size }); + let _ = metrics_tx.send(MetricEvent::CacheDbInfo { cache_db_record: cachedb_record }); }