Skip to content

Commit

Permalink
[BUGFIX][CLI] verify-bytecode-meter returns module ticks (#16900)
Browse files Browse the repository at this point in the history
## Description

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       │
╰────────┴────────────┴────────────╯
```

## Stack

- #16899 

---
If your changes are not user-facing and do not break anything, you can
skip the following section. Otherwise, please briefly describe what has
changed under the Release Notes section.

### Type of Change (Check all that apply)

- [ ] protocol change
- [x] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
Fixes a bug where `sui client verify-bytecode-meter` incorrectly
returned the ticks used by the last function to be verified as the ticks
used by the last module verified.
  • Loading branch information
amnn authored Mar 28, 2024
1 parent 9a667f6 commit a6cdd43
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 a6cdd43

Please sign in to comment.