Skip to content

Commit

Permalink
[bytecode verifer] Adjust metering to decrease runtime of some tests. (
Browse files Browse the repository at this point in the history
…#62)

Specifically the test below now runs in 1/2 of the time. This adjustment appeard useful because the overall time allocation had to be increased to 8000 million units in production. Adjusted this as the default here too.

```
--> test_merge_state: verification time: 59.414ms, result: CONSTRAINT_NOT_SATISFIED, size: 63kb
```

Also adjusts the default to what aptos uses now in production.
  • Loading branch information
wrwg authored and nkysg committed Feb 28, 2023
1 parent 14d624d commit 459029f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub(crate) fn production_config() -> VerifierConfig {
max_back_edges_per_module: None,

// Same as the default.
max_per_fun_meter_units: Some(1000 * 5000),
max_per_mod_meter_units: Some(1000 * 5000),
max_per_fun_meter_units: Some(1000 * 8000),
max_per_mod_meter_units: Some(1000 * 8000),
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl std::fmt::Display for Label {
}

pub(crate) const STEP_BASE_COST: u128 = 10;
pub(crate) const STEP_PER_LOCAL_COST: u128 = 10;
pub(crate) const STEP_PER_LOCAL_COST: u128 = 20;
pub(crate) const STEP_PER_GRAPH_ITEM_COST: u128 = 50;
pub(crate) const JOIN_BASE_COST: u128 = 100;
pub(crate) const JOIN_PER_LOCAL_COST: u128 = 10;
Expand Down
4 changes: 2 additions & 2 deletions language/move-bytecode-verifier/src/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ impl Default for VerifierConfig {
max_basic_blocks_in_script: None,
/// General metering for the verifier. This defaults to a bound which should align
/// with production, so all existing test cases apply it.
max_per_fun_meter_units: Some(1000 * 5000),
max_per_mod_meter_units: Some(1000 * 5000),
max_per_fun_meter_units: Some(1000 * 8000),
max_per_mod_meter_units: Some(1000 * 8000),
}
}
}
Expand Down

0 comments on commit 459029f

Please sign in to comment.