Skip to content

Commit

Permalink
feat(state-keeper): reapply computational gas limit (#544)
Browse files Browse the repository at this point in the history
## What ❔

for safety reason we want to rllback the removal of comp. gas limit

---------

Signed-off-by: Danil <deniallugo@gmail.com>
Co-authored-by: Danil <deniallugo@gmail.com>
  • Loading branch information
RomanBrodetski and Deniallugo authored Nov 27, 2023
1 parent 0cab378 commit 698dbc3
Showing 1 changed file with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,20 +119,15 @@ 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 {
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 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 extract(metrics: &ExecutionMetrics, _writes: &DeduplicatedWritesMetrics) -> usize {
Expand Down

0 comments on commit 698dbc3

Please sign in to comment.