diff --git a/core/src/cost_update_service.rs b/core/src/cost_update_service.rs index 662348b949..8d818bfeab 100644 --- a/core/src/cost_update_service.rs +++ b/core/src/cost_update_service.rs @@ -107,12 +107,11 @@ impl CostUpdateService { fn service_loop( exit: Arc, - blockstore: Arc, + _blockstore: Arc, cost_model: Arc>, cost_update_receiver: CostUpdateReceiver, ) { let mut cost_update_service_timing = CostUpdateServiceTiming::default(); - let mut dirty: bool; let mut update_count: u64; let wait_timer = Duration::from_millis(100); @@ -121,7 +120,6 @@ impl CostUpdateService { break; } - dirty = false; update_count = 0_u64; let mut update_cost_model_time = Measure::start("update_cost_model_time"); for cost_update in cost_update_receiver.try_iter() { @@ -132,24 +130,14 @@ impl CostUpdateService { CostUpdate::ExecuteTiming { mut execute_timings, } => { - dirty |= Self::update_cost_model(&cost_model, &mut execute_timings); + Self::update_cost_model(&cost_model, &mut execute_timings); update_count += 1; } } } update_cost_model_time.stop(); - let mut persist_cost_table_time = Measure::start("persist_cost_table_time"); - if dirty { - Self::persist_cost_table(&blockstore, &cost_model); - } - persist_cost_table_time.stop(); - - cost_update_service_timing.update( - update_count, - update_cost_model_time.as_us(), - persist_cost_table_time.as_us(), - ); + cost_update_service_timing.update(update_count, update_cost_model_time.as_us(), 0); thread::sleep(wait_timer); } @@ -199,6 +187,7 @@ impl CostUpdateService { dirty } + #[allow(dead_code)] fn persist_cost_table(blockstore: &Blockstore, cost_model: &RwLock) { let cost_model_read = cost_model.read().unwrap(); let cost_table = cost_model_read.get_instruction_cost_table(); diff --git a/core/src/validator.rs b/core/src/validator.rs index 8952207a7c..aaf4adbcd7 100644 --- a/core/src/validator.rs +++ b/core/src/validator.rs @@ -811,7 +811,8 @@ impl Validator { let vote_tracker = Arc::::default(); let mut cost_model = CostModel::default(); - cost_model.initialize_cost_table(&blockstore.read_program_costs().unwrap()); + // initialize cost model with built-in instruction costs only + cost_model.initialize_cost_table(&[]); let cost_model = Arc::new(RwLock::new(cost_model)); let (retransmit_slots_sender, retransmit_slots_receiver) = unbounded();