Skip to content

Commit

Permalink
use average instead of median
Browse files Browse the repository at this point in the history
  • Loading branch information
bchocho committed Dec 10, 2024
1 parent dbe1aae commit 3d233b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion config/src/config/consensus_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ impl Default for ConsensusConfig {
min_blocks_to_activate: 4,
percentile: 0.25,
target_block_time_ms: 200,
min_block_time_ms_to_activate: 100,
min_block_time_ms_to_activate: 10,
min_calibrated_block_gas_limit: 2000,
}),
pipeline_backpressure: vec![
Expand Down
13 changes: 5 additions & 8 deletions consensus/src/liveness/proposal_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,11 @@ impl PipelineBackpressureConfig {
.sorted()
.collect::<Vec<_>>();
if computed_target_block_gas_limits.len() >= config.min_blocks_to_activate {
let computed_target_block_gas_limit = (*computed_target_block_gas_limits
.get(
((config.percentile * computed_target_block_gas_limits.len() as f64)
as usize)
.min(computed_target_block_gas_limits.len() - 1),
)
.expect("guaranteed to be within vector size"))
.max(config.min_calibrated_block_gas_limit);
// TODO: this replaces percentile with mean
let sum: u64 = computed_target_block_gas_limits.iter().sum();
let average = (sum as f64 / computed_target_block_gas_limits.len() as f64) as u64;
let computed_target_block_gas_limit =
average.max(config.min_calibrated_block_gas_limit);
PROPOSER_ESTIMATED_CALIBRATED_BLOCK_TXNS
.observe(computed_target_block_gas_limit as f64);
// Check if calibrated block gas limit is a reduction, to turn on backpressure.
Expand Down

0 comments on commit 3d233b3

Please sign in to comment.