Skip to content

Commit

Permalink
feat(state-keeper): Remove computational gas limit from boojum protoc…
Browse files Browse the repository at this point in the history
…ol version (matter-labs#536)

**What**

Removes `ComputationalGasCriterion` from post-Boojum versions

**Why**

* There is no limit on total number of circuits in post-Boojum
* We want to test proving logic when we spend a lot of comp. gas in one
l1 batch (this will result in tens of thousands of prover jobs - we want
to test the system under that circumstances)


Safety: we do need to properly test this on stage before we upgrade
mainnet. We should also discuss if want to introduce _some_ limit - even
though there is no hard limit
  • Loading branch information
RomanBrodetski authored Nov 23, 2023
1 parent 9aec8ef commit e59a7c6
Showing 1 changed file with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,20 @@ impl MetricExtractor for MaxCyclesCriterion {
impl MetricExtractor for ComputationalGasCriterion {
const PROM_METRIC_CRITERION_NAME: &'static str = "computational_gas";

fn limit_per_block(_protocol_version_id: ProtocolVersionId) -> usize {
// We subtract constant to take into account that circuits may be not fully filled.
// This constant should be greater than number of circuits types
// but we keep it larger to be on the safe side.
const MARGIN_NUMBER_OF_CIRCUITS: usize = 100;
const MAX_NUMBER_OF_MUTLIINSTANCE_CIRCUITS: usize =
SCHEDULER_UPPER_BOUND as usize - MARGIN_NUMBER_OF_CIRCUITS;

MAX_NUMBER_OF_MUTLIINSTANCE_CIRCUITS * ERGS_PER_CIRCUIT as usize
fn limit_per_block(protocol_version_id: ProtocolVersionId) -> usize {
if protocol_version_id.is_pre_boojum() {
// We subtract constant to take into account that circuits may be not fully filled.
// This constant should be greater than number of circuits types
// but we keep it larger to be on the safe side.
const MARGIN_NUMBER_OF_CIRCUITS: usize = 100;
const MAX_NUMBER_OF_MUTLIINSTANCE_CIRCUITS: usize =
SCHEDULER_UPPER_BOUND as usize - MARGIN_NUMBER_OF_CIRCUITS;

MAX_NUMBER_OF_MUTLIINSTANCE_CIRCUITS * ERGS_PER_CIRCUIT as usize
} else {
// In boojum there is no limit for computational gas.
usize::MAX
}
}

fn extract(metrics: &ExecutionMetrics, _writes: &DeduplicatedWritesMetrics) -> usize {
Expand Down

0 comments on commit e59a7c6

Please sign in to comment.