iota_verifier_latest/
lib.rs

1// Copyright (c) Mysten Labs, Inc.
2// Modifications Copyright (c) 2024 IOTA Stiftung
3// SPDX-License-Identifier: Apache-2.0
4
5pub mod verifier;
6
7pub mod entry_points_verifier;
8pub mod global_storage_access_verifier;
9pub mod id_leak_verifier;
10pub mod meter;
11pub mod one_time_witness_verifier;
12pub mod private_generics;
13pub mod struct_with_key_verifier;
14
15use iota_types::error::{ExecutionError, ExecutionErrorKind};
16use move_core_types::{ident_str, identifier::IdentStr, vm_status::StatusCode};
17
18pub const INIT_FN_NAME: &IdentStr = ident_str!("init");
19pub const TEST_SCENARIO_MODULE_NAME: &str = "test_scenario";
20
21fn verification_failure(error: String) -> ExecutionError {
22    ExecutionError::new_with_source(ExecutionErrorKind::IotaMoveVerificationError, error)
23}
24
25fn to_verification_timeout_error(error: String) -> ExecutionError {
26    ExecutionError::new_with_source(ExecutionErrorKind::IotaMoveVerificationTimeout, error)
27}
28
29/// Runs the Move verifier and checks if the error counts as a Move verifier
30/// timeout NOTE: this function only check if the verifier error is a timeout
31/// All other errors are ignored
32pub fn check_for_verifier_timeout(major_status_code: &StatusCode) -> bool {
33    [
34        StatusCode::PROGRAM_TOO_COMPLEX,
35        // Do we want to make this a substatus of `PROGRAM_TOO_COMPLEX`?
36        StatusCode::TOO_MANY_BACK_EDGES,
37    ]
38    .contains(major_status_code)
39}