sui_verifier_v1/
verifier.rsuse move_binary_format::file_format::CompiledModule;
use sui_types::{error::ExecutionError, move_package::FnInfoMap};
use crate::{
entry_points_verifier, global_storage_access_verifier, id_leak_verifier,
one_time_witness_verifier, private_generics, struct_with_key_verifier,
};
use move_bytecode_verifier_meter::{dummy::DummyMeter, Meter};
pub fn sui_verify_module_metered(
module: &CompiledModule,
fn_info_map: &FnInfoMap,
meter: &mut (impl Meter + ?Sized),
) -> Result<(), ExecutionError> {
struct_with_key_verifier::verify_module(module)?;
global_storage_access_verifier::verify_module(module)?;
id_leak_verifier::verify_module(module, meter)?;
private_generics::verify_module(module)?;
entry_points_verifier::verify_module(module, fn_info_map)?;
one_time_witness_verifier::verify_module(module, fn_info_map)
}
pub fn sui_verify_module_metered_check_timeout_only(
module: &CompiledModule,
fn_info_map: &FnInfoMap,
meter: &mut (impl Meter + ?Sized),
) -> Result<(), ExecutionError> {
if let Err(error) = sui_verify_module_metered(module, fn_info_map, meter) {
if matches!(
error.kind(),
sui_types::execution_status::ExecutionFailureStatus::SuiMoveVerificationTimedout
) {
return Err(error);
}
}
Ok(())
}
pub fn sui_verify_module_unmetered(
module: &CompiledModule,
fn_info_map: &FnInfoMap,
) -> Result<(), ExecutionError> {
sui_verify_module_metered(module, fn_info_map, &mut DummyMeter).inspect_err(|err| {
debug_assert!(
!matches!(
err.kind(),
sui_types::execution_status::ExecutionFailureStatus::SuiMoveVerificationTimedout
),
"Unexpected timeout error in execution"
);
})
}