Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(state-keeper): Add L2ToL1LogsCriterion #195

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ impl ConditionalSealer {
Box::new(criteria::MaxCyclesCriterion),
Box::new(criteria::ComputationalGasCriterion),
Box::new(criteria::TxEncodingSizeCriterion),
Box::new(criteria::L2ToL1LogsCriterion),
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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::*;
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down