MCPcopy Create free account
hub / github.com/diem/move / verify_script

Method verify_script

language/move-binary-format/src/check_bounds.rs:33–64  ·  view source on GitHub ↗
(script: &'a CompiledScript)

Source from the content-addressed store, hash-verified

31
32impl<'a> BoundsChecker<'a> {
33 pub fn verify_script(script: &'a CompiledScript) -> PartialVMResult<()> {
34 let mut bounds_check = Self {
35 view: BinaryIndexedView::Script(script),
36 context: BoundsCheckingContext::Script,
37 };
38 bounds_check.verify_impl()?;
39
40 let type_param_count = script.type_parameters.len();
41
42 check_bounds_impl(bounds_check.view.signatures(), script.parameters)?;
43 if let Some(sig) = bounds_check
44 .view
45 .signatures()
46 .get(script.parameters.into_index())
47 {
48 for ty in &sig.0 {
49 bounds_check.check_type_parameter(ty, type_param_count)?
50 }
51 }
52
53 // The bounds checker has already checked each function definition's code, but a
54 // script's code exists outside of any function definition. It gets checked here.
55 bounds_check.check_code(
56 &script.code,
57 &script.type_parameters,
58 bounds_check
59 .view
60 .signatures()
61 .get(script.parameters.into_index())
62 .unwrap(),
63 )
64 }
65
66 pub fn verify_module(module: &'a CompiledModule) -> PartialVMResult<()> {
67 let mut bounds_check = Self {

Callers

nothing calls this directly

Calls 8

check_bounds_implFunction · 0.85
verify_implMethod · 0.80
check_type_parameterMethod · 0.80
check_codeMethod · 0.80
ScriptClass · 0.50
lenMethod · 0.45
signaturesMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected