Skip to content
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

[Verifier][Chore] Extract Meter trait from Verifier #16903

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ exclude = [
"external-crates/move/crates/move-bytecode-source-map",
"external-crates/move/crates/move-bytecode-utils",
"external-crates/move/crates/move-bytecode-verifier",
"external-crates/move/crates/move-bytecode-verifier-meter",
"external-crates/move/crates/move-bytecode-viewer",
"external-crates/move/crates/move-cli",
"external-crates/move/crates/move-command-line-common",
Expand Down Expand Up @@ -532,6 +533,7 @@ shlex = "1.3.0"
move-binary-format = { path = "external-crates/move/crates/move-binary-format" }
move-bytecode-utils = { path = "external-crates/move/crates/move-bytecode-utils" }
move-bytecode-source-map = { path = "external-crates/move/crates/move-bytecode-source-map" }
move-bytecode-verifier-meter = { path = "external-crates/move/crates/move-bytecode-verifier-meter" }
move-cli = { path = "external-crates/move/crates/move-cli" }
move-compiler = { path = "external-crates/move/crates/move-compiler" }
move-core-types = { path = "external-crates/move/crates/move-core-types" }
Expand Down
1 change: 1 addition & 0 deletions crates/sui-framework-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ move-bytecode-verifier = { path = "../../external-crates/move/crates/move-byteco
sui-adapter = { path = "../../sui-execution/latest/sui-adapter", package = "sui-adapter-latest" }
sui-verifier = { path = "../../sui-execution/latest/sui-verifier", package = "sui-verifier-latest" }

move-bytecode-verifier-meter.workspace = true
move-cli.workspace = true
move-package.workspace = true
move-unit-test.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/sui-framework-tests/src/metered_verifier.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

use move_bytecode_verifier::meter::Scope;
use move_bytecode_verifier_meter::Scope;
use prometheus::Registry;
use std::{path::PathBuf, sync::Arc, time::Instant};
use sui_adapter::adapter::run_metered_move_bytecode_verifier;
Expand Down
11 changes: 11 additions & 0 deletions external-crates/move/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions external-crates/move/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ move-borrow-graph = { path = "crates/move-borrow-graph" }
move-bytecode-source-map = { path = "crates/move-bytecode-source-map" }
move-bytecode-utils = { path = "crates/move-bytecode-utils" }
move-bytecode-verifier = { path = "crates/move-bytecode-verifier" }
move-bytecode-verifier-meter = { path = "crates/move-bytecode-verifier-meter" }
move-bytecode-viewer = { path = "crates/move-bytecode-viewer" }
move-cli = { path = "crates/move-cli" }
move-command-line-common = { path = "crates/move-command-line-common" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ hex.workspace = true
invalid-mutations.workspace = true
move-binary-format = { workspace = true, features = ["fuzzing"] }
move-bytecode-verifier.workspace = true
move-bytecode-verifier-meter.workspace = true
move-core-types.workspace = true
move-vm-config.workspace = true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

use crate::unit_tests::production_config;
use move_binary_format::{errors::VMResult, CompiledModule};
use move_bytecode_verifier::{meter::BoundMeter, verifier};
use move_bytecode_verifier::verifier;
use move_bytecode_verifier_meter::bound::BoundMeter;

#[allow(unused)]
fn run_binary_test(name: &str, bytes: &str) -> VMResult<()> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use crate::support::dummy_procedure_module;
use move_binary_format::file_format::Bytecode;
use move_bytecode_verifier::meter::DummyMeter;
use move_bytecode_verifier::CodeUnitVerifier;
use move_bytecode_verifier_meter::dummy::DummyMeter;
use move_core_types::vm_status::StatusCode;
use move_vm_config::verifier::VerifierConfig;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ use move_binary_format::{
errors::PartialVMResult,
file_format::{Bytecode, CompiledModule, FunctionDefinitionIndex, TableIndex},
};
use move_bytecode_verifier::{control_flow, meter::DummyMeter};
use move_bytecode_verifier::control_flow;
use move_bytecode_verifier_meter::dummy::DummyMeter;
use move_core_types::vm_status::StatusCode;
use move_vm_config::verifier::VerifierConfig;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use move_binary_format::file_format::{
IdentifierIndex, ModuleHandleIndex, Signature, SignatureIndex, SignatureToken,
Visibility::Public,
};
use move_bytecode_verifier::meter::BoundMeter;
use move_bytecode_verifier_meter::bound::BoundMeter;
use move_core_types::{identifier::Identifier, vm_status::StatusCode};

const NUM_LOCALS: u8 = 64;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@

use crate::unit_tests::production_config;
use move_binary_format::file_format::*;
use move_bytecode_verifier::{
limits::LimitsVerifier, meter::DummyMeter, verify_module_with_config_for_test,
};
use move_bytecode_verifier::{limits::LimitsVerifier, verify_module_with_config_for_test};
use move_bytecode_verifier_meter::dummy::DummyMeter;
use move_core_types::{
account_address::AccountAddress, identifier::Identifier, vm_status::StatusCode,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use move_binary_format::file_format::{
IdentifierIndex, ModuleHandleIndex, Signature, SignatureIndex, SignatureToken,
Visibility::Public,
};
use move_bytecode_verifier::meter::BoundMeter;
use move_bytecode_verifier_meter::bound::BoundMeter;
use move_core_types::{identifier::Identifier, vm_status::StatusCode};

#[test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use move_binary_format::file_format::{
IdentifierIndex, ModuleHandleIndex, Signature, SignatureIndex, SignatureToken,
Visibility::Public,
};
use move_bytecode_verifier::meter::BoundMeter;
use move_bytecode_verifier_meter::bound::BoundMeter;
use move_core_types::{identifier::Identifier, vm_status::StatusCode};

const MAX_BASIC_BLOCKS: u16 = 1024;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

use crate::support::dummy_procedure_module;
use move_binary_format::file_format::Bytecode;
use move_bytecode_verifier::meter::DummyMeter;
use move_bytecode_verifier::CodeUnitVerifier;
use move_bytecode_verifier_meter::dummy::DummyMeter;
use move_core_types::vm_status::StatusCode;

#[test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use move_binary_format::file_format::{
IdentifierIndex, ModuleHandleIndex, Signature, SignatureIndex, SignatureToken,
Visibility::Public,
};
use move_bytecode_verifier::meter::BoundMeter;
use move_bytecode_verifier_meter::bound::BoundMeter;
use move_core_types::{identifier::Identifier, vm_status::StatusCode};

#[test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ use move_binary_format::file_format::{
Bytecode::*, CompiledModule, SignatureToken::*, Visibility::Public, *,
};
use move_bytecode_verifier::{
meter::DummyMeter, verify_module_unmetered, verify_module_with_config_for_test,
SignatureChecker,
verify_module_unmetered, verify_module_with_config_for_test, SignatureChecker,
};
use move_bytecode_verifier_meter::dummy::DummyMeter;
use move_core_types::{
account_address::AccountAddress, identifier::Identifier, vm_status::StatusCode,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use move_binary_format::file_format::{
empty_module, Bytecode, CodeUnit, FunctionDefinition, FunctionHandle, FunctionHandleIndex,
IdentifierIndex, ModuleHandleIndex, Signature, SignatureIndex, SignatureToken, Visibility,
};
use move_bytecode_verifier::meter::DummyMeter;
use move_bytecode_verifier_meter::dummy::DummyMeter;
use move_core_types::{identifier::Identifier, vm_status::StatusCode};

fn vec_sig(len: usize) -> SignatureToken {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "move-bytecode-verifier-meter"
version = "0.1.0"
authors = ["Diem Association <[email protected]>"]
description = "Traits for metering the bytecode verifier"
repository = "https://github.com/diem/diem"
homepage = "https://diem.com"
license = "Apache-2.0"
publish = false
edition = "2021"

[dependencies]
move-binary-format.workspace = true
move-core-types.workspace = true
move-vm-config.workspace = true
Loading
Loading