-
Notifications
You must be signed in to change notification settings - Fork 11.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUGFIX][CLI] verify-bytecode-meter returns module ticks #16900
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Description Adding a couple of features to the `verify-bytecode-meter` command: - Specify a `--module` (as bytecode) to verify. - Specify a protocol version to verify at. Also switches the `--package` path from a positional parameter to a flag, for symmetry with the new `--module` flag. ## Test Plan: ``` sui-framework/deepbook$ cargo run --bin sui -- \ client verify-bytecode-meter sui-framework/deepbook$ cargo run --bin sui -- \ client verify-bytecode-meter --package . sui-framework/deepbook$ cargo run --bin sui -- \ move build sui-framework/deepbook$ cargo run --bin sui -- \ client verify-bytecode-meter --module build/DeepBook/bytecode_modules/clob.mv sui-framework/deepbook$ cargo run --bin sui -- \ # Errors client verify-bytecode-meter --package '.' \ --module build/DeepBook/bytecode_modules/clob.mv ``` ## Release Notes - Adds a `--module`/`-m` flag to `sui client bytecode-verify-meter` to verify some module bytecode. - Replaces the positional, optional package path parameter for this command with `--package`/`-p`.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
stefan-mysten
approved these changes
Mar 27, 2024
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 │ ╰────────┴────────────┴────────────╯ ```
amnn
force-pushed
the
amnn/verify-fix-mod
branch
from
March 28, 2024 12:55
05e43ea
to
a562268
Compare
amnn
added a commit
that referenced
this pull request
Apr 4, 2024
## Description Pulling the `Meter` trait definition out of each version of the verifier into a common place. This is so that this trait can be used as part of the execution layer interface. The overall motivation is so that we can supply a `Meter` implementation that captures more data when run from the CLI, to improve the quality of output from `sui client verify-bytecode-meter`. ## Test Plan ``` sui$ cargo build --bin sui sui$ cargo simtest sui$ env SUI_SKIP_SIMTESTS=1 cargo nextest run ``` ## Stack - #16899 - #16900
amnn
added a commit
that referenced
this pull request
Apr 4, 2024
## Description Supersede `Verifier::meter_compiled_modules_with_overrides` by: - Allowing `meter_compiled_modules` and `meter_compiled_bytes` to accept a custom meter. - Extracting the generation of `VerifierConfig` out to the `sui-protocol-config` crate. - Splitting up `VerifierConfig` into itself and `MeterConfig`. - Adding a `Verifier::meter` function for creating the meter that is used during signing. - Removed the meter as a field of each `Verifier`. This means that we can now pass a different meter type when we don't want to enforce metering, and no longer need to modify the config in-place to achieve the same result. To make this work, I needed to enable the use of a `&mut dyn Meter` trait object to instantiate what was previously a `&mut impl Meter` parameter everywhere. To do this, I created a forwarding trait implementation of `Meter` for `&mut dyn Meter` and added an extra relaxation of `+ ?Sized` to all the `&mut impl Meter` parameters to allow the trait object to instantiate them. This is in preparation for passing a custom meter into this new parameter when instantiated by the CLI to capture all information about scopes during metering. Today we don't do that which means: - We only report back information about the last module and function we verified. - We can incorrectly report that everything is fine, (package would pass verification) even if there was some previous module or function that exceeded the stated limits. ## Test Plan ``` sui$ cargo build --bin sui sui$ cargo simtest sui$ env SUI_SKIP_SIMTESTS=1 cargo nextest run external-crates$ ./tests.sh deepbook$ cargo run --bin sui -p sui -- client verify-bytecode-meter ``` ## Stack - #16899 - #16900 - #16903
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Stack
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)
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.