1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
use crate::{
ability_field_requirements, check_duplication::DuplicationChecker,
code_unit_verifier::CodeUnitVerifier, constants, friends,
instantiation_loops::InstantiationLoopChecker, instruction_consistency::InstructionConsistency,
script_signature, signature::SignatureChecker, struct_defs::RecursiveStructDefChecker,
};
use move_binary_format::{
check_bounds::BoundsChecker,
errors::{Location, VMResult},
file_format::{CompiledModule, CompiledScript},
};
pub fn verify_module(module: &CompiledModule) -> VMResult<()> {
BoundsChecker::verify_module(module).map_err(|e| {
e.finish(Location::Undefined)
})?;
DuplicationChecker::verify_module(module)?;
SignatureChecker::verify_module(module)?;
InstructionConsistency::verify_module(module)?;
constants::verify_module(module)?;
friends::verify_module(module)?;
ability_field_requirements::verify_module(module)?;
RecursiveStructDefChecker::verify_module(module)?;
InstantiationLoopChecker::verify_module(module)?;
CodeUnitVerifier::verify_module(module)
}
pub fn verify_script(script: &CompiledScript) -> VMResult<()> {
BoundsChecker::verify_script(script).map_err(|e| e.finish(Location::Script))?;
DuplicationChecker::verify_script(script)?;
SignatureChecker::verify_script(script)?;
InstructionConsistency::verify_script(script)?;
constants::verify_script(script)?;
CodeUnitVerifier::verify_script(script)?;
script_signature::verify_script(script)
}