Skip to content

Commit

Permalink
Revert "[bytecode-verifier] Add metering logic and apply to absint ba…
Browse files Browse the repository at this point in the history
…sed analysis (#58)"

This reverts commit 14d624d.
  • Loading branch information
nkysg authored Feb 28, 2023
1 parent b0d1cda commit 5a2f81e
Show file tree
Hide file tree
Showing 37 changed files with 203 additions and 1,792 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

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

8 changes: 0 additions & 8 deletions language/move-borrow-graph/src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,6 @@ impl<Loc: Copy, Lbl: Clone + Ord> BorrowGraph<Loc, Lbl> {
Self(BTreeMap::new())
}

/// Returns the graph size, that is the number of nodes + number of edges
pub fn graph_size(&self) -> usize {
self.0
.values()
.map(|r| 1 + r.borrowed_by.0.values().map(|e| e.len()).sum::<usize>())
.sum()
}

/// checks if the given reference is mutable or not
pub fn is_mutable(&self, id: RefID) -> bool {
self.0.get(&id).unwrap().mutable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ edition = "2021"
petgraph = "0.5.1"
proptest = "1.0.0"
fail = { version = "0.4.0", features = ['failpoints']}
hex = "0.4.3"

move-bytecode-verifier = { path = "../" }
invalid-mutations = { path = "../invalid-mutations" }
move-core-types = { path = "../../move-core/types" }
move-binary-format = { path = "../../move-binary-format", features = ["fuzzing" ] }
move-binary-format = { path = "../../move-binary-format", features = ["fuzzing"] }

[features]
fuzzing = ["move-binary-format/fuzzing"]
address32 = ["move-core-types/address32"]

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ use move_core_types::{
};
use std::panic::{self, PanicInfo};

// TODO: this tests must run in its own process since otherwise any crashing test here
// secondary-crashes in the panic handler.
#[ignore]
#[test]
fn test_unwind() {
let scenario = FailScenario::setup();
Expand All @@ -22,7 +19,7 @@ fn test_unwind() {
}));

let m = empty_module();
let res = move_bytecode_verifier::verify_module_with_config(&VerifierConfig::unbounded(), &m)
let res = move_bytecode_verifier::verify_module_with_config(&VerifierConfig::default(), &m)
.unwrap_err();
assert_eq!(res.major_status(), StatusCode::VERIFIER_INVARIANT_VIOLATION);
scenario.teardown();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fn test_max_number_of_bytecode() {
nops.push(Bytecode::Ret);
let module = dummy_procedure_module(nops);

let result = CodeUnitVerifier::verify_module(&VerifierConfig::unbounded(), &module);
let result = CodeUnitVerifier::verify_module(&Default::default(), &module);
assert!(result.is_ok());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ proptest! {
}

#[test]
#[cfg(not(feature = "address32"))]
fn valid_primitives() {
let mut module = empty_module();
module.constant_pool = vec![
Expand Down Expand Up @@ -58,7 +57,6 @@ fn valid_primitives() {
}

#[test]
#[cfg(not(feature = "address32"))]
fn invalid_primitives() {
malformed(SignatureToken::U8, vec![0, 0]);
malformed(SignatureToken::U16, vec![0, 0, 0, 0]);
Expand All @@ -74,7 +72,6 @@ fn invalid_primitives() {
}

#[test]
#[cfg(not(feature = "address32"))]
fn valid_vectors() {
let double_vec = |item: Vec<u8>| -> Vec<u8> {
let mut items = vec![2];
Expand Down Expand Up @@ -196,7 +193,6 @@ fn valid_vectors() {
}

#[test]
#[cfg(not(feature = "address32"))]
fn invalid_vectors() {
let double_vec = |item: Vec<u8>| -> Vec<u8> {
let mut items = vec![2];
Expand Down Expand Up @@ -248,7 +244,6 @@ fn tvec(s: SignatureToken) -> SignatureToken {
SignatureToken::Vector(Box::new(s))
}

#[allow(unused)]
fn malformed(type_: SignatureToken, data: Vec<u8>) {
error(type_, data, StatusCode::MALFORMED_CONSTANT_DATA)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use move_binary_format::{
errors::PartialVMResult,
file_format::{Bytecode, CompiledModule, FunctionDefinitionIndex, TableIndex},
};
use move_bytecode_verifier::{control_flow, meter::DummyMeter, VerifierConfig};
use move_bytecode_verifier::{control_flow, VerifierConfig};
use move_core_types::vm_status::StatusCode;

fn verify_module(verifier_config: &VerifierConfig, module: &CompiledModule) -> PartialVMResult<()> {
Expand All @@ -30,7 +30,6 @@ fn verify_module(verifier_config: &VerifierConfig, module: &CompiledModule) -> P
current_function,
function_definition,
code,
&mut DummyMeter,
)?;
}
Ok(())
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

use move_binary_format::file_format::*;
use move_bytecode_verifier::{
limits::LimitsVerifier, verify_module_with_config_for_test, VerifierConfig,
};
use move_bytecode_verifier::{limits::LimitsVerifier, verify_module_with_config, VerifierConfig};
use move_core_types::{
account_address::AccountAddress, identifier::Identifier, vm_status::StatusCode,
};
Expand Down Expand Up @@ -245,8 +243,8 @@ fn big_vec_unpacks() {
module.serialize(&mut mvbytes).unwrap();
let module = CompiledModule::deserialize(&mvbytes).unwrap();

let res = verify_module_with_config_for_test(
"big_vec_unpacks",
// run with mainnet aptos config
let res = verify_module_with_config(
&VerifierConfig {
max_loop_depth: Some(5),
max_generic_instantiation_length: Some(32),
Expand Down
Loading

0 comments on commit 5a2f81e

Please sign in to comment.