-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sui-execution] Verifier trait creates and accepts Meter
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 ```
- Loading branch information
Showing
106 changed files
with
583 additions
and
857 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
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
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
Oops, something went wrong.