diff --git a/core/lib/zksync_core/src/state_keeper/seal_criteria/conditional_sealer.rs b/core/lib/zksync_core/src/state_keeper/seal_criteria/conditional_sealer.rs index 3fc378bcb6b..1c83f7d036f 100644 --- a/core/lib/zksync_core/src/state_keeper/seal_criteria/conditional_sealer.rs +++ b/core/lib/zksync_core/src/state_keeper/seal_criteria/conditional_sealer.rs @@ -101,6 +101,7 @@ impl ConditionalSealer { Box::new(criteria::MaxCyclesCriterion), Box::new(criteria::ComputationalGasCriterion), Box::new(criteria::TxEncodingSizeCriterion), + Box::new(criteria::L2ToL1LogsCriterion), ] } } diff --git a/core/lib/zksync_core/src/state_keeper/seal_criteria/criteria/geometry_seal_criteria.rs b/core/lib/zksync_core/src/state_keeper/seal_criteria/criteria/geometry_seal_criteria.rs index 6e5224f4032..5250ab98bb1 100644 --- a/core/lib/zksync_core/src/state_keeper/seal_criteria/criteria/geometry_seal_criteria.rs +++ b/core/lib/zksync_core/src/state_keeper/seal_criteria/criteria/geometry_seal_criteria.rs @@ -20,6 +20,8 @@ pub struct InitialWritesCriterion; pub struct MaxCyclesCriterion; #[derive(Debug, Default)] pub struct ComputationalGasCriterion; +#[derive(Debug, Default)] +pub struct L2ToL1LogsCriterion; trait MetricExtractor { const PROM_METRIC_CRITERION_NAME: &'static str; @@ -119,6 +121,18 @@ impl MetricExtractor for ComputationalGasCriterion { } } +impl MetricExtractor for L2ToL1LogsCriterion { + const PROM_METRIC_CRITERION_NAME: &'static str = "l2_to_l1_logs"; + + fn limit_per_block() -> usize { + GEOMETRY_CONFIG.limit_for_l1_messages_merklizer as usize + } + + fn extract(metrics: &ExecutionMetrics, _writes: &DeduplicatedWritesMetrics) -> usize { + metrics.l2_l1_logs + } +} + #[cfg(test)] mod tests { use super::*; @@ -322,4 +336,9 @@ mod tests { fn computational_gas_seal_criterion() { test_scenario_execution_metrics!(ComputationalGasCriterion, computational_gas_used, u32); } + + #[test] + fn l2_to_l1_logs_seal_criterion() { + test_scenario_execution_metrics!(L2ToL1LogsCriterion, l2_l1_logs, usize); + } } diff --git a/core/lib/zksync_core/src/state_keeper/seal_criteria/criteria/mod.rs b/core/lib/zksync_core/src/state_keeper/seal_criteria/criteria/mod.rs index 39b7165d99d..8e0d89e8e0f 100644 --- a/core/lib/zksync_core/src/state_keeper/seal_criteria/criteria/mod.rs +++ b/core/lib/zksync_core/src/state_keeper/seal_criteria/criteria/mod.rs @@ -7,7 +7,7 @@ mod tx_encoding_size; pub(in crate::state_keeper) use self::{ gas::GasCriterion, geometry_seal_criteria::{ - ComputationalGasCriterion, InitialWritesCriterion, MaxCyclesCriterion, + ComputationalGasCriterion, InitialWritesCriterion, L2ToL1LogsCriterion, MaxCyclesCriterion, RepeatedWritesCriterion, }, pubdata_bytes::PubDataBytesCriterion,