Skip to content

Commit

Permalink
[BUGFIX][CLI] verify-bytecode-meter returns module ticks
Browse files Browse the repository at this point in the history
We were returning the ticks used for the last function as the verifier
ticks, which is not correct.  Returning the ticks used for the last
function is also not particularly useful, but I will fix that in a
follow-up PR.

Test Plan:

```
sui-framework/deepbook$ cargo run --bin sui -- \
  client verify-bytecode-meter
Total number of linter warnings suppressed: 3 (filtered categories: 2)
Running bytecode verifier for 7 modules
╭──────────────────────────────────╮
│ Module will pass metering check! │
├────────┬────────────┬────────────┤
│        │ Module     │ Function   │
│ Max    │ 16000000   │ 16000000   │
│ Used   │ 5869980    │ 7040       │
╰────────┴────────────┴────────────╯
```
  • Loading branch information
amnn committed Mar 28, 2024
1 parent ca47055 commit a562268
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sui-execution/src/latest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ impl<'m> verifier::Verifier for Verifier<'m> {
config.max_per_mod_meter_units = config_overrides.max_per_mod_meter_units;
run_metered_move_bytecode_verifier(modules, &config, &mut self.meter, self.metrics)?;
let fun_meter_units_result = self.meter.get_usage(Scope::Function);
let mod_meter_units_result = self.meter.get_usage(Scope::Function);
let mod_meter_units_result = self.meter.get_usage(Scope::Module);
Ok(VerifierMeteredValues::new(
max_per_fun_meter_current,
max_per_mod_meter_current,
Expand Down
2 changes: 1 addition & 1 deletion sui-execution/src/v0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ impl<'m> verifier::Verifier for Verifier<'m> {
self.metrics,
)?;
let fun_meter_units_result = self.meter.get_usage(Scope::Function);
let mod_meter_units_result = self.meter.get_usage(Scope::Function);
let mod_meter_units_result = self.meter.get_usage(Scope::Module);
Ok(VerifierMeteredValues::new(
max_per_fun_meter_current,
max_per_mod_meter_current,
Expand Down
2 changes: 1 addition & 1 deletion sui-execution/src/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ impl<'m> verifier::Verifier for Verifier<'m> {
config.max_per_mod_meter_units = config_overrides.max_per_mod_meter_units;
run_metered_move_bytecode_verifier(modules, &config, &mut self.meter, self.metrics)?;
let fun_meter_units_result = self.meter.get_usage(Scope::Function);
let mod_meter_units_result = self.meter.get_usage(Scope::Function);
let mod_meter_units_result = self.meter.get_usage(Scope::Module);
Ok(VerifierMeteredValues::new(
max_per_fun_meter_current,
max_per_mod_meter_current,
Expand Down
2 changes: 1 addition & 1 deletion sui-execution/src/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ impl<'m> verifier::Verifier for Verifier<'m> {
config.max_per_mod_meter_units = config_overrides.max_per_mod_meter_units;
run_metered_move_bytecode_verifier(modules, &config, &mut self.meter, self.metrics)?;
let fun_meter_units_result = self.meter.get_usage(Scope::Function);
let mod_meter_units_result = self.meter.get_usage(Scope::Function);
let mod_meter_units_result = self.meter.get_usage(Scope::Module);
Ok(VerifierMeteredValues::new(
max_per_fun_meter_current,
max_per_mod_meter_current,
Expand Down

0 comments on commit a562268

Please sign in to comment.